mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
feat(cli): Add --frozen
flag to error out if lockfile is out of date (#24355)
Closes #18296.
Adds a `--frozen` (alias `--frozen-lockfile`) flag that errors out if
the lockfile is out of date. This is useful for running in CI (where an
out of date lockfile is usually a mistake) or to prevent accidental
changes in dependencies.

This commit is contained in:
parent
d379c0b299
commit
c13b6d1413
29 changed files with 477 additions and 30 deletions
|
@ -72,10 +72,13 @@ use deno_semver::npm::NpmPackageReqReference;
|
|||
pub async fn load_top_level_deps(factory: &CliFactory) -> Result<(), AnyError> {
|
||||
let npm_resolver = factory.npm_resolver().await?;
|
||||
if let Some(npm_resolver) = npm_resolver.as_managed() {
|
||||
npm_resolver.ensure_top_level_package_json_install().await?;
|
||||
// TODO(nathanwhit): we call `cache_packages` if the lockfile is modified,
|
||||
// so by calling it here it's possible we end up calling it twice
|
||||
npm_resolver.cache_packages().await?;
|
||||
if !npm_resolver.ensure_top_level_package_json_install().await? {
|
||||
if let Some(lockfile) = factory.maybe_lockfile() {
|
||||
lockfile.error_if_changed()?;
|
||||
}
|
||||
|
||||
npm_resolver.cache_packages().await?;
|
||||
}
|
||||
}
|
||||
// cache as many entries in the import map as we can
|
||||
if let Some(import_map) = factory.maybe_import_map().await? {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue