summaryrefslogtreecommitdiff
path: root/cli/tools/info.rs
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2024-02-19 13:02:40 +0100
committerGitHub <noreply@github.com>2024-02-19 13:02:40 +0100
commit15c64365a258e6498fa04c34c75813e9486397c2 (patch)
treebe6ad528af98720a0b718dae2301c5074118909c /cli/tools/info.rs
parent7531b3500a8f80a0b19cd7f156a43da2ae731028 (diff)
fix: write lockfile in `deno info` (#22272)
Diffstat (limited to 'cli/tools/info.rs')
-rw-r--r--cli/tools/info.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/cli/tools/info.rs b/cli/tools/info.rs
index dd820f24f..0ad7d8920 100644
--- a/cli/tools/info.rs
+++ b/cli/tools/info.rs
@@ -7,6 +7,7 @@ use std::fmt::Write;
use deno_ast::ModuleSpecifier;
use deno_core::anyhow::bail;
+use deno_core::anyhow::Context;
use deno_core::error::AnyError;
use deno_core::resolve_url_or_path;
use deno_core::serde_json;
@@ -66,8 +67,13 @@ pub async fn info(flags: Flags, info_flags: InfoFlags) -> Result<(), AnyError> {
.create_graph_with_loader(GraphKind::All, vec![specifier], &mut loader)
.await?;
- if let Some(lockfile) = maybe_lockfile {
- graph_lock_or_exit(&graph, &mut lockfile.lock());
+ // If there is a lockfile...
+ if let Some(lockfile) = &maybe_lockfile {
+ let mut lockfile = lockfile.lock();
+ // validate the integrity of all the modules
+ graph_lock_or_exit(&graph, &mut lockfile);
+ // update it with anything new
+ lockfile.write().context("Failed writing lockfile.")?;
}
if info_flags.json {