chore(cli.rs): some plugin template fixes

This commit is contained in:
Lucas Nogueira 2021-10-01 13:17:02 -03:00
parent 3450902862
commit a0bea432b4
No known key found for this signature in database
GPG Key ID: 2714B66BCFB01F7F
8 changed files with 31 additions and 10 deletions

View File

@ -101,8 +101,14 @@ impl Init {
)
} else {
(
format!(r#"{{ version = "{}" }}"#, metadata.tauri),
format!(r#"{{ version = "{}" }}"#, metadata.tauri_build),
format!(
r#"{{ version = "{}", features = [ "api-all" ] }}"#,
metadata.tauri
),
format!(
r#"{{ version = "{}", features = [ "api-all" ] }}"#,
metadata.tauri_build
),
)
};

View File

@ -85,8 +85,14 @@ impl Plugin {
)
} else {
(
format!(r#"{{ version = "{}" }}"#, metadata.tauri),
format!(r#"{{ version = "{}" }}"#, metadata.tauri_build),
format!(
r#"{{ version = "{}", features = [ "api-all" ] }}"#,
metadata.tauri
),
format!(
r#"{{ version = "{}", features = [ "api-all" ] }}"#,
metadata.tauri_build
),
)
};

View File

@ -0,0 +1,5 @@
---
"tauri-plugin-{{ plugin_name }}": "minor"
---
Initial release.

View File

@ -1,9 +1,10 @@
[package]
name = "tauri-plugin-{{ plugin_name }}"
version = "0.1.0"
version = "0.0.0"
authors = [ "You" ]
description = ""
edition = "2018"
exclude = ["/examples"]
[dependencies]
tauri = {{{ tauri_dep }}}

View File

@ -0,0 +1,5 @@
---
"tauri-plugin-{{ plugin_name }}": "minor"
---
Initial release.

View File

@ -3,7 +3,6 @@
windows_subsystem = "windows"
)]
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_{{ plugin_name_snake_case }}::YourPlugin::default())

View File

@ -4,7 +4,7 @@
let response = ''
function updateResponse(returnValue) {
response += (typeof returnValue === 'string' ? returnValue : JSON.stringify(returnValue)) + '<br>'
response += `[${new Date().toLocaleTimeString()}]` + (typeof returnValue === 'string' ? returnValue : JSON.stringify(returnValue)) + '<br>'
}
function _execute() {
@ -14,4 +14,5 @@
<div>
<button on:click="{_execute}">Execute</button>
<div>{@html response}</div>
</div>

View File

@ -17,9 +17,7 @@ impl Serialize for Error {
where
S: Serializer,
{
match self {
Self::Io(error) => serializer.serialize_str(error.to_string().as_ref()),
}
serializer.serialize_str(self.to_string().as_ref())
}
}