-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reworked run
Command Parsing
#50559
Reworked run
Command Parsing
#50559
Changes from all commits
1ac698b
95566c8
759b2a6
c3aba22
57ef745
0f05032
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,7 +272,7 @@ | |
"fixtures:generate": "cross-env GENERATE_MISSING_FIXTURES=y npm run test:unit test/integration/full-content/ && npm run format test/integration/fixtures/blocks/*.json", | ||
"fixtures:regenerate": "npm-run-all fixtures:clean fixtures:generate", | ||
"format": "wp-scripts format", | ||
"format:php": "wp-env run --env-cwd=\"wp-content/plugins/gutenberg\" cli composer run-script format", | ||
"format:php": "wp-env run --env-cwd='wp-content/plugins/gutenberg' cli composer run-script format", | ||
"lint": "concurrently \"npm run lint:lockfile\" \"npm run lint:tsconfig\" \"npm run lint:js\" \"npm run lint:pkg-json\" \"npm run lint:css\"", | ||
"lint:css": "wp-scripts lint-style \"**/*.scss\"", | ||
"lint:css:fix": "npm run lint:css -- --fix", | ||
|
@@ -282,7 +282,7 @@ | |
"lint:tsconfig": "node ./bin/validate-tsconfig.mjs", | ||
"lint:md:docs": "wp-scripts lint-md-docs", | ||
"prelint:php": "wp-env run --env-cwd='wp-content/plugins/gutenberg' cli composer update --no-interaction", | ||
"lint:php": "wp-env run --env-cwd=\"wp-content/plugins/gutenberg\" cli composer run-script lint", | ||
"lint:php": "wp-env run --env-cwd='wp-content/plugins/gutenberg' cli composer run-script lint", | ||
"lint:pkg-json": "wp-scripts lint-pkg-json . 'packages/*/package.json'", | ||
"native": "npm run --prefix packages/react-native-editor", | ||
"other:changelog": "node ./bin/plugin/cli.js changelog", | ||
|
@@ -312,15 +312,15 @@ | |
"test:performance": "wp-scripts test-e2e --config packages/e2e-tests/jest.performance.config.js", | ||
"test:performance:debug": "wp-scripts --inspect-brk test-e2e --runInBand --no-cache --verbose --config packages/e2e-tests/jest.performance.config.js --puppeteer-devtools", | ||
"test:php": "npm-run-all lint:php test:unit:php", | ||
"test:php:watch": "wp-env run composer run-script test:watch", | ||
"test:php:watch": "wp-env run --env-cwd='wp-content/plugins/gutenberg' tests-cli composer run-script test:watch", | ||
"test:unit": "wp-scripts test-unit-js --config test/unit/jest.config.js", | ||
"test:unit:date": "bash ./bin/unit-test-date.sh", | ||
"test:unit:debug": "wp-scripts --inspect-brk test-unit-js --runInBand --no-cache --verbose --config test/unit/jest.config.js ", | ||
"test:unit:profile": "wp-scripts --cpu-prof test-unit-js --runInBand --no-cache --verbose --config test/unit/jest.config.js ", | ||
"pretest:unit:php": "wp-env start", | ||
"test:unit:php": "wp-env run --env-cwd=\"wp-content/plugins/gutenberg\" tests-wordpress vendor/bin/phpunit -c phpunit.xml.dist --verbose", | ||
"test:unit:php": "wp-env run --env-cwd='wp-content/plugins/gutenberg' tests-wordpress vendor/bin/phpunit -c phpunit.xml.dist --verbose", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed the explicit |
||
"pretest:unit:php:multisite": "wp-env start", | ||
"test:unit:php:multisite": "wp-env run --env-cwd=\"wp-content/plugins/gutenberg\" tests-wordpress vendor/bin/phpunit -c phpunit/multisite.xml --verbose", | ||
"test:unit:php:multisite": "wp-env run --env-cwd='wp-content/plugins/gutenberg' tests-wordpress vendor/bin/phpunit -c phpunit/multisite.xml --verbose", | ||
"test:unit:update": "npm run test:unit -- --updateSnapshot", | ||
"test:unit:watch": "npm run test:unit -- --watch", | ||
"wp-env": "wp-env" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,13 @@ | |
|
||
## Unreleased | ||
|
||
### Breaking Change | ||
|
||
- Rework`run` command to resolve bugs with non-quoted commands. As a consequence it is no longer possible to pass your entire command to `wp-env` wrapped in double-quotes. While `npx wp-env run cli wp help` will still work, `npx wp-env run cli "wp help"` will not. If you are currently escaping any quotes you will need to review those commands and ensure they are compatible with this update. | ||
|
||
### Enhancement | ||
|
||
- Support using double dashes in `wp-env run ...` to pass arguments that would otherwise be consumed by `wp-env`. For example, while normally `--help` would provide the `wp-env` help text, if you use `npx wp-env run cli php -- --help` you will see the PHP help text. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The thing that gets me about this change is that I have always hated the I personally prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, this is just a consequence of using |
||
- Validate whether or not config options exist to prevent accidentally including ones that don't. | ||
|
||
## 7.0.0 (2023-05-10) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict'; | ||
|
||
/** | ||
* A list of the containers that we can use `run` on. | ||
*/ | ||
const RUN_CONTAINERS = [ | ||
'mysql', | ||
'tests-mysql', | ||
'wordpress', | ||
'tests-wordpress', | ||
'cli', | ||
'tests-cli', | ||
]; | ||
|
||
/** | ||
* Custom parsing and validation for the "run" command's container argument. | ||
* | ||
* @param {string} value The user-set container. | ||
* | ||
* @return {string} The container name to use. | ||
*/ | ||
function validateRunContainer( value ) { | ||
// Give special errors for deprecated containers. | ||
if ( value === 'phpunit' ) { | ||
throw new Error( | ||
"The 'phpunit' container has been removed. Please use 'wp-env run tests-cli --env-cwd=wp-content/path/to/plugin phpunit' instead." | ||
); | ||
} | ||
if ( value === 'composer' ) { | ||
throw new Error( | ||
"The 'composer' container has been removed. Please use 'wp-env run cli --env-cwd=wp-content/path/to/plugin composer' instead." | ||
); | ||
} | ||
|
||
return value; | ||
} | ||
|
||
module.exports = { | ||
RUN_CONTAINERS, | ||
validateRunContainer, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙈