mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-11-24 04:03:52 +03:00
fix(cli): add
command version requirement for known plugin npm (#10795)
small regression from #10699 - NPM install is now prompting users to select the version
This commit is contained in:
parent
9718dc9e8c
commit
02b2f964a7
6
.changes/fix-add-plugin-npm-version-req.md
Normal file
6
.changes/fix-add-plugin-npm-version-req.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
'tauri-cli': 'patch:bug'
|
||||
'@tauri-apps/cli': 'patch:bug'
|
||||
---
|
||||
|
||||
Fix the `add` command NPM version specifier for known plugins from `2.0.0-rc` (unknown version requirement) to `^2.0.0-rc`.
|
@ -68,11 +68,14 @@ pub fn run(options: Options) -> Result<()> {
|
||||
.then_some(r#"cfg(any(target_os = "android", target_os = "ios"))"#)
|
||||
});
|
||||
|
||||
let version = version.or(metadata.version_req.as_deref());
|
||||
let cargo_version_req = version.or(metadata.version_req.as_deref());
|
||||
let npm_version_req = version
|
||||
.map(ToString::to_string)
|
||||
.or(metadata.version_req.as_ref().map(|v| format!("^{v}")));
|
||||
|
||||
cargo::install_one(cargo::CargoInstallOptions {
|
||||
name: &crate_name,
|
||||
version,
|
||||
version: cargo_version_req,
|
||||
branch: options.branch.as_deref(),
|
||||
rev: options.rev.as_deref(),
|
||||
tag: options.tag.as_deref(),
|
||||
@ -85,7 +88,7 @@ pub fn run(options: Options) -> Result<()> {
|
||||
.map(PackageManager::from_project)
|
||||
.and_then(|managers| managers.into_iter().next())
|
||||
{
|
||||
let npm_spec = match (version, options.tag, options.rev, options.branch) {
|
||||
let npm_spec = match (npm_version_req, options.tag, options.rev, options.branch) {
|
||||
(Some(version), _, _, _) => {
|
||||
format!("{npm_name}@{version}")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user