Skip to content
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

Having a 'prepare' script causes trouble #4

Open
Treora opened this issue Mar 17, 2020 · 2 comments
Open

Having a 'prepare' script causes trouble #4

Treora opened this issue Mar 17, 2020 · 2 comments

Comments

@Treora
Copy link

Treora commented Mar 17, 2020

If the package.json file defines a prepare script (e.g. to transpile source code), this will be correctly executed while packing and publishing. However, it will again be executed by the consumer that tries to install the package, which then most likely fails. In the npm docs:

prepare: Run both BEFORE the package is packed and published, on local npm install without any arguments, and when installing git dependencies

As a simple workaround, a publish-to-git user could use prepublish instead of prepare, which is almost the same except it is not executed when installing from a git dependency.

Perhaps publish-to-git could automatically remove the prepare script from package.json, or rename it to prepublish, or simply throw a warning when it is present.

@Rush
Copy link
Owner

Rush commented Apr 18, 2020

publish-to-git is not by itself using any prepublish and/or prepare. It's using npm pack
see here https://github.com/Rush/publish-to-git/blob/master/index.js#L45

@Rush
Copy link
Owner

Rush commented Apr 18, 2020

I don't feel npm publish should mess up with somebody's package json ... the design of this package is to be as least invasive as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants