diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-08-18 23:01:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-19 03:01:39 +0000 |
commit | 526f39fbb9dacce12c69d24a55798d0bde8f2707 (patch) | |
tree | ca4891a8f8ca6e66ce8298e57218f19b05111f8f /cli | |
parent | 28bebce54445f248614eca493cff6b8d3659df40 (diff) |
feat(FUTURE): terse lockfile (v4) (#25059)
Diffstat (limited to 'cli')
-rw-r--r-- | cli/Cargo.toml | 4 | ||||
-rw-r--r-- | cli/args/lockfile.rs | 33 |
2 files changed, 28 insertions, 9 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 0ed418b5b..97f21deb2 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -72,13 +72,13 @@ deno_emit = "=0.44.0" deno_graph = { version = "=0.81.2" } deno_lint = { version = "=0.63.1", features = ["docs"] } deno_lockfile.workspace = true -deno_npm = "=0.21.4" +deno_npm = "=0.22.0" deno_package_json.workspace = true deno_runtime = { workspace = true, features = ["include_js_files_for_snapshotting"] } deno_semver = "=0.5.10" deno_task_shell = "=0.17.0" deno_terminal.workspace = true -eszip = "=0.73.0" +eszip = "=0.74.0" libsui = "0.3.0" napi_sym.workspace = true node_resolver.workspace = true diff --git a/cli/args/lockfile.rs b/cli/args/lockfile.rs index c9afecd98..953278e7d 100644 --- a/cli/args/lockfile.rs +++ b/cli/args/lockfile.rs @@ -210,22 +210,41 @@ impl CliLockfile { Ok(Some(lockfile)) } pub fn read_from_path( - filename: PathBuf, + file_path: PathBuf, frozen: bool, ) -> Result<CliLockfile, AnyError> { - match std::fs::read_to_string(&filename) { + match std::fs::read_to_string(&file_path) { Ok(text) => Ok(CliLockfile::new( - Lockfile::with_lockfile_content(filename, &text, false)?, + Lockfile::new(deno_lockfile::NewLockfileOptions { + file_path, + content: &text, + overwrite: false, + is_deno_future: *super::DENO_FUTURE, + })?, frozen, )), - Err(err) if err.kind() == std::io::ErrorKind::NotFound => Ok( - CliLockfile::new(Lockfile::new_empty(filename, false), frozen), - ), + Err(err) if err.kind() == std::io::ErrorKind::NotFound => { + Ok(CliLockfile::new( + if *super::DENO_FUTURE { + // force version 4 for deno future + Lockfile::new(deno_lockfile::NewLockfileOptions { + file_path, + content: r#"{"version":"4"}"#, + overwrite: false, + is_deno_future: true, + })? + } else { + Lockfile::new_empty(file_path, false) + }, + frozen, + )) + } Err(err) => Err(err).with_context(|| { - format!("Failed reading lockfile '{}'", filename.display()) + format!("Failed reading lockfile '{}'", file_path.display()) }), } } + pub fn error_if_changed(&self) -> Result<(), AnyError> { if !self.frozen { return Ok(()); |