Skip to content

Commit

Permalink
new: Create multiple shims on Windows. (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj authored Nov 15, 2023
1 parent 3f17dec commit 65c7fcf
Show file tree
Hide file tree
Showing 22 changed files with 158 additions and 157 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- `first-available` (default) - Will use the first available version that is found. Either from `.prototools` or a tool specific file (`.nvmrc`, etc).
- `prefer-prototools` - Prefer a `.prototools` version, even if found in a parent directory. If none found, falls back to tool specific file.
- Added support to plugins to ignore certain paths when detecting a version.
- Updated Windows to create 3 shim files for each tool: `.cmd` (cmd.exe), `.ps1` (powershell), and no extension (bash).
- WASM API
- Added `DetectVersionOutput.ignore` field.

Expand Down
90 changes: 60 additions & 30 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ thiserror = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }

# Force latest rustls
rustls = "0.21.8"
rustls-pemfile = "1.0.4"
rustls-webpki = "0.101.7"

[target.'cfg(windows)'.dependencies]
winreg = "0.51.0"

Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/bin_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ mod bin {
.assert();

if cfg!(windows) {
assert.stdout(predicate::str::contains("shims\\npm.cmd"));
assert.stdout(predicate::str::contains("shims\\npm.ps1"));
} else {
assert.stdout(predicate::str::contains("shims/npm"));
}
Expand Down
21 changes: 21 additions & 0 deletions crates/cli/tests/install_uninstall_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,27 @@ mod install_uninstall {
));
}

#[test]
fn creates_all_shims() {
let temp = create_empty_sandbox();

let mut cmd = create_proto_command(temp.path());
cmd.arg("install")
.arg("node")
.arg("19.0.0")
.arg("--")
.arg("--no-bundled-npm")
.assert();

if cfg!(windows) {
assert!(temp.path().join("shims/node").exists());
assert!(temp.path().join("shims/node.cmd").exists());
assert!(temp.path().join("shims/node.ps1").exists());
} else {
assert!(temp.path().join("shims/node").exists());
}
}

#[test]
fn updates_the_manifest_when_installing() {
let temp = create_empty_sandbox();
Expand Down
Loading

0 comments on commit 65c7fcf

Please sign in to comment.