From beeb4c2e1642f7f520f0a8960d24774f10e9b433 Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Sun, 22 Oct 2023 19:34:57 -0700 Subject: [PATCH] new: Support Yarn v4. (#13) --- .github/workflows/ci.yml | 8 ++-- CHANGELOG.md | 10 +++++ Cargo.lock | 48 +++++++++++------------ Cargo.toml | 6 +-- crates/node-depman/Cargo.toml | 2 +- crates/node-depman/src/proto.rs | 25 ++++++------ crates/node-depman/tests/versions_test.rs | 2 +- crates/node/Cargo.toml | 2 +- 8 files changed, 56 insertions(+), 47 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c8cf84..1836a51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: os: [ubuntu-latest, windows-latest] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: moonrepo/setup-rust@v1 with: components: rustfmt @@ -28,7 +28,7 @@ jobs: os: [ubuntu-latest, windows-latest] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: moonrepo/setup-rust@v1 with: components: clippy @@ -41,11 +41,11 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: moonrepo/setup-rust@v1 with: bins: cargo-wasi, cargo-nextest - - uses: moonrepo/setup-proto@v1 + - uses: moonrepo/setup-toolchain@v0 - run: cargo wasi build -p node_plugin - run: cargo wasi build -p node_depman_plugin - run: cargo nextest run --workspace diff --git a/CHANGELOG.md b/CHANGELOG.md index ea75292..85f5e81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 0.4.2 + +#### 🚀 Updates + +- Support Yarn v4. + +#### 🐞 Fixes + +- Temporarily fixed an issue where calling `node` as a child process may fail. + ## 0.4.1 #### 🐞 Fixes diff --git a/Cargo.lock b/Cargo.lock index 7d674a0..68c0f9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -245,7 +245,7 @@ dependencies = [ "ahash", "cached_proc_macro", "cached_proc_macro_types", - "hashbrown 0.14.0", + "hashbrown 0.14.2", "instant", "once_cell", "thiserror", @@ -725,7 +725,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown 0.14.0", + "hashbrown 0.14.2", "lock_api", "once_cell", "parking_lot_core", @@ -1297,9 +1297,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" dependencies = [ "ahash", "allocator-api2", @@ -1490,7 +1490,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.2", ] [[package]] @@ -1850,7 +1850,7 @@ dependencies = [ [[package]] name = "node_depman_plugin" -version = "0.4.1" +version = "0.4.2" dependencies = [ "extism-pdk", "node_common", @@ -1864,7 +1864,7 @@ dependencies = [ [[package]] name = "node_plugin" -version = "0.4.1" +version = "0.4.2" dependencies = [ "extism-pdk", "node_common", @@ -1940,12 +1940,12 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "once_map" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "169e72192bc84493725bfca5d47da4ee2abc8acf155586d8127eb17f022497f4" +checksum = "0dc08fbf8d1bb5119046009c6a3f3153333f1080b68778e0e1be37c747b97cf5" dependencies = [ "ahash", - "hashbrown 0.14.0", + "hashbrown 0.14.2", "parking_lot", "stable_deref_trait", ] @@ -2103,9 +2103,9 @@ dependencies = [ [[package]] name = "proto_core" -version = "0.20.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3ec2a09d2419150c2a05f4a02a0db67daa01bdf7579b9109772d0861327b8b" +checksum = "b019eaa6e4fd13b09f98e6d562841680be19815ebbfdd3707a8e82c7ae9a91a2" dependencies = [ "cached", "extism", @@ -2135,9 +2135,9 @@ dependencies = [ [[package]] name = "proto_pdk" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63fb8a833e33fcb2ea79324ef89b5e631b8aadc3c7c11bdf4bc7ca25ec716858" +checksum = "4dd47a2deb95a886ed08088ae99dae63d1f19052442aeeb073964327c31ba3eb" dependencies = [ "anyhow", "extism-pdk", @@ -2147,9 +2147,9 @@ dependencies = [ [[package]] name = "proto_pdk_api" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c05662171d4984a9fd57e7fc33a071e0822bb2e993b7a1d06ce9dc5847698b6" +checksum = "e72330b212b8499e5ead791296cf9971b807fb6706c11705308b3e2fef012ea4" dependencies = [ "anyhow", "semver", @@ -2162,9 +2162,9 @@ dependencies = [ [[package]] name = "proto_pdk_test_utils" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cc75a9923b630193bef09734147636f45e5857ff33d8511fbb1e3ccffe5e1ad" +checksum = "e9f6b3fddc71247a4d9f4aa6a76653e55d7be4471437b513c31e4f0147ab4621" dependencies = [ "extism", "proto_core", @@ -2175,9 +2175,9 @@ dependencies = [ [[package]] name = "proto_wasm_plugin" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4ff89bb77f5f4ce5dd9536200c73140acaef632d33cacb59e12a2a8c8f3d7d" +checksum = "e52de55d49c055e505771beeaa59e75ac81746ec991e4c326d9387b04d6d353c" dependencies = [ "extism", "proto_pdk_api", @@ -2956,9 +2956,9 @@ dependencies = [ [[package]] name = "system_env" -version = "0.0.3" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1a5b2f67543171658346f56eba6978221227dd79541a6b1fdb2b2f9116ed640" +checksum = "11d80839b892a1c48cd74f975914cd2070df5b0afed5574e2af7e8866290939b" dependencies = [ "serde", "serde_json", @@ -3432,9 +3432,9 @@ dependencies = [ [[package]] name = "warpgate" -version = "0.5.10" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52eeb90e962c1310c0bfe7d066f4a7fe032f01dd94f6ee3d983167c90596a7f7" +checksum = "0cd4bc62c93b7cb92f95e632684e288913cd3575cae308a2b72178d26ba2e060" dependencies = [ "extism", "miette", diff --git a/Cargo.toml b/Cargo.toml index 9fad260..c1d4110 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,9 +4,9 @@ members = ["crates/*"] [workspace.dependencies] extism-pdk = "0.3.4" -proto_pdk = { version = "0.8.0" } # , path = "../../proto/crates/pdk" } -proto_pdk_api = { version = "0.8.0" } # , path = "../../proto/crates/pdk-api" } -proto_pdk_test_utils = { version = "0.8.2" } # , path = "../../proto/crates/pdk-test-utils" } +proto_pdk = { version = "0.8.1" } # , path = "../../proto/crates/pdk" } +proto_pdk_api = { version = "0.8.1" } # , path = "../../proto/crates/pdk-api" } +proto_pdk_test_utils = { version = "0.8.4" } # , path = "../../proto/crates/pdk-test-utils" } serde = "1.0.189" serde_json = "1.0.107" starbase_sandbox = "0.1.11" diff --git a/crates/node-depman/Cargo.toml b/crates/node-depman/Cargo.toml index 2e532f3..bb69ac1 100644 --- a/crates/node-depman/Cargo.toml +++ b/crates/node-depman/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node_depman_plugin" -version = "0.4.1" +version = "0.4.2" edition = "2021" license = "MIT" publish = false diff --git a/crates/node-depman/src/proto.rs b/crates/node-depman/src/proto.rs index 6889412..4ce8f0e 100644 --- a/crates/node-depman/src/proto.rs +++ b/crates/node-depman/src/proto.rs @@ -254,17 +254,17 @@ pub fn resolve_version( // Otherwise call the current `node` binary and infer from that if !found_version { - let result = exec_command!("node", ["--version"]); - - if result.exit_code == 0 { - let node_version = result.stdout.trim(); - - for node_release in &response { - // Both start with v - if node_release.version == node_version { - output.version = node_release.npm.clone(); - found_version = true; - break; + if let Ok(result) = exec_command!(raw, "node", ["--version"]) { + if result.0.exit_code == 0 { + let node_version = result.0.stdout.trim(); + + for node_release in &response { + // Both start with v + if node_release.version == node_version { + output.version = node_release.npm.clone(); + found_version = true; + break; + } } } } @@ -281,9 +281,8 @@ pub fn resolve_version( } PackageManager::Yarn => { - // Latest currently resolves to a v4-rc version... if input.initial == "berry" || input.initial == "latest" { - output.candidate = Some("~3".into()); + output.candidate = Some("~4".into()); } else if input.initial == "legacy" || input.initial == "classic" { output.candidate = Some("~1".into()); } diff --git a/crates/node-depman/tests/versions_test.rs b/crates/node-depman/tests/versions_test.rs index d3bda2f..81d7d76 100644 --- a/crates/node-depman/tests/versions_test.rs +++ b/crates/node-depman/tests/versions_test.rs @@ -168,7 +168,7 @@ mod yarn { "1" => "1.22.19", "2" => "2.4.3", "3" => "3.6.4", - "berry" => "3.6.4", + "berry" => "4.0.0", }); #[test] diff --git a/crates/node/Cargo.toml b/crates/node/Cargo.toml index 0c374b5..95576e4 100644 --- a/crates/node/Cargo.toml +++ b/crates/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node_plugin" -version = "0.4.1" +version = "0.4.2" edition = "2021" license = "MIT" publish = false