Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('The package is installed successfully');
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "global-local-no-version",
"bin": {
"global-local-no-version": "./bin.js"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[[case]]
name = "command_env_install_global_local_no_version"
vp = "global"
steps = [
{ argv = ["vp", "install", "-g", "."], continue-on-failure = true },
{ argv = ["vp", "list", "-g", "global-local-no-version"], continue-on-failure = true },
]
after = [
{ argv = ["vp", "remove", "-g", "global-local-no-version"], continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# command_env_install_global_local_no_version

## `vp install -g .`

```
VITE+ - The Unified Toolchain for the Web

info: Installing 1 global package with Node.js <version>
✓ Installed global-local-no-version (no version)
Bins: global-local-no-version
```

## `vp list -g global-local-no-version`

```
Package Node version Binaries
--- --- ---
global-local-no-version@unknown 24.18.0 global-local-no-version
```
11 changes: 6 additions & 5 deletions crates/vite_global_cli/src/commands/global/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct Package<'a> {
}

struct InstalledPackage {
installed_version: String,
installed_version: Option<String>,
bin_names: Vec<String>,
js_bins: HashSet<String>,
install_id: String,
Expand Down Expand Up @@ -393,10 +393,11 @@ pub async fn install(
continue;
}
};
let metadata_version = installed_version.as_deref().unwrap_or("unknown");

let mut metadata = PackageMetadata::new(
package_name.clone(),
installed_version.clone(),
metadata_version.to_string(),
node_version.clone(),
None,
bin_names.clone(),
Expand Down Expand Up @@ -461,7 +462,7 @@ pub async fn install(
BinConfig::new(
bin_name.clone(),
package_name.clone(),
installed_version.clone(),
metadata_version.to_string(),
node_version.clone(),
)
.save()
Expand Down Expand Up @@ -504,7 +505,7 @@ pub async fn install(
operation_past,
package_name.bold(),
if update { "to " } else { "" },
installed_version.bold()
installed_version.as_deref().unwrap_or("(no version)").bold()
));
if !bin_names.is_empty() {
let bins = bin_names
Expand Down Expand Up @@ -589,7 +590,7 @@ async fn install_one(
}
};

let installed_version = package_json["version"].as_str().unwrap_or("unknown").to_string();
let installed_version = package_json["version"].as_str().map(ToString::to_string);
let binary_infos = extract_binaries(&package_json);

let mut bin_names = Vec::new();
Expand Down
Loading