fix(install): bust packument cache on version not found when loading extra info from lockfile (#29679)
Some checks are pending
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / build wasm32 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions

Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com>
This commit is contained in:
David Sherret 2025-06-09 19:22:12 -04:00 committed by GitHub
parent 64a95cb5fb
commit d5f0dd7ca2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 98 additions and 48 deletions

View file

@ -0,0 +1,15 @@
{
"tempDir": true,
"steps": [{
// this would only occur with a lockfile and a package with "extra info" (bin or script)
"args": "install npm:@denotest/bin",
"output": "[WILDCARD]"
}, {
"args": "run -A update.ts $DENO_DIR",
"output": ""
}, {
// should not error
"args": "install",
"output": "[WILDCARD]"
}]
}

View file

@ -0,0 +1,2 @@
{
}

View file

@ -0,0 +1,16 @@
const path = Deno.args[0] + "/npm/localhost_4260/@denotest/bin/registry.json";
const fileText = Deno.readTextFileSync(path);
const data = JSON.parse(fileText);
if (data.versions["1.0.0"] == null || data["dist-tags"].latest !== "1.0.0") {
throw new Error("Test relies on version 1.0.0 to be the latest version");
}
delete data.versions["1.0.0"];
data["dist-tags"].latest = "0.5.0";
delete data["_deno.etag"];
Deno.writeTextFileSync(path, JSON.stringify(data));
Deno.remove("node_modules", { recursive: true });
// assert this exists
if (!Deno.statSync("deno.lock").isFile) {
throw new Error("Expected a deno.lock file.");
}