Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create-tauri-app@3 #284

Merged
merged 37 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
92412ad
remove templates
amrbashir Jan 3, 2023
1d30f38
rename `base` to `_base_` and prompt for flavors in separate prompt
amrbashir Jan 3, 2023
eccc80e
fix CI
amrbashir Jan 3, 2023
c11ea72
fix ci againt
amrbashir Jan 3, 2023
9e18fd2
Add `leptos` template
amrbashir Jan 3, 2023
d487314
fix parsing vanilla-ts
amrbashir Jan 3, 2023
78b14c3
Merge branch 'dev' into cta@3
amrbashir Jan 3, 2023
f0db788
add mobile and alpha templates
amrbashir Jan 6, 2023
9d4cfe1
fmt
amrbashir Jan 6, 2023
5377fa0
expose watcher in templates for mobile
amrbashir Jan 6, 2023
d20130a
test leptos in CI
amrbashir Jan 6, 2023
e4b65fb
install trunk for leptos
amrbashir Jan 6, 2023
149f5ef
fix enabling host in mobile for vite config
amrbashir Jan 6, 2023
4fa757d
conditional files for stable/alpha/mobile
amrbashir Jan 7, 2023
cfa49de
clippy
amrbashir Jan 7, 2023
f470d6a
fix generating matrix
amrbashir Jan 7, 2023
19ca0f4
ci
amrbashir Jan 7, 2023
5565495
again
amrbashir Jan 7, 2023
f9fb435
update changed-files action to v35
amrbashir Jan 7, 2023
66aa085
ci: fix output
amrbashir Jan 8, 2023
95fae32
?
amrbashir Jan 8, 2023
4b86569
comon
amrbashir Jan 8, 2023
a8af0d2
T.T
amrbashir Jan 8, 2023
f1d40d1
quotes??
amrbashir Jan 8, 2023
ab3920d
ha?
amrbashir Jan 8, 2023
656d948
please
amrbashir Jan 8, 2023
9bcadd1
update leptos to 0.1.0 stable
amrbashir Jan 12, 2023
a340ab3
chore: reorder deps
amrbashir Jan 15, 2023
e10a183
remove empty default features
amrbashir Jan 16, 2023
9b46913
remove `host: false` from vite config
amrbashir Jan 20, 2023
b997377
fmt
amrbashir Jan 20, 2023
89ae042
Merge branch 'dev' into cta@3
amrbashir Jan 21, 2023
de3ae44
Merge branch 'dev' into cta@3
amrbashir Feb 8, 2023
4771914
remove rust-version from cargo.toml
amrbashir Feb 13, 2023
4d26f58
Merge branch 'dev' into cta@3
amrbashir Feb 14, 2023
c26f771
final touches
amrbashir Feb 15, 2023
a42272d
SCREAM!!
amrbashir Feb 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/cta-3.0-removed-templates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"create-tauri-app": "major"
"create-tauri-app-js": "major"
---

**Breaking Change** Removed `next`, `next-ts`, `preact`, `preact-ts`, `angular`, `clojurescript`, `svelte-kit`, `svelte-kit-ts` templates.
7 changes: 7 additions & 0 deletions .changes/leptos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"create-tauri-app": "patch"
"create-tauri-app-js": "patch"
---

Add `leptos` rust template.

6 changes: 4 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ cargo run -- <cli arguments>

### Templates

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.
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.

#### Adding a new template

> You should open a new issue first to discuss the addition of a certain template.

- 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.
- A template also must have a `_cta_manifest_` file which contains info about the template:
```ini
Expand All @@ -80,7 +82,7 @@ A template is a just combination of two fragments, [`fragment-base`](../packages
# the second part is the path that the file will be copied to under the final template directory
tauri.svg = public/tauri.svg
```
- 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
- 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
- In `<repo-root>/packages/cli/src/package_manager.rs` add your new template to the appropraite package manager in the `templates` method
- 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.
- If the template requires system dependencies, add a post init note in `<repo-root>/packages/cli/src/template.rs` in `post_init_info` method.
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- run: cargo install cargo-audit
- run: cargo audit

audit-js:
Expand All @@ -50,4 +51,4 @@ jobs:
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm install
- run: pnpm audit
- run: pnpm audit
2 changes: 1 addition & 1 deletion .github/workflows/cli-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
toolchain: [1.57, stable]
toolchain: [1.58, stable]

steps:
- uses: actions/checkout@v2
Expand Down
24 changes: 17 additions & 7 deletions .github/workflows/templates-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,35 @@ jobs:
path: create-tauri-app.tar
if-no-files-found: error

generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}

steps:
- uses: actions/checkout@v2

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v29.0.1
uses: tj-actions/changed-files@v35
with:
separator: ","

- name: set matrix
id: set-matrix
shell: bash
run: |
OUT="$(node .scripts/generate-templates-matrix.js ${{ steps.changed-files.outputs.all_changed_files }})"
echo "::set-output name=matrix::$OUT"
OUT="$(node .scripts/generate-templates-matrix.js '${{ steps.changed-files.outputs.all_changed_files }}')"
echo "matrix=$OUT" >> $GITHUB_OUTPUT

test:
needs: build-cli
needs: [build-cli, generate-matrix]
runs-on: ubuntu-latest
if: ${{ needs.build-cli.outputs.matrix != '[]' && needs.build-cli.outputs.matrix != '' }}
if: ${{ needs.generate-matrix.outputs.matrix != '[]' && needs.generate-matrix.outputs.matrix != '' }}
strategy:
fail-fast: false
matrix:
settings: ${{ fromJson(needs.build-cli.outputs.matrix) }}
settings: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}

name: ${{ matrix.settings.manager }} - ${{ matrix.settings.template }}
steps:
Expand All @@ -81,7 +91,7 @@ jobs:
- run: |
rustup target add wasm32-unknown-unknown
cargo install --locked trunk
if: matrix.settings.template == 'yew'
if: matrix.settings.install_trunk

- name: download cli artifact
uses: actions/download-artifact@v3
Expand Down
14 changes: 4 additions & 10 deletions .scripts/generate-templates-matrix.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const changedFiles = process.argv.slice(2);
const changedFilesStr = process.argv[2];
const changedFiles = changedFilesStr.split(",");

const nodeJsTemplates = [
"angular",
"svelte",
"svelte-ts",
"vue",
Expand All @@ -12,13 +12,6 @@ const nodeJsTemplates = [
"react-ts",
"vanilla",
"vanilla-ts",
"next",
"next-ts",
"preact",
"preact-ts",
"clojurescript",
"svelte-kit",
"svelte-kit-ts",
];

const matrixConfig = [
Expand All @@ -44,7 +37,7 @@ const matrixConfig = [
manager: "cargo",
install_cmd: "",
run_cmd: "cargo",
templates: ["vanilla", "yew"],
templates: ["vanilla", "yew", "leptos"],
},
];

Expand All @@ -66,6 +59,7 @@ matrixConfig
) {
outMatrix.push({
template: t,
install_trunk: ["yew", "leptos"].includes(t),
...managerInfo,
});
}
Expand Down
21 changes: 0 additions & 21 deletions packages/cli/fragments/_assets_/next.svg

This file was deleted.

1 change: 0 additions & 1 deletion packages/cli/fragments/_assets_/preact.svg

This file was deleted.

27 changes: 27 additions & 0 deletions packages/cli/fragments/_base_/src-tauri/%(alpha-mobile)%Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[package]
name = "{{package_name}}"
version = "0.0.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
edition = "2021"

[lib]
name = "{{lib_name}}"
crate-type = ["staticlib", "cdylib", "rlib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[build-dependencies]
tauri-build = { version = "2.0.0-alpha.1", features = [] }

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

[features]
# this feature is used for production builds or when `devPath` points to the filesystem
# DO NOT REMOVE!!
custom-protocol = ["tauri/custom-protocol"]
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ edition = "2021"
tauri-build = { version = "1.2", features = [] }

[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.2", features = ["shell-open"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = ["custom-protocol"]
# this feature is used used for production builds where `devPath` points to the filesystem
# DO NOT remove this
# this feature is used for production builds or when `devPath` points to the filesystem
# DO NOT REMOVE!!
custom-protocol = ["tauri/custom-protocol"]
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
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() {
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
Expand Down
7 changes: 7 additions & 0 deletions packages/cli/fragments/_base_/src-tauri/src/%(mobile)%main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

fn main() {
#[cfg(desktop)]
{{lib_name}}::run();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 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()
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
16 changes: 0 additions & 16 deletions packages/cli/fragments/fragment-angular/.browserslistrc

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions packages/cli/fragments/fragment-angular/README.md

This file was deleted.

12 changes: 0 additions & 12 deletions packages/cli/fragments/fragment-angular/_cta_manifest_

This file was deleted.

25 changes: 0 additions & 25 deletions packages/cli/fragments/fragment-angular/_gitignore

This file was deleted.