瀏覽代碼

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

Lucas Nogueira 3 年之前
父節點
當前提交
1325e3ab64

+ 27 - 20
tooling/cli.rs/src/plugin.rs

@@ -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));
 

+ 1 - 1
tooling/cli.rs/templates/plugin/backend/examples/vanilla/src-tauri/Cargo.crate-manifest

@@ -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]

+ 1 - 1
tooling/cli.rs/templates/plugin/with-api/examples/svelte-app/src-tauri/Cargo.crate-manifest

@@ -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]