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

Shouldn't the directions be to run this during "prepublish", not "preinstall"? #63

Open
greim opened this issue Jun 20, 2022 · 1 comment

Comments

@greim
Copy link

greim commented Jun 20, 2022

My head is spinning trying to describe this, so hopefully I can explain myself clearly. You have two fictitious libraries:

  1. lib-js which uses npm-force-resolutions
  2. app-js which uses lib-js

I assert that lib-js should be doing this in its package.json:

"prepublish": "npx npm-force-resolutions"

...not what's currently specified in the README, which is this:

"preinstall": "npx npm-force-resolutions"

Why? Because "preinstall" runs npm-force-resolutions when app-js does an install, where it has no business running. It causes issues such as this.

"prepublish" OTOH should only run npm-force-resolutions when devs of lib-js do a publish or install, which is when you actually want it to run, since its job is to update package-lock.json, not mess with the installs of consuming packages.

Please let me know if I'm misunderstanding something.

@ishowta
Copy link

ishowta commented Jul 6, 2022

I generally agree, but wouldn't prepublish work before install? Furthermore, the latest npm seems to work even if it is not local.
https://docs.npmjs.com/cli/v8/using-npm/scripts

This is probably an npm problem and there is a stackoverflow page that looks like a nightmare.
https://stackoverflow.com/questions/23076968/npm-postinstall-only-on-development

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