repo/lockfile-committed/node
Dependency lockfile is committed
Implements repo/lockfile-committed for node.
| Severity | error |
| Tiers | 1, 2 |
| Stacks | node |
| Scope | each |
| Kind | expr |
| Source | library v0.3.1 |
| Selected by | fleetlint-recommended@v0.3.1 |
Requirement
package-lock.json, npm-shrinkwrap.json, pnpm-lock.yaml, yarn.lock or bun.lock is tracked when package.json declares dependencies or workspaces; a workspace member uses the lockfile at the workspace root (a parent directory with workspaces in package.json or pnpm-workspace.yaml).
Why
Builds are reproducible only when dependency versions are pinned in git.
Check
tracked().exists(f, f in ["package-lock.json", "npm-shrinkwrap.json", "pnpm-lock.yaml", "yarn.lock", "bun.lock", "bun.lockb"]) || ["../", "../../", "../../../"].exists(d, (file(d + "pnpm-workspace.yaml") || (file(d + "package.json") && text(d + "package.json").matches(r'"workspaces"\s*:')))
&& ["package-lock.json", "npm-shrinkwrap.json", "pnpm-lock.yaml", "yarn.lock", "bun.lock", "bun.lockb"].exists(n, file(d + n)))
|| !(text("package.json").matches(r'"(dev|optional)?[dD]ependencies"\s*:\s*\{\s*"|"workspaces"\s*:') || file("pnpm-workspace.yaml"))Fix
Run the package manager’s install and commit its lockfile.
Agent instruction: Run the package manager to produce the lockfile, remove any .gitignore entry for it, and commit it.
See: https://fleetlint.org/baseline/#dependencies, https://fleetlint.org/stacks/#nodejs--typescript
Generated by fleetlint docs from catalog v0.3.1.