Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

npm calls erroneously call pre-publish script when initially installing dependencies #10705

Closed
silkentrance opened this issue Dec 4, 2015 · 3 comments

Comments

@silkentrance
Copy link

This relates to #3059 but since that has been closed and shut down from any further interaction I will open a new issue.

The reason for calling pre-publish when initially installing local dependencies just fails me.

It might make sense to call upon pre-publish when one uses npm to install a given package from the local filesystem, but even that seems to be out of line, since the package is not going to be published to the package registry.

Please reconsider this design decision as some people require the pre-publish hook to prevent a package from being published unless some other mechanism than npm publish is being used.

I am able to overcome this by implementing a pre-publish hook such as

  "scripts": {
     "prepublish": "echo ${npm_config_argv} | grep 'install' >/dev/null 2>/dev/null || (echo 'use *make publish* or *npm update* instead' && exit 1)"
   },

in order to prevent myself from running npm publish before a proper make dist including running available tests and checking for overall coverage and linting the existing sources and so on.

However, this seems to complicate things for less experienced users.

Another reason for you to reconsider your design decision should be that by making the user implement such hooks will limit the build system to a single platform, which is either windows or *nix.

@othiym23
Copy link
Contributor

othiym23 commented Dec 4, 2015

Closing as a duplicate of #10074, which includes the details of how this is going to be resolved, when the team has the resources available to do so.

@othiym23 othiym23 closed this as completed Dec 4, 2015
@silkentrance
Copy link
Author

@othiym23 oh i missed that. thanks for pointing it out. how about just dropping the prepublishOnly stuff and just introduce the prepare and keep the pre-publish, while not calling any of these when doing a npm install in the package's directory in order to install external dependencies.

@othiym23
Copy link
Contributor

othiym23 commented Dec 5, 2015

The plan as designed is a very careful balance of the needs of several different classes of users with the need to be careful about maintaining backwards compatibility, so that's what we're going to implement.

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

No branches or pull requests

2 participants