Skip to content

Commit

Permalink
Merge pull request #1616 from volta-cli/use-node-semver
Browse files Browse the repository at this point in the history
Switch to stable node-semver crate
  • Loading branch information
chriskrycho authored Dec 21, 2023
2 parents bf97e8c + edd3e07 commit f28dd5f
Show file tree
Hide file tree
Showing 41 changed files with 148 additions and 230 deletions.
205 changes: 58 additions & 147 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.96"
lazy_static = "1.3.0"
log = { version = "0.4", features = ["std"] }
semver = { git = "https://github.com/mikrostew/semver", branch = "new-parser" }
node-semver = "2"
structopt = "0.2.14"
cfg-if = "1.0"
mockito = { version = "0.31.1", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/volta-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ serde = { version = "1.0.174", features = ["derive"] }
archive = { path = "../archive" }
lazycell = "1.3.0"
lazy_static = "1.3.0"
semver = { git = "https://github.com/mikrostew/semver", branch = "new-parser" }
node-semver = "2"
cmdline_words_parser = "0.2.1"
fs-utils = { path = "../fs-utils" }
cfg-if = "1.0"
Expand Down
8 changes: 4 additions & 4 deletions crates/volta-core/src/hook/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use cmdline_words_parser::parse_posix;
use dunce::canonicalize;
use lazy_static::lazy_static;
use log::debug;
use semver::Version;
use node_semver::Version;

const ARCH_TEMPLATE: &str = "{{arch}}";
const OS_TEMPLATE: &str = "{{os}}";
Expand Down Expand Up @@ -182,14 +182,14 @@ fn execute_binary(bin: &str, base_path: &Path, extra_arg: Option<String>) -> Fal
pub mod tests {
use super::{calculate_extension, DistroHook, MetadataHook};
use crate::tool::{NODE_DISTRO_ARCH, NODE_DISTRO_OS};
use semver::Version;
use node_semver::Version;

#[test]
fn test_distro_prefix_resolve() {
let prefix = "http://localhost/node/distro/";
let filename = "node.tar.gz";
let hook = DistroHook::Prefix(prefix.to_string());
let version = Version::new(1, 0, 0);
let version = Version::parse("1.0.0").unwrap();

assert_eq!(
hook.resolve(&version, filename)
Expand All @@ -203,7 +203,7 @@ pub mod tests {
let hook = DistroHook::Template(
"http://localhost/node/{{os}}/{{arch}}/{{version}}/{{ext}}/{{filename}}".to_string(),
);
let version = Version::new(1, 0, 0);
let version = Version::parse("1.0.0").unwrap();

// tar.gz format has extra handling, to support a multi-part extension
let expected = format!(
Expand Down
2 changes: 1 addition & 1 deletion crates/volta-core/src/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::layout::volta_home;
use crate::tool::PackageConfig;
use crate::version::parse_version;
use log::debug;
use semver::Version;
use node_semver::Version;
use walkdir::WalkDir;

/// Checks if a given Node version image is available on the local machine
Expand Down
Loading

0 comments on commit f28dd5f

Please sign in to comment.