Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/build-release-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ jobs:
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci --no-optional

- name: Install Composer dependencies and dump autoload
run: |
composer install --no-dev --optimize-autoloader
composer dump-autoload

- name: Build plugin
run: |
npm run build
Expand All @@ -47,4 +52,4 @@ jobs:
- name: Generate ZIP file
uses: 10up/action-wordpress-plugin-build-zip@stable
env:
SLUG: mailchimp
SLUG: mailchimp
7 changes: 6 additions & 1 deletion .github/workflows/wordpress-plugin-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jobs:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install Composer dependencies and dump autoload
run: |
composer install --no-dev --optimize-autoloader
composer dump-autoload

- name: Build
run: |
npm ci --no-optional
Expand Down Expand Up @@ -47,4 +52,4 @@ jobs:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.deploy.outputs.zip-path }}
asset_name: mailchimp.zip
asset_content_type: application/zip
asset_content_type: application/zip
10 changes: 9 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
"10up/phpcs-composer": "^3.0",
"sirbrillig/phpcs-changed": "^2.11"
},
"autoload": {
"psr-4": {
"Mailchimp\\WordPress\\": "src/"
},
"classmap": [
"includes"
]
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
Expand All @@ -26,4 +34,4 @@
"scripts": {
"lint": "phpcs --standard=./phpcs.xml -p -s ."
}
}
}
11 changes: 11 additions & 0 deletions mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

// Define the path to the Composer autoload file
$autoload_file = __DIR__ . '/vendor/autoload.php';

// Check if the autoload file exists
if ( ! file_exists( $autoload_file ) ) {
die( 'Composer autoload file not found. Run `composer install` to generate it.' );
}

// Include the autoload file
require_once $autoload_file;

// Version constant for easy CSS refreshes
define( 'MCSF_VER', '1.6.2' );

Expand Down
Loading