version: 1
commands:
- id: node.init
cmd: npm init -y
desc: Start a new package with a default package.json
tags: [node, npm, init, new, package.json]
- id: node.install
cmd: npm install
desc: Install the dependencies this project declares
tags: [node, npm, install, dependencies]
- id: node.install.clean
cmd: npm ci
desc: Install exactly what the lock file says, from an empty tree
tags: [node, npm, ci, install, lockfile, reproducible]
- id: node.install.package
cmd: npm install <package>
desc: Add a package to the project
tags: [node, npm, install, add, package]
params:
package:
desc: Package name, with a version if you need one
- id: node.install.dev
cmd: npm install -D <package>
desc: Add a package that is only needed while developing
tags: [node, npm, install, dev, devDependencies]
params:
package:
desc: Package name, with a version if you need one
- id: node.uninstall
cmd: npm uninstall <package>
desc: Remove a package from the project
tags: [node, npm, uninstall, remove, package]
params:
package:
desc: Package to remove
- id: node.run.script
cmd: npm run <script>
desc: Run one of the scripts in package.json
tags: [node, npm, run, script]
params:
script:
desc: Script name, such as build or test
- id: node.scripts.list
cmd: npm run
desc: Find out what this project can be told to do
tags: [node, npm, scripts, list, package.json]
- id: node.test
cmd: npm test
desc: Run the project's tests
tags: [node, npm, test]
- id: node.run.without-installing
cmd: npx --yes <package> <arguments>
desc: Run a tool once without adding it to the project
tags: [node, npx, run, tool, once]
params:
package:
desc: Package providing the command
arguments:
desc: Arguments to pass to it
- id: node.deps.outdated
cmd: npm outdated
desc: See which dependencies have moved on without you
tags: [node, npm, outdated, dependencies, update]
- id: node.deps.update
cmd: npm update
desc: Update the dependencies within the ranges package.json allows
tags: [node, npm, update, dependencies, upgrade]
- id: node.deps.why
cmd: npm why <package>
desc: Find out which dependency is dragging a package in
tags: [node, npm, why, dependencies, tree]
params:
package:
desc: Package to trace back
- id: node.deps.audit
cmd: npm audit fix
desc: Fix the dependencies with known vulnerabilities where a compatible update exists
tags: [node, npm, audit, vulnerabilities, security]
- id: node.cache.clear
cmd: npm cache clean --force
desc: Throw the download cache away when installs keep failing
tags: [node, npm, cache, clean]
danger: true
- id: node.version.use
cmd: nvm use <version>
desc: Switch this shell to the node version a project expects
tags: [node, nvm, version, switch]
params:
version:
desc: Version or alias, such as 20 or lts/iron