diff --git a/Cargo.lock b/Cargo.lock index d0065353c..3b58df783 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -819,21 +819,21 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "miette" -version = "5.10.0" +version = "7.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" +checksum = "1a955165f87b37fd1862df2a59547ac542c77ef6d17c666f619d1ad22dd89484" dependencies = [ + "cfg-if", "miette-derive", - "once_cell", "thiserror 1.0.68", - "unicode-width 0.1.10", + "unicode-width 0.1.14", ] [[package]] name = "miette-derive" -version = "5.10.0" +version = "7.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" +checksum = "bf45bf44ab49be92fd1227a3be6fc6f617f1a337c06af54981048574d8783147" dependencies = [ "proc-macro2", "quote", @@ -893,9 +893,9 @@ dependencies = [ [[package]] name = "node-semver" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f390c1756333538f2aed01cf280a56bc683e199b9804a504df6e7320d40116" +checksum = "3b1a233ea5dc37d2cfba31cfc87a5a56cc2a9c04e3672c15d179ca118dae40a7" dependencies = [ "bytecount", "miette", @@ -1488,7 +1488,7 @@ checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" dependencies = [ "smawk", "unicode-linebreak", - "unicode-width 0.1.10", + "unicode-width 0.1.14", ] [[package]] @@ -1569,9 +1569,9 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "unicode-width" diff --git a/Cargo.toml b/Cargo.toml index e4965e518..3490c6e8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.135" once_cell = "1.19.0" log = { version = "0.4", features = ["std"] } -node-semver = "2" +node-semver = "2.2" clap = { version = "4.5.24", features = ["color", "derive", "wrap_help"] } clap_complete = "4.5.41" mockito = { version = "0.31.1", optional = true } diff --git a/crates/volta-core/src/run/npx.rs b/crates/volta-core/src/run/npx.rs index 0f3f9f0ee..5bd3f17d1 100644 --- a/crates/volta-core/src/run/npx.rs +++ b/crates/volta-core/src/run/npx.rs @@ -7,15 +7,8 @@ use crate::error::{ErrorKind, Fallible}; use crate::platform::{Platform, System}; use crate::session::{ActivityKind, Session}; use node_semver::Version; -use once_cell::sync::Lazy; -static REQUIRED_NPM_VERSION: Lazy = Lazy::new(|| Version { - major: 5, - minor: 2, - patch: 0, - build: vec![], - pre_release: vec![], -}); +const REQUIRED_NPM_VERSION: Version = Version::new(5, 2, 0); /// Build a `ToolCommand` for npx pub(super) fn command(args: &[OsString], session: &mut Session) -> Fallible { @@ -41,7 +34,7 @@ pub(super) fn execution_context( // If the npm version is lower than the minimum required, we can show a helpful error // message instead of a 'command not found' error. let active_npm = image.resolve_npm()?; - if active_npm.value < *REQUIRED_NPM_VERSION { + if active_npm.value < REQUIRED_NPM_VERSION { return Err(ErrorKind::NpxNotAvailable { version: active_npm.value.to_string(), } diff --git a/src/command/list/human.rs b/src/command/list/human.rs index 4cb76c29a..2384fce49 100644 --- a/src/command/list/human.rs +++ b/src/command/list/human.rs @@ -403,11 +403,11 @@ mod tests { use super::*; - static NODE_12: Lazy = Lazy::new(|| Version::from((12, 2, 0))); - static NODE_11: Lazy = Lazy::new(|| Version::from((11, 9, 0))); - static NODE_10: Lazy = Lazy::new(|| Version::from((10, 15, 3))); - static YARN_VERSION: Lazy = Lazy::new(|| Version::from((1, 16, 0))); - static NPM_VERSION: Lazy = Lazy::new(|| Version::from((6, 13, 1))); + const NODE_12: Version = Version::new(12, 2, 0); + const NODE_11: Version = Version::new(11, 9, 0); + const NODE_10: Version = Version::new(10, 15, 3); + const YARN_VERSION: Version = Version::new(1, 16, 0); + const NPM_VERSION: Version = Version::new(6, 13, 1); static PROJECT_PATH: Lazy = Lazy::new(|| PathBuf::from("~/path/to/project.json")); mod active { diff --git a/src/command/list/plain.rs b/src/command/list/plain.rs index feea9e45c..03d266ddf 100644 --- a/src/command/list/plain.rs +++ b/src/command/list/plain.rs @@ -208,10 +208,10 @@ mod tests { use crate::command::list::PackageDetails; - static NODE_VERSION: Lazy = Lazy::new(|| Version::from((12, 4, 0))); - static TYPESCRIPT_VERSION: Lazy = Lazy::new(|| Version::from((3, 4, 1))); - static NPM_VERSION: Lazy = Lazy::new(|| Version::from((6, 13, 4))); - static YARN_VERSION: Lazy = Lazy::new(|| Version::from((1, 16, 0))); + const NODE_VERSION: Version = Version::new(12, 4, 0); + const TYPESCRIPT_VERSION: Version = Version::new(3, 4, 1); + const NPM_VERSION: Version = Version::new(6, 13, 4); + const YARN_VERSION: Version = Version::new(1, 16, 0); static PROJECT_PATH: Lazy = Lazy::new(|| PathBuf::from("/a/b/c")); mod node {