-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(run): Add engines check before executing scripts. (#7021)
Closes #7013 **Summary** A more elaborate description is available in #7013. In short, ensuring scripts are ran in the expected environment can deter hard to diagnose bugs. **Test plan** Given a `node` engine requirement that doesn’t match the current environment: ``` $ cat package.json | grep -i1 '"node"' "engines": { "node": "^10.13.0" }, $ nvm use 8 Now using node v8.12.0 (npm v6.4.1) ``` A script invocation will fail as follows: ``` $ node ~/Code/JavaScript/yarn/lib/cli/index.js run relay yarn run v1.15.0-0 error @artsy/reaction@12.1.10: The engine "node" is incompatible with this module. Expected version "^10.13.0". Got "8.12.0" error Commands cannot run with an incompatible environment. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ``` If need be, this can be overridden with the `--ignore-engines` flag: ``` $ node ~/Code/JavaScript/yarn/lib/cli/index.js run --ignore-engines relay yarn run v1.15.0-0 $ relay-compiler --src ./src --schema data/schema.graphql --language typescript --artifactDirectory ./src/__generated__ --exclude '**/node_modules/**,**/__mocks__/**,**/__generated__/**' ✨ Done in 2.22s. ``` Or, of course, making the environment match the requirements: ``` $ nvm use 10.13 Now using node v10.13.0 (npm v6.4.1) $ node ~/Code/JavaScript/yarn/lib/cli/index.js run relay yarn run v1.15.0-0 $ relay-compiler --src ./src --schema data/schema.graphql --language typescript --artifactDirectory ./src/__generated__ --exclude '**/node_modules/**,**/__mocks__/**,**/__generated__/**' ✨ Done in 1.91s. ```
- Loading branch information
Showing
5 changed files
with
16 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters