-
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
prepublish is run on yarn add package
#3209
Comments
@bestander have you seen this? really annoying and strange. |
also note that |
Honestly, those lifecycle phases stopped making sense to me quite a long time ago. |
in simple cases these hooks may prevent errors, when don't use other tools to automate lifecycle besides package manager. Btw how is |
It would be great for Yarn to have a richer API that allows hooking up to
lifecycle events or even provide implementation for some phases, i.e.
resolving, fetching or linking.
As for Workspaces we are starting to actively working on solutions starting
this week.
I've created an issue that will link all the RFC and PRs related to it
#3294.
…On Sat, 29 Apr 2017 at 11:10, Alex ***@***.***> wrote:
@bestander <https://github.com/bestander>
lifecycle phases stopped making sense to me quite a long time ago
in simple cases this hooks may prevent errors, when don't use other tools
to automate lifecycle besides package manager.
Btw how is workspaces feature going? I didn't find a place where it can
be tracked or read about.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3209 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACBdWG9aMyaO8JaP-qAzvESuBjyyZB_dks5r0wywgaJpZM4NDNV9>
.
|
Hey, just want to add my frustration. Slows yarn dramatically for |
Anyone wants to champion this change? We need to build a chart which scripts and when they should run. |
Yeah, I'm happy to give this a shot. So we need a list of what hooks to run and when, and then update the code to run the hooks at the right time? |
Thanks for volunteering, @deecewan. Yeah, are you up to create an RFC https://github.com/yarnpkg/rfcs? |
sure thing. i'll have a crack over the next couple of days. exam on saturday, but free after that. |
FYI a programmatic comparison of which hooks run and in what order, along with the toold can now be found at https://github.com/andreineculau/package-json-scripts |
@andreineculau, that is quite cool, thanks for categorizing all this, I am sure many people are confused about the state of install scripts. Do you want to send a PR to https://yarnpkg.com/en/docs and link to the spreadsheet? |
To answer the question in your repo, @andreineculau, Yarn tries to match npm@5 where it is applicable. |
@bestander would https://github.com/yarnpkg/website/blob/master/lang/en/docs/cli/run.md be a good place to have a footnote? |
I think a section in https://github.com/yarnpkg/website/blob/master/lang/en/docs/cli/install.md would be more appropriate because it is more related to install command lifecycle |
Closing this due to lack of activity. I also think this is no longer a problem on the latest versions of Yarn. |
@BYK this still is a problem.. yarn 1.3.2 is still running Now, given I have as a work around I can change to |
I am experiencing this on 1.3.2 also! |
Looks like running But you should be able to set yarn/src/cli/commands/install.js Line 993 in 19c8cd5
|
I still experience this quirk for v1.3.2. Is there any reasonable explanation why |
@kaylieEB I tried to do (I'm using Yarn 1.3.2.) |
Some discussion here: yarnpkg/yarn#3209 The long-term behavior of `publish` is to eventually only run on actual publish, but for now, it runs on publish or install, which isn't what we want. `prepublishOnly` is a transitionary hook that unambiguously gets the behavior I want.
Some discussion here: yarnpkg/yarn#3209 The long-term behavior of `publish` is to eventually only run on actual publish, but for now, it runs on publish or install, which isn't what we want. `prepublishOnly` is a transitionary hook that unambiguously gets the behavior I want.
This should be reopened! The bug still exists and development is quite annoying when you have something like Also this might be quite easy to fix by giving the Line 313 in 4177b08
|
@phlmn I was able to work around this problem by switching to But yeah, agreed that it should match whatever latest npm is doing, and sounds like npm never ran prepublish when adding a specific package as a dependency. |
Encountering this issue as well, which generate an infinite loop of commands, using yarn 1.13.0 Is there a way to disable prepublish when adding a package, but still running it when actually publishing? If not, any workaround? |
… publication. Update README. The problem with the old approach with a `prepublish` script is that Yarn keeps running this script all the time (yarnpkg/yarn#3209)
Still an issue over two years later :( |
+1 |
1 similar comment
+1 |
What is the recommended solution to this problem? As far I see that one option is enabling However I would like to see anyone accountable for decision tell us it is either the only way, or that the community is free to contribute to resolve this issue. |
The prepublish script is run on install or add. Apparently this is the standard behavior. See yarnpkg/yarn#3209
Bug due to yarnpkg/yarn#3209
Sorry but why the fuck does prepublish run after installing? Huh? |
@BYK please reopen. |
Still an issue... |
For anyone coming here, I strongly urge you to consider using PNPM rather than NPM or Yarn. Since the switch literally everything just.. works. No hassle, no issues, all dependencies live in one place not hogging memory. |
As of 2022 this bug still there... |
This should be reopened, it's still an issue, and incredibly annoying given my 'prepublish' script runs tests. Why is 'prepublish' even run after 'add'? |
I agree that this should be reopened. Seems very odd that the Also as a sidenote, I came here expecting to find that this was intended behavior, and to be given reason that I disagreed with but would accept due to yarns general ideologies. I didn't think a bug like this was just unfixed lol |
I agree this should be reopened. I was so confused until I found this issue. no idea why this will happen after the install script. |
Since the `prepublish` script is also executed before `yarn add` and other yarn commands (see yarnpkg/yarn#3209) we now use our own release script to avoid this.
0.23.2
prepublish
script is run onyarn add package
I wonder why is it so? NPM does this only when
npm install
notnpm install package
The text was updated successfully, but these errors were encountered: