Skip to content

Commit 28b301d

Browse files
authored
chore(deps): use major version for tauri crates and packages (#614)
* chore(deps): use major version for tauri crates and packages * test templates on schedule * fmt * since_last_remote_commit * sha ? * base sha * base_sha
1 parent 766eb7e commit 28b301d

21 files changed

Lines changed: 93 additions & 81 deletions

File tree

.changes/tauri-major-versions.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"create-tauri-app": "patch"
3+
"create-tauri-app-js": "patch"
4+
---
5+
6+
Change all templates to specify tauri crates and packages version as `^1` so it will always pull latest versions.
7+

.github/workflows/templates-test.yml

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
name: test create-tauri-app templates
66

77
on:
8+
workflow_dispatch:
9+
schedule:
10+
- cron: '0 0 * * *'
811
pull_request:
912
branches:
1013
- 'dev'
@@ -21,23 +24,6 @@ concurrency:
2124
cancel-in-progress: true
2225

2326
jobs:
24-
build-cli:
25-
runs-on: ubuntu-latest
26-
steps:
27-
- uses: actions/checkout@v3
28-
- uses: dtolnay/rust-toolchain@stable
29-
- run: cargo build --release --package create-tauri-app
30-
31-
- name: add cli to .tar archive
32-
run: tar -rf create-tauri-app.tar target/release/cargo-create-tauri-app
33-
34-
- name: upload cli artifact
35-
uses: actions/upload-artifact@v3
36-
with:
37-
name: create-tauri-app
38-
path: create-tauri-app.tar
39-
if-no-files-found: error
40-
4127
generate-matrix:
4228
runs-on: ubuntu-latest
4329
outputs:
@@ -47,17 +33,36 @@ jobs:
4733

4834
- name: Get changed files
4935
id: changed-files
50-
uses: tj-actions/changed-files@v35
36+
uses: tj-actions/changed-files@v42
5137
with:
38+
base_sha: ${{ github.event.pull_request.base.sha }}
5239
separator: ","
5340

5441
- name: set matrix
5542
id: set-matrix
5643
shell: bash
5744
run: |
58-
OUT="$(node .scripts/generate-templates-matrix.js '${{ steps.changed-files.outputs.all_changed_files }}')"
45+
OUT="$(node .scripts/generate-templates-matrix.js '${{ github.event_name }}' '${{ steps.changed-files.outputs.all_changed_files }}')"
5946
echo "matrix=$OUT" >> $GITHUB_OUTPUT
6047
48+
build-cli:
49+
needs: [generate-matrix]
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v3
53+
- uses: dtolnay/rust-toolchain@stable
54+
- run: cargo build --release --package create-tauri-app
55+
56+
- name: add cli to .tar archive
57+
run: tar -rf create-tauri-app.tar target/release/cargo-create-tauri-app
58+
59+
- name: upload cli artifact
60+
uses: actions/upload-artifact@v3
61+
with:
62+
name: create-tauri-app
63+
path: create-tauri-app.tar
64+
if-no-files-found: error
65+
6166
test:
6267
needs: [build-cli, generate-matrix]
6368
runs-on: ubuntu-latest

.scripts/generate-templates-matrix.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
const changedFilesStr = process.argv[2];
1+
const isCron = process.argv[2] === "schedule";
2+
3+
const changedFilesStr = process.argv[3];
24
const changedFiles = changedFilesStr.split(",");
35

46
const nodeJsTemplates = [
@@ -18,6 +20,12 @@ const nodeJsTemplates = [
1820
];
1921

2022
const matrixConfig = [
23+
{
24+
manager: "cargo",
25+
install_cmd: "",
26+
run_cmd: "cargo",
27+
templates: ["vanilla", "yew", "sycamore", "leptos"],
28+
},
2129
{
2230
manager: "pnpm",
2331
install_cmd: "pnpm install",
@@ -36,12 +44,6 @@ const matrixConfig = [
3644
run_cmd: "npm run",
3745
templates: nodeJsTemplates,
3846
},
39-
{
40-
manager: "cargo",
41-
install_cmd: "",
42-
run_cmd: "cargo",
43-
templates: ["vanilla", "yew", "leptos"],
44-
},
4547
{
4648
manager: "bun",
4749
install_cmd: "bun install",
@@ -57,6 +59,7 @@ matrixConfig
5759
let { templates, ...managerInfo } = matrixConfig[i];
5860
for (const t of ts) {
5961
if (
62+
isCron ||
6063
changedFiles.some(
6164
(e) =>
6265
e.startsWith(`templates/base`) ||
@@ -68,7 +71,7 @@ matrixConfig
6871
) {
6972
outMatrix.push({
7073
template: t,
71-
install_trunk: ["yew", "leptos"].includes(t),
74+
install_trunk: ["yew", "sycamore", "leptos"].includes(t),
7275
...managerInfo,
7376
});
7477
}

templates/_base_/src-tauri/Cargo.toml.lte

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,18 @@ name = "{% lib_name %}"
1212
crate-type = ["lib", "cdylib", "staticlib"]
1313

1414
{% endif %}{% if stable %}[build-dependencies]
15-
tauri-build = { version = "1.5", features = [] }
15+
tauri-build = { version = "1", features = [] }
1616

1717
[dependencies]
18-
tauri = { version = "1.5", features = ["shell-open"] }
19-
serde = { version = "1.0", features = ["derive"] }{% else %}[build-dependencies]
18+
tauri = { version = "1", features = ["shell-open"] }{% else %}[build-dependencies]
2019
tauri-build = { version = "2.0.0-beta", features = [] }
2120

2221
[dependencies]
2322
tauri = { version = "2.0.0-beta", features = [] }
2423
tauri-plugin-shell = "2.0.0-beta"{% endif %}
25-
serde_json = "1.0"
24+
serde = { version = "1", features = ["derive"] }
25+
serde_json = "1"
2626

2727
[features]
28-
# this feature is used for production builds or when `devPath` points to the filesystem
29-
# DO NOT REMOVE!!
28+
# This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!!
3029
custom-protocol = ["tauri/custom-protocol"]

templates/_base_/src-tauri/capabilities/%(alpha)%main.json.lte

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
"$schema": "./schemas/desktop-schema.json",
33
"identifier": "default",
44
"description": "Capability for the main window",
5-
"windows": [
6-
"main"
7-
],
5+
"windows": ["main"],
86
"permissions": [
97
"path:default",
108
"event:default",

templates/template-angular/package.json.lte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"rxjs": "~7.8.0",
2222
"tslib": "^2.3.0",
2323
"zone.js": "~0.14.2",
24-
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
25-
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
24+
"@tauri-apps/api": "{% if alpha %}>=2.0.0-beta.0{% else %}^1{% endif %}"{% if alpha %},
25+
"@tauri-apps/plugin-shell": "^>=2.0.0-beta.0"{% endif %}
2626
},
2727
"devDependencies": {
2828
"@angular-devkit/build-angular": "^17.0.0",
@@ -36,7 +36,7 @@
3636
"karma-jasmine": "~5.1.0",
3737
"karma-jasmine-html-reporter": "~2.1.0",
3838
"typescript": "~5.2.2",
39-
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
39+
"@tauri-apps/cli": "{% if alpha %}>=2.0.0-beta.0{% else %}^1{% endif %}"{% if mobile %},
4040
"internal-ip": "^7.0.0"{% endif %}
4141
}
4242
}

templates/template-leptos/Cargo.toml.lte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77
[dependencies]
88
leptos = { version = "0.5", features = ["csr"] }
9-
serde = { version = "1.0", features = ["derive"] }
10-
serde-wasm-bindgen = "0.6"
119
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
1210
wasm-bindgen-futures = "0.4"
1311
js-sys = "0.3"
12+
serde = { version = "1", features = ["derive"] }
13+
serde-wasm-bindgen = "0.6"
1414

1515
[workspace]
1616
members = ["src-tauri"]

templates/template-preact-ts/package.json.lte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
},
1212
"dependencies": {
1313
"preact": "^10.16.0",
14-
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
15-
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
14+
"@tauri-apps/api": "{% if alpha %}>=2.0.0-beta.0{% else %}^1{% endif %}"{% if alpha %},
15+
"@tauri-apps/plugin-shell": "^>=2.0.0-beta.0"{% endif %}
1616
},
1717
"devDependencies": {
1818
"@preact/preset-vite": "^2.5.0",
1919
"typescript": "^5.0.2",
2020
"vite": "^5.0.0",
21-
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
21+
"@tauri-apps/cli": "{% if alpha %}>=2.0.0-beta.0{% else %}^1{% endif %}"{% if mobile %},
2222
"internal-ip": "^7.0.0"{% endif %}
2323
}
2424
}

templates/template-preact/package.json.lte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
},
1212
"dependencies": {
1313
"preact": "^10.16.0",
14-
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
15-
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
14+
"@tauri-apps/api": "{% if alpha %}>=2.0.0-beta.0{% else %}^1{% endif %}"{% if alpha %},
15+
"@tauri-apps/plugin-shell": "^>=2.0.0-beta.0"{% endif %}
1616
},
1717
"devDependencies": {
1818
"@preact/preset-vite": "^2.5.0",
1919
"vite": "^5.0.0",
20-
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
20+
"@tauri-apps/cli": "{% if alpha %}>=2.0.0-beta.0{% else %}^1{% endif %}"{% if mobile %},
2121
"internal-ip": "^7.0.0"{% endif %}
2222
}
2323
}

templates/template-react-ts/package.json.lte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
"dependencies": {
1313
"react": "^18.2.0",
1414
"react-dom": "^18.2.0",
15-
"@tauri-apps/api": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.2{% endif %}"{% if alpha %},
16-
"@tauri-apps/plugin-shell": "^2.0.0-beta.0"{% endif %}
15+
"@tauri-apps/api": "{% if alpha %}>=2.0.0-beta.0{% else %}^1{% endif %}"{% if alpha %},
16+
"@tauri-apps/plugin-shell": "^>=2.0.0-beta.0"{% endif %}
1717
},
1818
"devDependencies": {
1919
"@types/react": "^18.2.15",
2020
"@types/react-dom": "^18.2.7",
2121
"@vitejs/plugin-react": "^4.2.1",
2222
"typescript": "^5.0.2",
2323
"vite": "^5.0.0",
24-
"@tauri-apps/cli": "^{% if alpha %}2.0.0-beta.0{% else %}1.5.8{% endif %}"{% if mobile %},
24+
"@tauri-apps/cli": "{% if alpha %}>=2.0.0-beta.0{% else %}^1{% endif %}"{% if mobile %},
2525
"internal-ip": "^7.0.0"{% endif %}
2626
}
2727
}

0 commit comments

Comments
 (0)