fix(cli.rs): do not enable all tauri features on plugin template manifest

This commit is contained in:
Lucas Nogueira
2021-10-18 14:43:25 -03:00
parent 2e1f207165
commit 1325e3ab64
3 changed files with 29 additions and 22 deletions

View File

@@ -86,26 +86,32 @@ impl Plugin {
template_target_path
));
} else {
let (tauri_dep, tauri_build_dep) = if let Some(tauri_path) = self.tauri_path {
(
format!(
r#"{{ path = {:?}, features = [ "api-all" ] }}"#,
resolve_tauri_path(&tauri_path, "core/tauri")
),
format!(
"{{ path = {:?} }}",
resolve_tauri_path(&tauri_path, "core/tauri-build")
),
)
} else {
(
format!(
r#"{{ version = "{}", features = [ "api-all" ] }}"#,
metadata.tauri
),
format!(r#"{{ version = "{}" }}"#, metadata.tauri_build),
)
};
let (tauri_dep, tauri_example_dep, tauri_build_dep) =
if let Some(tauri_path) = self.tauri_path {
(
format!(
r#"{{ path = {:?} }}"#,
resolve_tauri_path(&tauri_path, "core/tauri")
),
format!(
r#"{{ path = {:?}, features = [ "api-all" ] }}"#,
resolve_tauri_path(&tauri_path, "core/tauri")
),
format!(
"{{ path = {:?} }}",
resolve_tauri_path(&tauri_path, "core/tauri-build")
),
)
} else {
(
format!(r#"{{ version = "{}" }}"#, metadata.tauri),
format!(
r#"{{ version = "{}", features = [ "api-all" ] }}"#,
metadata.tauri
),
format!(r#"{{ version = "{}" }}"#, metadata.tauri_build),
)
};
let _ = remove_dir_all(&template_target_path);
let handlebars = Handlebars::new();
@@ -118,6 +124,7 @@ impl Plugin {
to_json(self.plugin_name.to_snake_case()),
);
data.insert("tauri_dep", to_json(tauri_dep));
data.insert("tauri_example_dep", to_json(tauri_example_dep));
data.insert("tauri_build_dep", to_json(tauri_build_dep));
data.insert("author", to_json(self.author));

View File

@@ -9,7 +9,7 @@ edition = "2018"
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = [ "derive" ] }
tauri = {{{ tauri_dep }}}
tauri = {{{ tauri_example_dep }}}
tauri-plugin-{{ plugin_name }} = { path = "../../../" }
[build-dependencies]

View File

@@ -9,7 +9,7 @@ edition = "2018"
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = [ "derive" ] }
tauri = {{{ tauri_dep }}}
tauri = {{{ tauri_example_dep }}}
tauri-plugin-{{ plugin_name }} = { path = "../../../" }
[build-dependencies]