-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Add lock file version check to CI #7333
Add lock file version check to CI #7333
Conversation
Check confirmed: fails if package-lock file version is 2, passes if version is 1. |
Codecov Report
@@ Coverage Diff @@
## master #7333 +/- ##
==========================================
+ Coverage 93.88% 93.90% +0.02%
==========================================
Files 181 181
Lines 13194 13194
==========================================
+ Hits 12387 12390 +3
+ Misses 807 804 -3
Continue to review full report at Codecov.
|
We should upload a v2 package-lock file and check for that. If a v1 is uploaded for some reason this check should fail. v2 is backwards compatible with npm 6 no? |
v2 is compatible with npm >=7 I checked uploading a v2 and check fails, as expected.
Don't think so, see #7079 (comment); I think npm 7 can interpret v1 but npm 6 cannot interpret v2. npm 7 is bundled with node 15; as long as we have any test with node <15, we have to stick with v1 I believe. |
https://github.blog/2021-02-02-npm-7-is-now-generally-available/#changes-to-the-lockfile
I think there is a reason why it default to npm >= 7 |
So locally generated v2 lock file with npm 7 should be interpretable by node 6? I think we can only try this out and see if we run into the same issue as #7079 (comment) or that was another hiccup. |
I think @Moumouls was worried about the rewriting not so much as the compatibility
|
Edit: I think I got it now, are you referring to the lock file diffs that mess up the lock file becoming a mix of v1 and v2? If so, I think you are right, we should make v2 the default, but maybe not so soon. Once the majority of contributors run npm 7 and produce v2 files, the default should be v2. Once we do it, every contributor would have to use npm 7 to submit a valid lock file. Until then we have to enforce v1 I believe. I don't know whether a check is necessary or the CI will fail anyway, but a check has the benefits of giving a clear error message at least that the contributor can easily resolve on their own. |
Thats was my conclusion |
@dplewis I edited my comment |
@dplewis @mtrezza the issue came from some change on how npm seems to handle v2, some packages of parse-server seems to not work under lock v2 in CI env, that's the issue i encountered on my Auth PR. Also i see in the CI log that some package raise some support warning during Finally since NPM 7 was published in October 13th, 2020, it's too fresh i think and can break some developers installs. |
@Moumouls Did you delete and recreate the lock file or just merge the diffs? I don't see how the v2 lock would require any dependency compatibility. This should solely concern the host environment. |
yes @mtrezza , full re generate (no merge operation). But on my side it works, here the CI fails because the Node version of the CI is 14, and node 14 is shipped with NPM 6, so the install fail. Also i don't know what really happen if you Also Node 15 is not LTS, but node 14/npm 6 is a LTS |
Shouldn't matter as v2 is supposed to be backwards compatible with npm 6 🤔 Maybe a bug, I will give it a shot with npm 7 and see if I can reproduce this. |
Yes may be a bug, you are right i checked npm docs:
https://docs.npmjs.com/cli/v7/configuring-npm/package-lock-json |
Also @mtrezza these last months we encountered many issue with May be we can create a new tiny repo under parse community ie here the main file example: process.env.MONGOMS_VERSION = "4.4.2";
const http = require("http");
const { MongoMemoryReplSet } = require("mongodb-memory-server");
const hostname = "127.0.0.1";
const port = 27272;
const run = async () => {
const replSet = new MongoMemoryReplSet({
instanceOpts: [
{
port: 27017, // port number for the instance
},
],
replSet: { storageEngine: "wiredTiger", dbName: "parse" },
});
await replSet.waitUntilRunning();
console.info("MongDB Running");
const server = http.createServer(async (req, res) => {
res.statusCode = 200;
res.setHeader("Content-Type", "text/plain");
res.end("ok");
});
server.listen(port, hostname, async () => {
await replSet.waitUntilRunning();
});
};
run(); package.json {
"name": "mongodb-launcher",
"version": "1.0.0",
"main": "index.js",
"author": "Company",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"mongodb-memory-server": "^6.9.3"
}
} Simple 🙂 |
The mongodb-memory-server seems to be well maintained. I guess we'd have to look at compatibility, especially with Docker (alpine), and what the resource / performance differences are. I suggest we can explore that in a separate issue if you want to pursue this. |
@Moumouls I'm all down for using |
yeah, @dplewis if you are ok, i do not have rights to create a new repo under parse community. Then i can push the beginning of this tiny package or open an issue on it to draft main objectives. |
How about we add this as a PR to Parse Server first before creating a separate repo? This will likely take some refinement to work in the CI, may be easier in a PR. And if we face an obstacle that prevents us from using it, we don't end up with an unused draft repo. You can add it as a sub-package dev-dependency in |
No problem @mtrezza the 2 options seems good to me 👍 |
I cannot even build with npm 7 locally, after deleting package-lock and node_modules:
Updated all to latest version and still have this issue. Install only works with @dplewis I think until we (or graphql) resolve this, we can set the required package-lock to v1? |
You will still get errors if somebody deletes the package-lock file. |
You mean someone deletes the lock file without rebuilding it? |
I think we should stick to v1. I personally delete and regenerate the package-lock files when I close the Snyx PRs sometimes. |
Uhm, that's what it currently does, it passes only for v1 (npm 6). So we can merge this? |
* Add lock file version check to CI * Update CHANGELOG.md * Update ci.yml * test failing check with lock file version 2 * Revert "test failing check with lock file version 2" This reverts commit a5b4293.
🎉 This change has been released in version 5.0.0-beta.1 |
🎉 This change has been released in version 5.0.0 |
New Pull Request Checklist
Issue Description
Ci does not check NPM lock file version; from NPM 7 onwards the version changed.
Related issue: closes #7326
Approach
Adds lock file version check to CI.
TODOs before merging
none