Bug #33317
openbetter differentiate between build, develop and test dependencies for JavaScript
Description
Ohai,
today, when I run "npm i" in Foreman core, it looks roughly like this:
22:30:38 added 1616 packages from 759 contributors and audited 1640 packages in 137.236s 22:31:08 added 4250 packages from 2660 contributors in 726.496s
Yes, two outputs, as the second one is coming from script/npm-fix-foreman-stories.sh
which is executed as the postinstall
step in our package.json
.
This is slowing down various steps where we always start from a fresh checkout, and is IMHO improvable.
See https://community.theforeman.org/t/speeding-up-debian-package-builds/24957 for a few numbers ;)
My question here is: is there a good way in the JavaScript ecosystem to mark different (dev)Dependencies for different tasks? In the Ruby (and Python) world we can define arbitrary named groups, and then tell "don't install group X" -- I couldn't find anything like that for JavaScript? :(
Updated by Evgeni Golov over 3 years ago
- Related to Feature #33318: provide a list of JavaScript dependencies that can be ignored during package building added
Updated by Evgeni Golov over 3 years ago
- Related to Bug #33319: don't run npm-fix-foreman-stories.sh on every npm install added
Updated by Evgeni Golov over 3 years ago
Yarn supports "dependenciesMeta" (https://yarnpkg.com/configuration/manifest): This field lists some extra information related to the dependencies listed in the dependencies and devDependencies fields.
Which has an "optional" field, that is documented as "If true, the build isn't required to succeed for the install to be considered a success. It's what the optionalDependencies field compiles down to."
So we could tag the non-required deps with that? But NPM doesn't seem to have that :(