Skip to content

Commit

Permalink
chore(dpes): update templates for tauri alpha.9 (#424)
Browse files Browse the repository at this point in the history
* chore(dpes): update templates for tauri alpha.9

* fix vanilla templates

* fix npm versions

* fix vanilla templates button type
  • Loading branch information
amrbashir authored May 25, 2023
1 parent 88944c8 commit 9aeaca7
Show file tree
Hide file tree
Showing 54 changed files with 264 additions and 152 deletions.
7 changes: 7 additions & 0 deletions .changes/tauri-alpha.09.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"create-tauri-app": "minor"
"create-tauri-app-js": "minor"
---

Update `--alpha` templates for `[email protected]`

7 changes: 7 additions & 0 deletions .changes/templates-form.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"create-tauri-app": "patch"
"create-tauri-app-js": "patch"
---

Update `vue`, `vue-ts`, `vanilla`, `vanilla-ts`, `solid`, `solid-ts`, `svelte`, and `svelte-ts` to use `<form>`

3 changes: 3 additions & 0 deletions .github/workflows/publish-napi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ jobs:
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish
jq '.name = "create-tauri" | .bin = { "create-tauri": .bin["create-tauri-app"] } | del(.scripts.prepublishOnly)' package.json > package.tmp
mv -f package.tmp package.json
npm publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.ORG_NPM_TOKEN }}
Expand Down
4 changes: 3 additions & 1 deletion packages/cli/fragments/_base_/src-tauri/%(alpha)%Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ edition = "2021"
tauri-build = { version = "2.0.0-alpha", features = [] }

[dependencies]
tauri = { version = "2.0.0-alpha", features = ["shell-open"] }
tauri = { version = "2.0.0-alpha", features = [] }
tauri-plugin-window = "2.0.0-alpha"
tauri-plugin-shell = "2.0.0-alpha"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"build": {
"beforeDevCommand": "~fragment_before_dev_command~",
"beforeBuildCommand": "~fragment_before_build_command~",
"devPath": "~fragment_dev_path~",
"distDir": "~fragment_dist_dir~",
"withGlobalTauri": "~fragment_with_global_tauri~"
},
"package": {
"productName": "~package_name~",
"version": "0.0.0"
},
"tauri": {
"bundle": {
"active": true,
"targets": "all",
"identifier": "com.tauri.dev",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/[email protected]",
"icons/icon.icns",
"icons/icon.ico"
]
},
"security": {
"csp": null
},
"windows": [
{
"fullscreen": false,
"resizable": true,
"title": "~package_name~",
"width": 800,
"height": 600
}
]
},
"plugins": {
"shell": {
"open": true
}
}
}
4 changes: 3 additions & 1 deletion packages/cli/fragments/_base_/src-tauri/%(mobile)%Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ crate-type = ["staticlib", "cdylib", "rlib"]
tauri-build = { version = "2.0.0-alpha", features = [] }

[dependencies]
tauri = { version = "2.0.0-alpha", features = ["shell-open"] }
tauri = { version = "2.0.0-alpha", features = [] }
tauri-plugin-window = "2.0.0-alpha"
tauri-plugin-shell = "2.0.0-alpha"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
"security": {
"csp": null
},
"updater": {
"active": false
},
"windows": [
{
"fullscreen": false,
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/fragments/_base_/src-tauri/src/%(alpha)%main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
}

fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_window::init())
.plugin(tauri_plugin_shell::init())
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
2 changes: 2 additions & 0 deletions packages/cli/fragments/_base_/src-tauri/src/%(mobile)%lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ fn greet(name: &str) -> String {
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_window::init())
.plugin(tauri_plugin_shell::init())
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.12.0",
"@tauri-apps/api": "^2.0.0-alpha.3"
"@tauri-apps/api": "^2.0.0-alpha.4",
"@tauri-apps/plugin-window": "^2.0.0-alpha.0",
"@tauri-apps/plugin-shell": "^2.0.0-alpha.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^15.2.0",
Expand All @@ -34,6 +36,6 @@
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"typescript": "^4.9.5",
"@tauri-apps/cli": "^2.0.0-alpha.7"
"@tauri-apps/cli": "^2.0.0-alpha.9"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"typescript": "^4.9.5",
"@tauri-apps/cli": "^1.3.0"
"@tauri-apps/cli": "^1.3.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ <h1>Welcome to Tauri + Angular!</h1>
</a>
</div>
<p>Click on the logos to learn more about the frameworks</p>
<div class="row">
<form (submit)="greet($event, greetInput.value)">
<input #greetInput id="greet-input" placeholder="Enter a name..." />
<button type="submit">Greet</button>
</form>
</div>

<form class="row" (submit)="greet($event, greetInput.value)">
<input #greetInput id="greet-input" placeholder="Enter a name..." />
<button type="submit">Greet</button>
</form>
<p>{{ greetingMessage }}</p>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"@tauri-apps/api": "^2.0.0-alpha.3"
"@tauri-apps/api": "^2.0.0-alpha.4",
"@tauri-apps/plugin-window": "^2.0.0-alpha.0",
"@tauri-apps/plugin-shell": "^2.0.0-alpha.0"
},
"devDependencies": {
"@types/node": "^18.7.10",
Expand All @@ -21,6 +23,6 @@
"@vitejs/plugin-react": "^3.0.0",
"typescript": "^4.9.5",
"vite": "^4.2.1",
"@tauri-apps/cli": "^2.0.0-alpha.7"
"@tauri-apps/cli": "^2.0.0-alpha.9"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"@tauri-apps/api": "^2.0.0-alpha.3"
"@tauri-apps/api": "^2.0.0-alpha.4",
"@tauri-apps/plugin-window": "^2.0.0-alpha.0",
"@tauri-apps/plugin-shell": "^2.0.0-alpha.0"
},
"devDependencies": {
"@types/node": "^18.7.10",
Expand All @@ -21,7 +23,7 @@
"@vitejs/plugin-react": "^3.0.0",
"typescript": "^4.9.5",
"vite": "^4.2.1",
"@tauri-apps/cli": "^2.0.0-alpha.8",
"@tauri-apps/cli": "^2.0.0-alpha.9",
"internal-ip": "^7.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"@vitejs/plugin-react": "^3.0.0",
"typescript": "^4.9.5",
"vite": "^4.2.1",
"@tauri-apps/cli": "^1.3.0"
"@tauri-apps/cli": "^1.3.1"
}
}
30 changes: 15 additions & 15 deletions packages/cli/fragments/fragment-react-ts/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ function App() {

<p>Click on the Tauri, Vite, and React logos to learn more.</p>

<div className="row">
<form
onSubmit={(e) => {
e.preventDefault();
greet();
}}
>
<input
id="greet-input"
onChange={(e) => setName(e.currentTarget.value)}
placeholder="Enter a name..."
/>
<button type="submit">Greet</button>
</form>
</div>
<form
className="row"
onSubmit={(e) => {
e.preventDefault();
greet();
}}
>
<input
id="greet-input"
onChange={(e) => setName(e.currentTarget.value)}
placeholder="Enter a name..."
/>
<button type="submit">Greet</button>
</form>

<p>{greetMsg}</p>
</div>
);
Expand Down
6 changes: 4 additions & 2 deletions packages/cli/fragments/fragment-react/%(alpha)%package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"@tauri-apps/api": "^2.0.0-alpha.3"
"@tauri-apps/api": "^2.0.0-alpha.4",
"@tauri-apps/plugin-window": "^2.0.0-alpha.0",
"@tauri-apps/plugin-shell": "^2.0.0-alpha.0"
},
"devDependencies": {
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"@vitejs/plugin-react": "^3.0.0",
"vite": "^4.2.1",
"@tauri-apps/cli": "^2.0.0-alpha.7"
"@tauri-apps/cli": "^2.0.0-alpha.9"
}
}
6 changes: 4 additions & 2 deletions packages/cli/fragments/fragment-react/%(mobile)%package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"@tauri-apps/api": "^2.0.0-alpha.3"
"@tauri-apps/api": "^2.0.0-alpha.4",
"@tauri-apps/plugin-window": "^2.0.0-alpha.0",
"@tauri-apps/plugin-shell": "^2.0.0-alpha.0"
},
"devDependencies": {
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"@vitejs/plugin-react": "^3.0.0",
"vite": "^4.2.1",
"@tauri-apps/cli": "^2.0.0-alpha.8",
"@tauri-apps/cli": "^2.0.0-alpha.9",
"internal-ip": "^7.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"@types/react-dom": "^18.0.6",
"@vitejs/plugin-react": "^3.0.0",
"vite": "^4.2.1",
"@tauri-apps/cli": "^1.3.0"
"@tauri-apps/cli": "^1.3.1"
}
}
29 changes: 14 additions & 15 deletions packages/cli/fragments/fragment-react/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,20 @@ function App() {

<p>Click on the Tauri, Vite, and React logos to learn more.</p>

<div className="row">
<form
onSubmit={(e) => {
e.preventDefault();
greet();
}}
>
<input
id="greet-input"
onChange={(e) => setName(e.currentTarget.value)}
placeholder="Enter a name..."
/>
<button type="submit">Greet</button>
</form>
</div>
<form
className="row"
onSubmit={(e) => {
e.preventDefault();
greet();
}}
>
<input
id="greet-input"
onChange={(e) => setName(e.currentTarget.value)}
placeholder="Enter a name..."
/>
<button type="submit">Greet</button>
</form>

<p>{greetMsg}</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
"license": "MIT",
"dependencies": {
"solid-js": "^1.7.0",
"@tauri-apps/api": "^2.0.0-alpha.3"
"@tauri-apps/api": "^2.0.0-alpha.4",
"@tauri-apps/plugin-window": "^2.0.0-alpha.0",
"@tauri-apps/plugin-shell": "^2.0.0-alpha.0"
},
"devDependencies": {
"@types/node": "^18.7.10",
"typescript": "^4.9.5",
"vite": "^4.2.1",
"vite-plugin-solid": "^2.5.0",
"@tauri-apps/cli": "^2.0.0-alpha.7"
"@tauri-apps/cli": "^2.0.0-alpha.9"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@
"license": "MIT",
"dependencies": {
"solid-js": "^1.7.0",
"@tauri-apps/api": "^2.0.0-alpha.3"
"@tauri-apps/api": "^2.0.0-alpha.4",
"@tauri-apps/plugin-window": "^2.0.0-alpha.0",
"@tauri-apps/plugin-shell": "^2.0.0-alpha.0"
},
"devDependencies": {
"@types/node": "^18.7.10",
"typescript": "^4.9.5",
"vite": "^4.2.1",
"vite-plugin-solid": "^2.5.0",
"@tauri-apps/cli": "^2.0.0-alpha.8",
"@tauri-apps/cli": "^2.0.0-alpha.9",
"internal-ip": "^7.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"typescript": "^4.9.5",
"vite": "^4.2.1",
"vite-plugin-solid": "^2.5.0",
"@tauri-apps/cli": "^1.3.0"
"@tauri-apps/cli": "^1.3.1"
}
}
Loading

0 comments on commit 9aeaca7

Please sign in to comment.