diff options
| author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-11-16 19:59:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-16 19:59:26 +0100 |
| commit | bd159b8bad34acefbd6e222781f3d7c6319c9bef (patch) | |
| tree | 98c23a6c23ff57174bfd663b733815c11a4f9f2e /cli/proc_state.rs | |
| parent | 40a72f35550ad2fd995b1d176540cc4fa0858370 (diff) | |
fix(lock): ensure npm dependencies are written with --lock-write (#16668)
If "--lock-write" flag was present we never passed instance of the lockfile to
the npm resolver, which made it skip adding discovered npm packages to
the lockfile. This commit fixes that, by always passing lockfile to the npm
resolver and only regenerating resolver snapshot is "--lock-write" is not
present.
Closes https://github.com/denoland/deno/issues/16666
Diffstat (limited to 'cli/proc_state.rs')
| -rw-r--r-- | cli/proc_state.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cli/proc_state.rs b/cli/proc_state.rs index 1558f5865..9e66bdb66 100644 --- a/cli/proc_state.rs +++ b/cli/proc_state.rs @@ -224,8 +224,7 @@ impl ProcState { cli_options.cache_setting(), progress_bar.clone(), ); - let maybe_lockfile = - lockfile.as_ref().filter(|l| !l.lock().overwrite).cloned(); + let maybe_lockfile = lockfile.as_ref().cloned(); let mut npm_resolver = NpmPackageResolver::new( npm_cache.clone(), api, @@ -235,7 +234,9 @@ impl ProcState { .with_context(|| "Resolving local node_modules folder.")?, ); if let Some(lockfile) = maybe_lockfile.clone() { - npm_resolver.add_lockfile(lockfile).await?; + npm_resolver + .add_lockfile_and_maybe_regenerate_snapshot(lockfile) + .await?; } let node_analysis_cache = NodeAnalysisCache::new(Some(dir.node_analysis_db_file_path())); |
