1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix(install): update lockfile when using package.json (#26458)

This commit makes sure that `deno add`, `deno install` and `deno remove`
update the lockfile if only `package.json` file is present.

Fixes https://github.com/denoland/deno/issues/26270
This commit is contained in:
Bartek Iwańczuk 2024-10-22 00:08:45 +01:00 committed by GitHub
parent 9e25a4ebbf
commit 67280f8b55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 55 additions and 0 deletions

View file

@ -723,6 +723,10 @@ async fn npm_install_after_modification(
// npm install
cache_deps::cache_top_level_deps(&cli_factory, jsr_resolver).await?;
if let Some(lockfile) = cli_factory.cli_options()?.maybe_lockfile() {
lockfile.write_if_changed()?;
}
Ok(())
}

View file

@ -0,0 +1,31 @@
{
"tempDir": true,
"tests": {
"updates_lockfile": {
"steps": [
{
"args": "add npm:@denotest/esm-basic npm:@denotest/say-hello",
"output": "add.out"
},
{
"args": [
"eval",
"console.log(Deno.readTextFileSync('deno.lock'))"
],
"output": "lockfile_add.out"
},
{
"args": "remove @denotest/esm-basic @denotest/say-hello",
"output": "remove.out"
},
{
"args": [
"eval",
"console.log(Deno.readTextFileSync('deno.lock'))"
],
"output": "lockfile_remove.out"
}
]
}
}
}

View file

@ -0,0 +1,5 @@
[UNORDERED_START]
Add npm:@denotest/esm-basic@1.0.0
Add npm:@denotest/say-hello@1.0.0
[UNORDERED_END]
[WILDCARD]

View file

@ -0,0 +1,7 @@
{
"version": "4",
"specifiers": {
"npm:@denotest/esm-basic@1": "1.0.0",
"npm:@denotest/say-hello@1": "1.0.0"
},
[WILDCARD]

View file

@ -0,0 +1,4 @@
{
"version": "4"
}

View file

@ -0,0 +1,4 @@
[UNORDERED_START]
Removed @denotest/esm-basic
Removed @denotest/say-hello
[UNORDERED_END]