From 5de30c53239ac74843725d981afc0bb8c45bdf16 Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Thu, 23 May 2024 12:31:05 -0700 Subject: fix(cli): Support deno.lock with only package.json present + fix DENO_FUTURE install interactions with lockfile (#23918) Fixes #23571. Previously, we required a `deno.json` to be present (or the `--lock` flag) in order for us to resolve a `deno.lock` file. This meant that if you were using deno in an npm-first project deno wouldn't use a lockfile. Additionally, while I was fixing that, I discovered there were a couple bugs keeping the future `install` command from using a lockfile. With this PR, `install` will actually resolve the lockfile (or create one if not present), and update it if it's not up-to-date. This also speeds up `deno install`, as we can use the lockfile to skip work during npm resolution. --- cli/tools/installer.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cli/tools') diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs index b13dea6fd..82a44de16 100644 --- a/cli/tools/installer.rs +++ b/cli/tools/installer.rs @@ -265,6 +265,10 @@ async fn install_local( let factory = CliFactory::from_flags(flags)?; crate::module_loader::load_top_level_deps(&factory).await?; + if let Some(lockfile) = factory.cli_options().maybe_lockfile() { + lockfile.lock().write()?; + } + Ok(()) } -- cgit v1.2.3