From a183c106be04f07493be05f0193cba85ff23e4b5 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Tue, 28 Nov 2023 16:28:19 -0500 Subject: [PATCH 1/5] added - update composer config --- .github/workflows/cs.yml | 3 ++ .github/workflows/lint.yml | 4 +++ composer.json | 56 +++++++++++++++++++------------------- run-composer.sh | 3 ++ update-composer-config.php | 25 +++++++++++++++++ 5 files changed, 63 insertions(+), 28 deletions(-) create mode 100755 run-composer.sh create mode 100644 update-composer-config.php diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index 080f6963..580c33a9 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -24,6 +24,9 @@ jobs: - name: Checkout code uses: actions/checkout@v3 + - name: Run custom composer script + run: ./run-composer.sh + - name: Install PHP uses: shivammathur/setup-php@v2 with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 96d7fd9e..ac3aec41 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,6 +7,7 @@ on: - master - develop - trunk + - 'feature/**' - 'release/**' - 'hotfix/[0-9]+.[0-9]+*' pull_request: @@ -35,6 +36,9 @@ jobs: - name: Checkout code uses: actions/checkout@v3 + - name: Run custom composer script + run: ./run-composer.sh + - name: Install PHP uses: shivammathur/setup-php@v2 with: diff --git a/composer.json b/composer.json index fa5b0de4..626ca848 100644 --- a/composer.json +++ b/composer.json @@ -2,16 +2,16 @@ "name": "equalizedigital/accesibility-checker", "description": "Audit and check your website for accessibility before you hit publish. In-post accessibility scanner and guidance.", "keywords": [ - "accessibility", - "accessible", - "wcag" - ], + "accessibility", + "accessible", + "wcag" + ], "homepage": "https://equalizedigital.com/accessibility-checker/", - "license": "GPL-3.0-or-later", + "license": "GPL-3.0-or-later", "authors": [ { "name": "Equalize Digital", - "homepage": "https://equalizedigital.com" + "homepage": "https://equalizedigital.com" } ], "type": "wordpress-plugin", @@ -36,33 +36,33 @@ "require-dev": { "automattic/vipwpcs": "^3", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", - "equalizedigital/accessibility-checker-wp-env": "1.0.0", "phpcompatibility/php-compatibility": "*", - "yoast/wp-test-utils": "^1.1.1", - "php-parallel-lint/php-parallel-lint": "^1.3" + "yoast/wp-test-utils": "^1.1.1", + "php-parallel-lint/php-parallel-lint": "^1.3", + "equalizedigital/accessibility-checker-wp-env": "1.0.0" }, "require": { "cbschuld/browser.php": "^1.9", "davechild/textstatistics": "1.0.2", "php": ">=7.4", - "composer/installers": "^1.12.0" + "composer/installers": "^1.12.0" }, "scripts": { - "lint": [ - "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude node_modules --exclude .git" - ], - "config-yoastcs" : [ - "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run", - "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --config-set default_standard Yoast" - ], - "check-cs": [ - "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --runtime-set testVersion 7.4-" - ], - "fix-cs": [ - "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf" - ], - "test": [ - "@php ./vendor/phpunit/phpunit/phpunit" - ] - } -} + "lint": [ + "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude node_modules --exclude .git" + ], + "config-yoastcs": [ + "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run", + "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --config-set default_standard Yoast" + ], + "check-cs": [ + "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --runtime-set testVersion 7.4-" + ], + "fix-cs": [ + "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf" + ], + "test": [ + "@php ./vendor/phpunit/phpunit/phpunit" + ] + } +} \ No newline at end of file diff --git a/run-composer.sh b/run-composer.sh new file mode 100755 index 00000000..2f953c09 --- /dev/null +++ b/run-composer.sh @@ -0,0 +1,3 @@ +#!/bin/bash +php update-composer-config.php +composer install \ No newline at end of file diff --git a/update-composer-config.php b/update-composer-config.php new file mode 100644 index 00000000..1c16005b --- /dev/null +++ b/update-composer-config.php @@ -0,0 +1,25 @@ + Date: Tue, 28 Nov 2023 16:54:08 -0500 Subject: [PATCH 2/5] updated - phpcs to exclude update-composer-config.php --- phpcs.xml | 1 + update-composer-config.php | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpcs.xml b/phpcs.xml index 970856e3..cece5245 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -11,6 +11,7 @@ ./node_modules/ ./.wp-env/ ./simple_html_dom.php + ./update-composer-config.php diff --git a/update-composer-config.php b/update-composer-config.php index 1c16005b..ddafbd83 100644 --- a/update-composer-config.php +++ b/update-composer-config.php @@ -9,12 +9,12 @@ $env = getenv( 'GITHUB_ACTIONS' ); $composer_json_path = 'composer.json'; -$composer_config = json_decode( file_get_contents( $composer_json_path ), true ); +$composer_config = json_decode( file_get_contents( $composer_json_path ), true ); if ( 'true' === $env ) { // Running in GitHub Actions environment. // Remove local specific packages for GitHub Actions environment. - unset($composer_config['require-dev']['equalizedigital/accessibility-checker-wp-env']); + unset( $composer_config['require-dev']['equalizedigital/accessibility-checker-wp-env'] ); } else { // Not running in GitHub Actions, assuming local environment. // Add your local specific packages. @@ -22,4 +22,3 @@ } file_put_contents( $composer_json_path, json_encode( $composer_config, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) ); - From c0fe6ca03b2bc033cbaae404e916602d4faf0e1f Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 28 Nov 2023 16:09:08 -0600 Subject: [PATCH 3/5] Update - add run-composer to npm start --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1386c5e3..691c1550 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "hard-reset": "./hard-reset.sh", "wp:clean": "npx wp-env clean all", "wp:sql": "npx wp-env run cli wp db cli", - "start": "npx wp-env start", + "start": "npx wp-env start && ./run-composer.sh", "stop": "npx wp-env stop", "build": "npx webpack", "dev": "npx webpack --watch --mode development", From 829571b5a939ddc66cf47d766a3208aff7b15cb1 Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 28 Nov 2023 16:15:32 -0600 Subject: [PATCH 4/5] Update - run-composer then wp-env --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 691c1550..5d5c7e4c 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "hard-reset": "./hard-reset.sh", "wp:clean": "npx wp-env clean all", "wp:sql": "npx wp-env run cli wp db cli", - "start": "npx wp-env start && ./run-composer.sh", + "start": "./run-composer.sh && npx wp-env start", "stop": "npx wp-env stop", "build": "npx webpack", "dev": "npx webpack --watch --mode development", From e291d50c3b40e97804dabb5325a6e73629feee84 Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Tue, 28 Nov 2023 17:39:52 -0500 Subject: [PATCH 5/5] update - shell script --- run-composer.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/run-composer.sh b/run-composer.sh index 2f953c09..439efaa5 100755 --- a/run-composer.sh +++ b/run-composer.sh @@ -1,3 +1,4 @@ #!/bin/bash php update-composer-config.php -composer install \ No newline at end of file + +composer update \ No newline at end of file