Skip to content

Commit

Permalink
Improve scripts for test environment and version update
Browse files Browse the repository at this point in the history
  • Loading branch information
eliot-akira committed Feb 21, 2025
1 parent c1cd678 commit 3f3d1af
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ composer.lock
package-lock.json
yarn.lock
bun.lockb
bun.lock

/artifacts
*.swp
Expand Down
16 changes: 15 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"scripts": {
"start": "wp-now start --blueprint=blueprint.dev.json",
"dev": "concurrently --raw 'roll dev' 'npm run start'",
"start:dev": "concurrently --raw 'roll dev' 'npm run start'",
"dev": "roll dev",
"build": "roll build",
"format": "roll format",
"postinstall": "roll install",
Expand All @@ -27,6 +28,19 @@
"test:7.4": "roll run tests/index.ts PHP_VERSION=7.4",
"test:8.4": "roll run tests/index.ts PHP_VERSION=8.4",
"test:archive": "roll run tests/index.ts TEST_ARCHIVE=1",
"-- Local environment --": "https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env",
"env": "wp-env",
"env:start": "wp-env start",
"env:update": "wp-env start --update",
"env:stop": "wp-env stop",
"env:composer": "FOLDER=`basename $(realpath $PWD)`; wp-env run cli --env-cwd=wp-content/plugins/$FOLDER composer",
"env:composer:install": "wp-env run cli sudo apk add git && npm run env:composer install",
"env:composer:update": "npm run env:composer update",
"env:test": "FOLDER=`basename $(realpath $PWD)`; wp-env run tests-wordpress /var/www/html/wp-content/plugins/$FOLDER/vendor/bin/phpunit --testdox -c /var/www/html/wp-content/plugins/$FOLDER/phpunit.xml --verbose",
"env:test:7.4": "WP_ENV_PHP_VERSION=7.4 wp-env start && npm run env:test",
"env:test:8.2": "WP_ENV_PHP_VERSION=8.2 wp-env start && npm run env:test",
"env:destroy": "wp-env destroy",
"env:clean": "wp-env clean all",
"-- End-to-end testing --": "https://playwright.dev/",
"e2e": "playwright test --config tests/playwright.config.js",
"e2e:install": "playwright install chromium",
Expand Down
6 changes: 3 additions & 3 deletions tools/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ import fs from 'node:fs/promises'
.replace(/return '[0-9]{8}'/, `return '${version}'`)
.replace(/'version' => '[0-9]{8}'/, `'version' => '${version}'`)
.replace(
/'version' => '[0-9]{4}\.[0-9]{2}\.[0-9]{2}'/,
/'version' => '[0-9]{4}\.[0-9]+\.[0-9]+'/,
`'version' => '${versionWithDots}'`,
)
.replace(/\$version = '[0-9]{8}'/, `$version = '${version}'`)
.replace(
/"version": "[0-9]{4}\.[0-9]{2}\.[0-9]{2}"/,
/"version": "[0-9]{4}\.[0-9]+\.[0-9]+"/,
`"version": "${versionWithDots}"`,
)
.replace(
/Version: [0-9]{4}\.[0-9]{2}\.[0-9]{2}/,
/Version: [0-9]{4}\.[0-9]+\.[0-9]+/,
`Version: ${versionWithDots}`,
)

Expand Down

0 comments on commit 3f3d1af

Please sign in to comment.