package.json scripts cheat sheet
- Behaviour
- Manager resolution
- Monorepos
- Never listed
- Scripts vs tasks
Behaviour
| |
|
| Section appears |
when any package.json has a non-empty scripts block |
| Row shows |
script name + its command |
| Click |
opens package.json at that script’s line |
| Inline ▶ |
terminal in that package’s folder, command typed |
| Refresh |
automatic on add / change / delete |
| Icon |
terminal glyph, never changes |
Manager resolution
First match wins:
packageManager: in the manifest — version ignored
- Nearest lockfile, searching the package folder then every folder above
npm
| Lockfile |
Manager |
pnpm-lock.yaml |
pnpm |
bun.lockb, bun.lock |
bun |
yarn.lock |
yarn |
package-lock.json, npm-shrinkwrap.json |
npm |
Checked in that order; the first present wins.
Command form: <manager> run <script>, always spelled out.
Monorepos
| |
|
| One package |
scripts listed directly, no heading |
| More than one |
one heading per package: name: field, folder beside it when they differ |
| Expanded |
the first only |
| Order |
shallowest first, ties broken on path |
| Terminal name |
<package>: <script> |
| Terminal reuse |
one per script |
Never listed
| |
|
node_modules |
excluded by the search |
| Manifests with no scripts |
dropped |
| Invalid JSON |
skipped silently |
| Tool folders |
below |
.yarn .pnpm .pnpm-store .debug .git .next .nuxt
.turbo .output .cache .svelte-kit .vscode-test .wrangler
Matched by exact name, not by leading dot.
Scripts vs tasks
| |
Task |
Script |
| Runs through |
the engine |
a terminal |
| Run record |
yes |
no |
| Status |
yes |
no |
| Gates |
yes |
no |
| Declared in |
tasks.yml, workflows/*.yml |
package.json |