-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
📌 Check in package-lock.json as well #1198
Conversation
Ah, it looks like copying the |
So we can have the CI use known good versions of the dependencies. Without this change, the underlying libraries can change based on the loosely defined semver in the `package.json`, which can cause unexpected failures. An example of such a failure is: e-mission/e-mission-docs#1113 Copying over the `package-lock.json` overrides `package.json` and forces the build to use the exact versions specified e-mission/e-mission-docs#1113 (comment) Note that `package-lock.json` is apparently designed to checked in to source control. It used to be checked in (thanks to a contribution from the UNSW team) but I removed it because every run of `npm install` would override it, resulting in confusing merge conflicts. However, it looks like `npm` has now changed its behavior so it respects the `package-lock.json` if it exists. e-mission/e-mission-docs#1113 (comment) So we restore it by copying in known good versions - from https://github.com/e-mission/e-mission-phone/actions/runs/12448538357 for the "serve" case and from the last successful internal build of NREL OpenPATH for the `cordovabuild` case. We also change `bin/configure_xml_and_json.js` to copy these files over as well Testing done: - Copying `package-lock.json` into the repo causes `npm install` to work, and the tests to pass - Testing of the setup changes will happen through CI
a278bb0
to
be94357
Compare
So this is a bit weird. In the first round of this, I checked in the
But using the version that was uploaded from https://github.com/e-mission/e-mission-phone/actions/runs/12448538357 |
Although we tried to override the `package-lock.json`, it is overridden, in turn by npm when we run npm install after changing `package.json` And because we have a `package.serve.json` and a `configure_xml_and_js` script, we change the `package.json` every time we clone, so the `package-lock.json` never stick. #1198 (comment) The fix is to re-copy just the lock file after the first `npm install` and then run `npm install` again, essentially duplicating the flow in #1198 (comment)
Ah I think I have more clarity - the So the flow needs to be:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1198 +/- ##
=======================================
Coverage 29.78% 29.78%
=======================================
Files 123 123
Lines 4955 4955
Branches 1142 1095 -47
=======================================
Hits 1476 1476
- Misses 3477 3479 +2
+ Partials 2 0 -2
Flags with carried forward coverage won't be shown. Click here to find out more. |
So we can have the CI use known good versions of the dependencies. Without this change, the underlying libraries can change based on the loosely defined semver in the
package.json
, which can cause unexpected failures.An example of such a failure is:
e-mission/e-mission-docs#1113
Copying over the
package-lock.json
overridespackage.json
and forces the build to use the exact versions specified e-mission/e-mission-docs#1113 (comment)Note that
package-lock.json
is apparently designed to checked in to source control. It used to be checked in (thanks to a contribution from the UNSW team) but I removed it because every run ofnpm install
would override it, resulting in confusing merge conflicts.However, it looks like
npm
has now changed its behavior so it respects thepackage-lock.json
if it exists.e-mission/e-mission-docs#1113 (comment)
So we restore it by copying in known good versions - from https://github.com/e-mission/e-mission-phone/actions/runs/12448538357 for the "serve" case and from the last successful internal build of NREL OpenPATH for the
cordovabuild
case.We also change
bin/configure_xml_and_json.js
to copy these files over as wellTesting done:
package-lock.json
into the repo causesnpm install
to work, and the tests to pass