Commit package-lock.json files for reproducible builds #19
Labels
No labels
bug
decision
docs
enhancement
integration
ops
security
tech-debt
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/BatteryStorageCalculator#19
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The repo has no lockfiles - no
package-lock.jsonat the root, none inbackend/, and no yarn/pnpm equivalent. Verified 2026-07-16.This has three consequences that surfaced while configuring Renovate and CI:
1. Builds are not reproducible. Every dependency uses a caret range (
^18.3.1,^6.0.5, ...).npm installresolves the newest matching version at install time, so CI, your dev server, and the Docker image can each resolve different dependency trees from identical source. A transitive dependency breaking upstream reaches production without any commit here.2. CI cannot use
npm ci..forgejo/workflows/ci.ymlusesnpm installbecausenpm cirequires a committed lockfile and fails without one.npm ciis both faster and deterministic.3. Renovate is substantially weakened. Two specific effects:
lockFileMaintenanceinrenovate.jsonis currently a no-op with nothing to maintain.npm installalready pulls the latest in-range version, so a PR bumping^18.3.1to^18.3.2changes almost nothing real. Renovate's value here is mostly limited to majors until lockfiles exist.Fix: run
npm installin both the root andbackend/, commit bothpackage-lock.jsonfiles, then switch the CI workflow tonpm ci. Renovate will pick up lockfile maintenance automatically.Worth doing before enabling any auto-merge - auto-merging dependency updates that CI cannot deterministically verify is the risky combination.
Fixed in PR #20.
Both lockfiles generated with
npm install --package-lock-onlyinnode:20-alpine(matching the version both Dockerfiles pin):package-lock.json- lockfileVersion 3, 224 packagesbackend/package-lock.json- lockfileVersion 3, 91 packagesPlatform portability checked, since generating on Alpine/musl could in principle miss glibc binaries. It doesn't: rollup declares every platform binary as an
optionalDependency, so the lockfile records all variants (rollup-linux-x64-musl,rollup-linux-x64-gnu,rollup-win32-x64-msvc,rollup-darwin-arm64, and the rest) with theiros/cpu/libcconstraints.npm ciselects the matching one per platform.Verified end-to-end by running the full CI pipeline in
node:20-alpine:npm cisucceeded for both packages, 46 frontend tests passed, 22 backend tests passed, production build succeeded..forgejo/workflows/ci.ymlnow usesnpm cirather thannpm install.Also added a
.gitignore- the repo had none, which was a live hazard oncenpm cistarts creatingnode_modules/. Confirmed it ignores.envwhile keeping.env.exampletracked.With lockfiles in place,
lockFileMaintenanceinrenovate.jsonbecomes active and in-range minor/patch PRs now represent real changes.Done in #20, merged as
a0d604b. Both lockfiles committed (lockfileVersion 3; 224 and 91 packages), generated innode:20-alpineto match both Dockerfiles. All@rollup/rollup-*platform variants recorded, sonpm ciresolves on any host. Added a.gitignoretoo — the repo had none.CI uses
npm ciwithsetup-nodecaching keyed on both lockfiles, and has since gone green on two real runs.