[RRFC] Optional install
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 777
- Forks
- 267
- PR merge metrics
- No merged PRs in 30d
Description
- Motivation ("The Why")
- Example
- How
- Current Behaviour
- Desired Behaviour
- Exclude packages
- Unique listing
- References
Motivation ("The Why")
As a Continuous Integration maintainer, I'm highly interested in fast build jobs. Installing dependencies one of the key parts here.
Caching helps significantly speed up, but:
- it's not stale, dependencies can be updated pretty often, so cache invalidation as well
- not all dependencies are cachable
I highly appreciate that npm has --production flag feature, that allows us to avoid devDependcies installation, this technique significantly reduces install time for delivery jobs.
It would be so nice if such behavior could be more eloquent and we can define or exclude certain packages from being installed. Lemme give some example
Example
Let's say we running some test jobs in parallel, based on type:
- static, uses
eslint,stylelint,typescript, etc. - units, uses
jest,redux-mock-store, etc. - end-to-end, that uses some dev-server,
cypress, cypress plugin, etc.
{
"devDependencies": {
"cypress": "*",
"eslint": "*",
"express": "*",
"jest": "*",
"stylelint": "*",
"redux-mock-store": "*",
"typescript": "*",
},
"dependencies": {
"react": "*",
"redux": "*",
"webpack": "*",
}
}
How
Current Behaviour
Each of the jobs installs all dependencies. Hower "static" and "unit" don't need packages from end-to-end, but have to install it together with all "devDependencies".
Desired Behaviour
I have no strong vision of how API should look like in the end, but can give a couple of ideas:
Exclude packages
As an additional argument, that accepts list of package to be ignored upon install
npm i --exclude=express,cypress
Unique listing
Assemble own unique lists
{
"staticDependencies": {
"eslint": "*",
"stylelint": "*",
"typescript": "*",
},
"unitDependencies": {
"jest": "*",
"redux-mock-store": "*"
},
"e2eDependencies": {
"cypress": "*",
"express": "*",
},
"dependencies": {
"react": "*",
"redux": "*",
"webpack": "*",
}
}
Can follow the same rule as --production, and install packages from "dependencies" & unique list. For example
npm i --dependencies=static
or
npm i --staticDependencies
References
Sorry, I haven't found anything useful to ref
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 repository files or tests are named. Start by reviewing the npm install entry point and the RFC discussion, then compare the proposed package-exclusion and named-dependency-group behaviors. Done requires an agreed API and corresponding implementation and tests for selective installation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100