fleetlint Policy for a fleet of repositories
v0.11 (latest)
Getting started

repo/lockfile-committed/node

Dependency lockfile is committed

Implements repo/lockfile-committed for node.

Severityerror
Tiers1, 2
Stacksnode
Scopeeach
Kindexpr
Sourcelibrary v0.8.0
Selected byfleetlint-recommended@v0.8.0

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 (from repo/lockfile-committed): Run the package manager to produce the lockfile, remove any .gitignore entry for it, and commit it.

A finding that names no file points at package-lock.json.

Sources


Generated by fleetlint docs from catalog v0.8.0.