Add option to run local lifecycle scripts, but not dependencies
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
I like using lifecycle scripts for local development, but I don’t want third party packages to run their install scripts on my machine.
Typically my scripts look something like this:
{
// …
"scripts": {
"prepack": "tsc --build",
"pretest": "tsc --build",
"test": "node --test"
}
}
The pretest script could be merged into the test script using the && operator. However, I think the output is nicer when npm logs each step.
The prepack script is more important. It makes sure the TypeScript project gets compiler before packing / publishing.
A good first step would be to have an option to only run local scripts, no lifecycle hooks of any dependencies. Another idea is to explicitly allowlist which dependencies are allowed to run their lifecycle hooks. In a next major this could even disallow all dependencies by default.
This is related to #8698, but takes it a step further.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by reading related issue #8698 and tracing npm's lifecycle-script behavior; done means a supported option runs local lifecycle scripts while preventing dependency lifecycle hooks, with the allowlist behavior resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100