Skip to content

Commit cea09e2

Browse files
authored
feat: create-tauri-app@3 (#284)
1 parent 4c32208 commit cea09e2

188 files changed

Lines changed: 1045 additions & 1855 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"create-tauri-app": "major"
3+
"create-tauri-app-js": "major"
4+
---
5+
6+
**Breaking Change** Removed `next`, `next-ts`, `preact`, `preact-ts`, `angular`, `clojurescript`, `svelte-kit`, `svelte-kit-ts` templates.

.changes/leptos.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+
Add `leptos` rust template.
7+

.github/CONTRIBUTING.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,12 @@ cargo run -- <cli arguments>
5858

5959
### Templates
6060

61-
A template is a just combination of two fragments, [`fragment-base`](../packages/cli/fragments/base) (which is shared between all templates) and another fragment that is specific to the template.
61+
A template is a just combination of two fragments, [`_base_`](../packages/cli/fragments/_base_) (which is shared between all templates) and another fragment that is specific to the template.
6262

6363
#### Adding a new template
6464

65+
> You should open a new issue first to discuss the addition of a certain template.
66+
6567
- Add a directory in `<repo-root>/packages/cli/fragments` and name `fragment-template` where `template` is the name of the template and add all the files you need there as they should appear after the template is created.
6668
- A template also must have a `_cta_manifest_` file which contains info about the template:
6769
```ini
@@ -80,7 +82,7 @@ A template is a just combination of two fragments, [`fragment-base`](../packages
8082
# the second part is the path that the file will be copied to under the final template directory
8183
tauri.svg = public/tauri.svg
8284
```
83-
- In `<repo-root>/packages/cli/src/template.rs`, add an entry in the `Template` enum, modify `post_init_info` if needed and modify `FromStr` and `Display` implementation
85+
- In `<repo-root>/packages/cli/src/template.rs`, add an entry in the `Template` enum, modify `post_init_info`, `flavors` and `from_flavor` if needed and modify `FromStr` and `Display` implementation
8486
- In `<repo-root>/packages/cli/src/package_manager.rs` add your new template to the appropraite package manager in the `templates` method
8587
- Modify `<repo-root>/.scripts/generate-templates-matrix.js` and append the template name inside the template list for the appropriate package manager so the CI would run tests for it.
8688
- If the template requires system dependencies, add a post init note in `<repo-root>/packages/cli/src/template.rs` in `post_init_info` method.

.github/workflows/audit.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
steps:
3434
- uses: actions/checkout@v2
3535
- uses: dtolnay/rust-toolchain@stable
36+
- run: cargo install cargo-audit
3637
- run: cargo audit
3738

3839
audit-js:
@@ -50,4 +51,4 @@ jobs:
5051
cache: 'pnpm'
5152
cache-dependency-path: '**/pnpm-lock.yaml'
5253
- run: pnpm install
53-
- run: pnpm audit
54+
- run: pnpm audit

.github/workflows/cli-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
runs-on: ubuntu-latest
3333
strategy:
3434
matrix:
35-
toolchain: [1.57, stable]
35+
toolchain: [1.58, stable]
3636

3737
steps:
3838
- uses: actions/checkout@v2

.github/workflows/templates-test.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,35 @@ jobs:
4040
path: create-tauri-app.tar
4141
if-no-files-found: error
4242

43+
generate-matrix:
44+
runs-on: ubuntu-latest
45+
outputs:
46+
matrix: ${{ steps.set-matrix.outputs.matrix }}
47+
48+
steps:
49+
- uses: actions/checkout@v2
50+
4351
- name: Get changed files
4452
id: changed-files
45-
uses: tj-actions/changed-files@v29.0.1
53+
uses: tj-actions/changed-files@v35
54+
with:
55+
separator: ","
4656

4757
- name: set matrix
4858
id: set-matrix
4959
shell: bash
5060
run: |
51-
OUT="$(node .scripts/generate-templates-matrix.js ${{ steps.changed-files.outputs.all_changed_files }})"
52-
echo "::set-output name=matrix::$OUT"
61+
OUT="$(node .scripts/generate-templates-matrix.js '${{ steps.changed-files.outputs.all_changed_files }}')"
62+
echo "matrix=$OUT" >> $GITHUB_OUTPUT
5363
5464
test:
55-
needs: build-cli
65+
needs: [build-cli, generate-matrix]
5666
runs-on: ubuntu-latest
57-
if: ${{ needs.build-cli.outputs.matrix != '[]' && needs.build-cli.outputs.matrix != '' }}
67+
if: ${{ needs.generate-matrix.outputs.matrix != '[]' && needs.generate-matrix.outputs.matrix != '' }}
5868
strategy:
5969
fail-fast: false
6070
matrix:
61-
settings: ${{ fromJson(needs.build-cli.outputs.matrix) }}
71+
settings: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
6272

6373
name: ${{ matrix.settings.manager }} - ${{ matrix.settings.template }}
6474
steps:
@@ -81,7 +91,7 @@ jobs:
8191
- run: |
8292
rustup target add wasm32-unknown-unknown
8393
cargo install --locked trunk
84-
if: matrix.settings.template == 'yew'
94+
if: matrix.settings.install_trunk
8595
8696
- name: download cli artifact
8797
uses: actions/download-artifact@v3

.scripts/generate-templates-matrix.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
const changedFiles = process.argv.slice(2);
1+
const changedFilesStr = process.argv[2];
2+
const changedFiles = changedFilesStr.split(",");
23

34
const nodeJsTemplates = [
4-
"angular",
55
"svelte",
66
"svelte-ts",
77
"vue",
@@ -12,13 +12,6 @@ const nodeJsTemplates = [
1212
"react-ts",
1313
"vanilla",
1414
"vanilla-ts",
15-
"next",
16-
"next-ts",
17-
"preact",
18-
"preact-ts",
19-
"clojurescript",
20-
"svelte-kit",
21-
"svelte-kit-ts",
2215
];
2316

2417
const matrixConfig = [
@@ -44,7 +37,7 @@ const matrixConfig = [
4437
manager: "cargo",
4538
install_cmd: "",
4639
run_cmd: "cargo",
47-
templates: ["vanilla", "yew"],
40+
templates: ["vanilla", "yew", "leptos"],
4841
},
4942
];
5043

@@ -66,6 +59,7 @@ matrixConfig
6659
) {
6760
outMatrix.push({
6861
template: t,
62+
install_trunk: ["yew", "leptos"].includes(t),
6963
...managerInfo,
7064
});
7165
}

packages/cli/fragments/_assets_/next.svg

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/cli/fragments/_assets_/preact.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[package]
2+
name = "{{package_name}}"
3+
version = "0.0.0"
4+
description = "A Tauri App"
5+
authors = ["you"]
6+
license = ""
7+
repository = ""
8+
edition = "2021"
9+
10+
[lib]
11+
name = "{{lib_name}}"
12+
crate-type = ["staticlib", "cdylib", "rlib"]
13+
14+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
15+
16+
[build-dependencies]
17+
tauri-build = { version = "2.0.0-alpha.1", features = [] }
18+
19+
[dependencies]
20+
tauri = { version = "2.0.0-alpha.3", features = ["shell-open"] }
21+
serde = { version = "1.0", features = ["derive"] }
22+
serde_json = "1.0"
23+
24+
[features]
25+
# this feature is used for production builds or when `devPath` points to the filesystem
26+
# DO NOT REMOVE!!
27+
custom-protocol = ["tauri/custom-protocol"]

0 commit comments

Comments
 (0)