mirror of
https://github.com/denoland/deno.git
synced 2025-01-07 22:58:24 -05:00
fix(install): deno install -f
should overwrite lockfile from previous installation (#16744)
This commit is contained in:
parent
e142899bcd
commit
53e34a3ce1
1 changed files with 13 additions and 7 deletions
|
@ -415,6 +415,10 @@ fn resolve_shim_data(
|
||||||
fs::read_to_string(lock_path)
|
fs::read_to_string(lock_path)
|
||||||
.with_context(|| format!("error reading {}", lock_path.display()))?,
|
.with_context(|| format!("error reading {}", lock_path.display()))?,
|
||||||
));
|
));
|
||||||
|
} else {
|
||||||
|
// Provide an empty lockfile so that this overwrites any existing lockfile
|
||||||
|
// from a previous installation. This will get populated on first run.
|
||||||
|
extra_files.push((copy_path, "{}".to_string()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -758,16 +762,18 @@ mod tests {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let lock_path = temp_dir
|
let lock_path = temp_dir.join("bin").join("cowsay.lock.json");
|
||||||
.join("bin")
|
|
||||||
.join("cowsay.lock.json")
|
|
||||||
.display()
|
|
||||||
.to_string();
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
shim_data.args,
|
shim_data.args,
|
||||||
vec!["run", "--allow-all", "--lock", &lock_path, "npm:cowsay"]
|
vec![
|
||||||
|
"run",
|
||||||
|
"--allow-all",
|
||||||
|
"--lock",
|
||||||
|
&lock_path.to_string_lossy(),
|
||||||
|
"npm:cowsay"
|
||||||
|
]
|
||||||
);
|
);
|
||||||
assert_eq!(shim_data.extra_files, vec![]);
|
assert_eq!(shim_data.extra_files, vec![(lock_path, "{}".to_string())]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in a new issue