Repository navigation
chore: commit package-lock.json, install with npm ci and run prebuild once per build - #2216
Draft
Douglasymlai wants to merge 1 commit into
Draft
Douglasymlai wants to merge 1 commit into
Douglasymlai wants to merge 1 commit into
Conversation
|
👋 Hey there spelunker. It looks like you've modified some files that we can't accept as contributions. The complete list of files we can't accept are:
You'll need to revert all of the files you changed in that list using GitHub Desktop or More discussion: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Related Issue
N/A — maintainer-directed repair; no linked issue required for this PR.
Description
Problem
Two builds of the same commit can ship different dependency versions.
package-lock.jsonis not committed, so every release job runsnpm installand takes whatever versionspackage.jsonallows that day. This already broke a release once, and it means a build can't be reproduced later. Example from v1.0.8: two installer builds of the same commit, made 85 minutes apart, got differentreact-routerversions (7.18.5 and 7.18.6). Resolving the samepackage.jsonone day later gives 10 different package versions.Separately, the macOS and Windows release jobs compile the app twice per build, which adds about a minute per job.
Cause
.gitignoreexcludespackage-lock.json, and the CI check rejects any pull request that touches it.npm run buildalready runsprebuildautomatically (npm runs thepre<name>script before<name>), and thebuildscript also callednpm run prebuilditself.build:windid the same withprebuild:win. In the v1.0.8 release logs the second pass takes 59 s on macOS arm64 and 51 s on Windows.build:linuxhas no matchingprescript, so Linux compiled once.Fix
package-lock.json. It pins the dependency set the v1.0.8 installers were built with: it was resolved with npm 10.8.2 (the npm version CI runs) as of the time the v1.0.8 installers installed their dependencies. It includes the native packages for macOS (x64 and arm64), Windows x64 and Linux x64.npm ci, which installs exactly what the lockfile says and fails ifpackage.jsonand the lockfile disagree.actions/setup-nodenow caches npm downloads keyed onpackage-lock.json.package-lock.jsonchanges (it still rejectsyarn.lockandpnpm-lock.yaml). CONTRIBUTING now says to commit the updated lockfile with any dependency change.buildandbuild:winno longer call the prebuild step themselves; npm's automaticprebuildhook runs it once.npm run dev,npm run prebuild,build:mac,build:linuxand the other build scripts are unchanged.Note: the "Check Not Allowed File Changes" job runs from
main's copy of the workflow, so it will still flag this PR for addingpackage-lock.json. Pull requests opened after this one merges won't be flagged.Testing Evidence (REQUIRED)
I can't run a real installer build on my machine. The first CI build after this merges is the real check: it should finish with one compile pass per job.
Release build job, before → after (per macOS / Windows job):
npm install(newest versions allowed bypackage.json)npm ci(exact versions frompackage-lock.json)package-lock.jsonnpm run build -- --<arch>npm run build:linuxWhat I checked locally:
npm ci --ignore-scripts(npm 10.8.2) installs 1,607 packages from the committed lockfile and leaves it unchanged.npm ciwith apackage.jsonthat has one extra dependency fails with "package.json and package-lock.json … are in sync", as intended.With every script replaced by an
echostub,npm run build -- --x64andnpm run build:winnow run the prebuild steps once and still pass--x64to electron-builder.build:mac,build:linuxandprebuildrun the same steps as before.The release runners use Node 20 with npm 10.8.2 (both self-hosted macOS runners report it in the v1.0.8 logs), the same npm that generated the lockfile.
npm run type-checkpasses.npm testwith the lockfile installed: 5,857 passed, 49 failed in 14 files. Those same 14 files fail with the same 49 tests on an untouchedmaincheckout installed the old way (npm install), so they are existing failures onmain(chat store integration, installer and environment tests that depend on the local machine), not caused by this change.I have included human-verified testing evidence in this PR. (Not yet: automated checks only; the first CI build is the real check.)
This PR includes frontend/UI changes, and I attached screenshot(s) or screen recording(s).
No frontend/UI changes in this PR.
What is the purpose of this pull request?
Contribution Guidelines Acknowledgement