-
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
Implement npm@4's prepublish behavior #1499
Conversation
The test failures look unrelated to the changes in this PR |
If you rebase this onto master and push, it should fix the CI builds for this PR. |
fda0ecf
to
e169b7b
Compare
Would love to see this merged |
@Kovensky, still there? 😉 |
Yep. It is hard to keep the branch up-to-date, though, because of the change to the english strings file. Any new string added will conflict with this, so it's easier to only rebase once this is accepted and ready to merge. |
I am not too sure that Yarn would want to follow breaking changes along with npm CLI. Although it seems reasonable to add the new |
@bestander it is very important for |
It is but we need to think better how this should align with semver of yarn. |
Are there any news on this change? Seems pretty important. |
Can we do a minimum non breaking change to support npm3 and npm4 for now? |
As far I see, this PR doesn't break the compatibility with v3, it will just throw a warning in case The warning deprecates |
I am not sure that warning is needed at this point because we haven't discussed what legacy npm features Yarn will support and which ones and when it will drop. Considering that this is a change that affects installation behavior, would you add tests that describe the desired new behavior? |
@bestander any way to inspect the warnings output, in a test, as a result of an install command? I am also not sure what would be a portable way of checking each given lifecycle script ran. On my local testing I just used |
Here is an example of install scripts tests https://github.com/yarnpkg/yarn/blob/master/__tests__/commands/install/integration.js#L372-L389. You don't have to pack the dependencies for the test like there anymore. To test for a warning message, I guess you can access reporter.stdout and then search for a regex in it. |
As this has been around for some time and is controversial I recommend going through RFC. |
Fixes #1323, motivation is explained there.
Lifecycle calls were written in the same order as npm runs them. A deprecation warning for
prepublish
was also added. npm@5 intends to stop runningprepublish
, and a later npm version will renameprepublishOnly
toprepublish
.One notable difference is that
npm pack
is also supposed to runprepare
and (old)prepublish
, butyarn pack
does neither. Not sure where that should go.I also tried looking into writing tests, but as the lifecycle scripts are run by a wrapper rather than by the
Install
class itself, it can't be tested with the helpers used by__tests__/commands/install.js
(?).Sample output for
install
:I don't know how to test
yarn publish
as there is no way to do a dry-run with it AFAICT.