feature:npm
Introduction
feature:npm runs npm in a feature’s frontend/, inside the SPLENT toolchain image, so the lock is always written by the same npm. Use it to manage the dependencies of a feature with frontend/.
splent feature:npm charts install chart.js@4.5.1
Everything after the feature goes to npm as you would type it, and the command exits with npm’s exit code. install, i, add, update, up and upgrade save the exact version. The next feature:compile installs it from the lock.
Removing, updating and auditing
splent feature:npm charts uninstall chart.js
splent feature:npm charts outdated
splent feature:npm charts audit --omit=dev --omit=peer
Using a singleton of the shell
Bootstrap and feather-icons come from the shell. Do not install them, declare them as peers in frontend/package.json by hand.
"peerDependencies": { "bootstrap": "^5.2.0" }
The bundle then uses window.bootstrap. Installed as a dependency, the build stops and tells you to move it.
How it runs
npm runs in a throwaway container of the toolchain image, with the network, as the workspace’s owner. Only frontend/ is mounted, npm’s cache is .splent_cache/npm, and --ignore-scripts goes with every command.
frontend/.npmrcsetsengine-strict, andpackage.jsonasks for the toolchain’s Node and npm. An npm of another major run by hand refuses to touch the lock.
Reference
| Argument | Description |
|---|---|
FEATURE_REF |
charts, splent_feature_charts or splent-io/splent_feature_charts. A pinned @<version> is refused |
NPM_ARGS |
What npm runs. Required |
Requirements
- The feature’s working copy at the workspace root, with
frontend/package.json. Create it withfeature:frontend:init, orfeature:create --frontend. - Docker, and the network to reach the npm registry.
See also
feature:releaseexplains the licence and audit gates.