-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Run the prepare script of git dependencies even if NODE_ENV=production #7398
Merged
arcanis
merged 4 commits into
yarnpkg:master
from
figma:jfirebaugh/git-fetcher-force-production
Jul 24, 2019
Merged
Run the prepare script of git dependencies even if NODE_ENV=production #7398
arcanis
merged 4 commits into
yarnpkg:master
from
figma:jfirebaugh/git-fetcher-force-production
Jul 24, 2019
Conversation
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
When installing a git dependency with the `NODE_ENV` environment variable set to `production`, yarn did not run the `prepare` lifecycle script, because `config.production` would default to true, and then `wrapLifecycle` would skip `prepare`: https://github.com/yarnpkg/yarn/blob/b6569538de69e0ccd201f0a33f1f5b52f2656f5b/src/cli/commands/install.js#L1202-L1207 This is contrary to npm's behavior and the intent of `GitFetcher#fetchFromInstallAndPack`, which is to install the dependency with its devDependencies and run all the relevant lifecycle scripts (excluding `prepublish`), regardless of the configuration or environment settings of the parent install command.
Looks good to me! Can you update the CHANGELOG file? |
Thanks! |
|
VincentBailly
pushed a commit
to VincentBailly/yarn
that referenced
this pull request
Jun 10, 2020
yarnpkg#7398) * Run the prepare script of git dependencies even if NODE_ENV=production When installing a git dependency with the `NODE_ENV` environment variable set to `production`, yarn did not run the `prepare` lifecycle script, because `config.production` would default to true, and then `wrapLifecycle` would skip `prepare`: https://github.com/yarnpkg/yarn/blob/b6569538de69e0ccd201f0a33f1f5b52f2656f5b/src/cli/commands/install.js#L1202-L1207 This is contrary to npm's behavior and the intent of `GitFetcher#fetchFromInstallAndPack`, which is to install the dependency with its devDependencies and run all the relevant lifecycle scripts (excluding `prepublish`), regardless of the configuration or environment settings of the parent install command. * Update CHANGELOG.md * Update CHANGELOG.md
VincentBailly
pushed a commit
to VincentBailly/yarn
that referenced
this pull request
Jun 10, 2020
yarnpkg#7398) * Run the prepare script of git dependencies even if NODE_ENV=production When installing a git dependency with the `NODE_ENV` environment variable set to `production`, yarn did not run the `prepare` lifecycle script, because `config.production` would default to true, and then `wrapLifecycle` would skip `prepare`: https://github.com/yarnpkg/yarn/blob/b6569538de69e0ccd201f0a33f1f5b52f2656f5b/src/cli/commands/install.js#L1202-L1207 This is contrary to npm's behavior and the intent of `GitFetcher#fetchFromInstallAndPack`, which is to install the dependency with its devDependencies and run all the relevant lifecycle scripts (excluding `prepublish`), regardless of the configuration or environment settings of the parent install command. * Update CHANGELOG.md * Update CHANGELOG.md
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When installing a git dependency with the
NODE_ENV
environment variable set toproduction
, yarn did not run theprepare
lifecycle script, becauseconfig.production
would default to true, and thenwrapLifecycle
would skipprepare
:yarn/src/cli/commands/install.js
Lines 1202 to 1207 in b656953
This is contrary to npm's behavior and the intent of
GitFetcher#fetchFromInstallAndPack
, which is to install the dependency with its devDependencies and run all the relevant lifecycle scripts (excludingprepublish
), regardless of the configuration or environment settings of the parent install command.Test plan
Added an automated test.
cc @Volune, who added the original feature in #3553. Thanks for the test case which I cribbed from!