Skip to content

Commit 6c50fc3

Browse files
amrbashirlucasfernoglorenzolewisgithub-actions[bot]
authored
refactor: rewrite in rust (#90)
* initial poc * update to vite@3 and add vite browser list, closes #84 * add shell installers * setup covector and ci * update readme * fix publish-binaries workflow * fix path in audit workflow * run on push to rewrite-in-rust branch * fix publish-binaries workflow * again * one more * list files * build instead of test u dumbass * build in release mod * fix uploading artifacts * rename files artifacts after download * fix multi-line command * try with command wrapped in single quote * try with shell: bash * remove a stray single quote * delete empty directories * re-add upload to github release * changefile * add cli args * napi * fix napi job * list files * try defaults * explicitly specify the lock file * lockfile * I hate yaml and github actions * list files * --no-frozen-lockfile * fix deps path * fix upload path * install with frozen-lockfile * cd in docker before build * list dockerfile * fix non-docker builds * update urls * update base fragment * update vanilla template * update vue template * update svelte template * update react template * update solid template * render conditional files * remove .icns file (it is huge) * format fragments and add fmt check * Add yew template * move template logic to `Template::render` * fmt * update tag name version in cta.{sh, ps1} with covector's bump * move scripts to repo root * don't execute regex twice * add usage and contributing instructions * update script url in readme.md * make it a cargo subcommand * fix typ in publish workflow * allow unused for napi function * setup covector for alpha release * fix npm bump * fix changelog * adjust napi publish job * fix publish.yml indentation * revert covector bump for now * update sync-tagname,js regex * use workflow_dispatch and PR changes to rewrite-in-rust * fix sync-tagname.js major to premajor bump * run tests in rewrite-in-rust branch * chore * ignore fragments directory from socket-security bot * Updated splash * update token in covector workflow * setup pnpm in covector workflow * disable running some workflows twice for this PR * covector: don't run audit from root * lockfile * try to update lock file in covector version PR * Revert "try to update lock file in covector version PR" This reverts commit 075af0e. * run `cargo check` postversion * fix sync-tagname.js path * run sync-tagname.js post the rust cli instead * use command array in postversion instead of && * fix include in Cargo.toml * manually bump to 2.0.0-alpha.0 * create draft releaes instead * disable git-checks for pnpm publish for now * set NPM_TOKEN * set registry url * use next tag for npm publish * fix covector workflow * surrond publish logs in <details> * use tag next when checking version * split publish workflow * fix create-tauri-app js in covector config * handle `prerelease` bump in sync-tagname.js script * apply version updates (alpha) (#96) Co-authored-by: amrbashir <amrbashir@users.noreply.github.com> * fix napi publish workflow * alpha.2 * fix publish workflows input typo * apply version updates (alpha) (#97) Co-authored-by: amrbashir <amrbashir@users.noreply.github.com> * run audit workflow using pnpm * wrap in quotes * alpha.3 * apply version updates (alpha) (#98) Co-authored-by: amrbashir <amrbashir@users.noreply.github.com> * fix publish binariews workflow * setup pnpm in publish napi workflow * alpha.4 * apply version updates (alpha) (#99) Co-authored-by: amrbashir <amrbashir@users.noreply.github.com> * list binaries before upload * fix finding binaries * download artifacts to the correct directory * alpha.5 * apply version updates (alpha) (#100) Co-authored-by: amrbashir <amrbashir@users.noreply.github.com> * don't publish js cli using covector, napi will take care of it * use the correct releaseId from covector * alpha.6 * apply version updates (alpha) (#101) Co-authored-by: amrbashir <amrbashir@users.noreply.github.com> * upload packaged crate to the release assets * napi: publish to next tag * alpha.7 * apply version updates (alpha) (#102) Co-authored-by: amrbashir <amrbashir@users.noreply.github.com> * fix download url in scripts * update scripts colors * Use dimmed white instead of black * run fmt check on all repo * deploy scripts to cloudflare worker * add worker lock file * fix worker vunlerable packages * deploy worker on push only * use account id when deploying * add missing changefile * update readme * apply version updates (alpha) (#104) Co-authored-by: amrbashir <amrbashir@users.noreply.github.com> * use `/ps` instead of `/ps1` * add missing shebang * restructure repo * run audit on push on dev only * crgo fmt * fix sync-tagname.js path in covector config * fix scripts import in worker * run audit on PRs that modify lock files * run workflows when necessary files are changed * use clippy-check action * install dependencies in before audting js * don't cache pnpm in covector-version-or-publish workflow * fix cargo fmt workflow * use unix tree to generate files index for worker * fmt * fix readme paths * apply version updates (alpha) (#107) Co-authored-by: amrbashir <amrbashir@users.noreply.github.com> * fix pnpm install in publishing napi * alpha.10 * revert covector to version or publish * apply version updates (alpha) (#108) Co-authored-by: amrbashir <amrbashir@users.noreply.github.com> * fetch binary inside the worker then serve it * fmt * upadate readme * update napi cli and use --gh-release-id * alpha.11 * apply version updates (alpha) (#109) Co-authored-by: amrbashir <amrbashir@users.noreply.github.com> * [worker] hard code the index file * move scripts back to root repo & upload them to github release * [worker] allow to use a specific version of scripts * fix tagname to correct version and fix sync-tagname script * pin worker scripts to latest released version * upadte sh scripts invokation * update templates server port * server port changefile * fmt * update templates port in tauri.conf.json * tauri_cli -> tauri-cli * update css * remove `.`,`\`,`/` when making a valid pkg name * move preqs note to the top * fmt * Update base rust sentence * Extract base style * Update Svelte template * Remove unused class from svelte * Refactor svelte-ts CSS * Move svelte logo * Add svelte logo to svelte-ts * Update logo hover colors * Fix svelte-ts css reference * Add header to svelte, svelte-ts * Add fade transition to logo * Fix input layout * Add container, fix layout color * Use container in svelte * Update react * Solid is now updated * Update vue * Update Vanilla and Yew * Fix Yew to use class instead of id * Add yew hover color * Add closing CSS bracket * fix vanilla template * Add bold to index * Prettier updates * Add bold to yew * Fix button and input style * avoid modifying unnecessary files when rendering template * [css] add margin and fix colors * modify yew template * [templates] move tauri logo to the middle * fmt * Add macOS Icon * Revert "Add macOS Icon" This reverts commit e282b9f. * prepare for beta * fmt * fix covector bump * apply version updates (beta) (#111) Co-authored-by: amrbashir <amrbashir@users.noreply.github.com> * reduce cargo publish noise in github release * fix vue-ts template * apply version updates (beta) (#112) Co-authored-by: amrbashir <amrbashir@users.noreply.github.com> * prepare for stable and merge to dev * fmt * fix js audit * fmt * clippy * change react-ts fragment port to 1420 * add en empty line before starting prompts Co-authored-by: Lucas Nogueira <lucas@tauri.studio> Co-authored-by: Lorenzo Lewis <lorenzo_lewis@icloud.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: amrbashir <amrbashir@users.noreply.github.com>
1 parent c7d94ae commit 6c50fc3

275 files changed

Lines changed: 9626 additions & 5202 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.

.changes/config.json

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,58 +4,30 @@
44
"pkgManagers": {
55
"javascript": {
66
"version": true,
7-
"getPublishedVersion": "npm view ${ pkgFile.pkg.name } version",
8-
"prepublish": [
7+
"getPublishedVersion": "npm view ${ pkgFile.pkg.name } version"
8+
},
9+
"rust": {
10+
"version": true,
11+
"getPublishedVersion": "cargo search ${ pkg.pkg } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p' -",
12+
"publish": [
913
{
10-
"command": "yarn",
14+
"command": "cargo package --no-verify",
1115
"dryRunCommand": true
1216
},
1317
{
14-
"command": "echo \"# Yarn Audit\n\"",
15-
"dryRunCommand": true,
16-
"pipe": true
17-
},
18-
{
19-
"command": "echo '<details>\n<summary>click to view</summary>\n\n```'",
18+
"command": "echo '<details>\n<summary><em><h4>Cargo Publish</h4></em></summary>\n\n```'",
2019
"dryRunCommand": true,
2120
"pipe": true
2221
},
2322
{
24-
"command": "yarn audit --groups dependencies",
25-
"dryRunCommand": true,
26-
"runFromRoot": true,
23+
"command": "cargo publish",
24+
"dryRunCommand": "cargo publish --dry-run",
2725
"pipe": true
2826
},
2927
{
3028
"command": "echo '```\n\n</details>\n'",
3129
"dryRunCommand": true,
3230
"pipe": true
33-
},
34-
{
35-
"command": "npm pack",
36-
"dryRunCommand": true
37-
}
38-
],
39-
"publish": [
40-
{
41-
"command": "echo \"# Yarn Package Publish\"",
42-
"dryRunCommand": true,
43-
"pipe": true
44-
},
45-
{
46-
"command": "echo '```'",
47-
"dryRunCommand": true,
48-
"pipe": true
49-
},
50-
{
51-
"command": "yarn publish --access public",
52-
"dryRunCommand": "npm publish --dry-run --access public",
53-
"pipe": true
54-
},
55-
{
56-
"command": "echo '```'",
57-
"dryRunCommand": true,
58-
"pipe": true
5931
}
6032
],
6133
"postpublish": [
@@ -67,8 +39,28 @@
6739
},
6840
"packages": {
6941
"create-tauri-app": {
70-
"path": ".",
71-
"manager": "javascript"
42+
"path": "./packages/cli",
43+
"manager": "rust",
44+
"postversion": [
45+
"cargo check",
46+
"node ../../.scripts/sync-scripts-tagname.js ${ release.type }",
47+
"cp ../../create-tauri-app.ps1 ../worker/scripts",
48+
"cp ../../create-tauri-app.sh ../worker/scripts"
49+
],
50+
"assets": [
51+
{
52+
"path": "${ pkg.path }/target/package/create-tauri-app-${ pkgFile.version }.crate",
53+
"name": "${ pkg.pkg }-${ pkgFile.version }.crate"
54+
}
55+
]
56+
},
57+
"create-tauri-app-js": {
58+
"path": "./packages/cli/node",
59+
"manager": "javascript",
60+
"dependencies": ["create-tauri-app"],
61+
"prepublish": [],
62+
"publish": [],
63+
"postpublish": []
7264
}
7365
}
7466
}

.changes/new-templates.md

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+
New templates that are customized towards a better experience with Tauri.

.changes/rewrite-in-rust.md

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+
Rewrote `create-tauri-app` in rust to make it accessible to all communities and not only Node.js, and now you can use `create-tauri-app` through `npm`, `yarn`, `pnpm`, `cargo` or directly through your shell using `powershell` or `bash`. Check out the [README.md](https://github.com/tauri-apps/create-tauri-app#create-tauri-app) for different ways to use it.

.eslintrc.js

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

.github/CONTRIBUTING.md

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,48 +42,29 @@ Hi! We, the maintainers, are really excited that you are interested in contribut
4242

4343
## Development Guide
4444

45-
**NOTE: Tauri is undergoing rapid development right now, and the docs match the latest published version of Tauri. They are horribly out of date when compared with the code in the dev branch. This contributor guide is up-to-date, but it doesn't cover all of Tauri's functions in depth. If you have any questions, don't hesitate to ask in our Discord server.**
45+
You need to have [Rust](https://www.rust-lang.org) and [Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html) installed.
4646

47-
### General Setup
47+
### Testing your changes
4848

49-
First, [join our Discord server](https://discord.gg/SpmNs4S) and let us know that you want to contribute. This way we can point you in the right direction and help ensure your contribution will be as helpful as possible.
50-
51-
To set up your machine for development, follow the [Tauri setup guide](https://tauri.studio/v1/guides/getting-started/prerequisites) to get all the tools you need to develop Tauri apps. The only additional tool you may need is [Yarn](https://yarnpkg.com/), it is only required if you are developing the Node CLI or API packages (`tooling/cli/node` and `tooling/api`). Next, fork and clone this repo. It is structured as a monorepo, which means that all the various Tauri packages are under the same repository. The development process varies depending on what part of Tauri you are contributing to, see the guides below for per-package instructions.
52-
53-
Some Tauri packages will be automatically built when running one of the examples. Others, however, will need to be built beforehand. To build these automatically, run the `.scripts/setup.sh` (Linux and macOS) or `.scripts/setup.ps1` (Windows) script. This will install the Rust and Node.js CLI and build the JS API. After that, you should be able to run all the examples. Note that the setup script should be executed from the root folder of the respository in order to run correctly.
54-
55-
### Packages Overview
56-
57-
- The JS API (`/tooling/api`) contains JS bindings to the builtin Rust functions in the Rust API.
58-
- cli.rs (`/tooling/cli`) is the primary CLI for creating and developing Tauri apps.
59-
- cli.js (`/tooling/cli/node`) is a Node.js CLI wrapper for `cli.rs`.
60-
- Tauri Bundler (`/tooling/bundler`) is used by the Rust CLI to package executables into installers.
61-
- Tauri Core (`/core/tauri`) is the heart of Tauri. It contains the code that starts the app, configures communication between Rust and the Webview, and ties all the other packages together.
62-
- The Macros (`/core/tauri-macros`) are used by Tauri Core for various functions.
63-
64-
### Developing The Node.js CLI (cli.js)
65-
66-
`cli.js` is a wrapper to `cli.rs` so most changes should be written on the Rust CLI. The `[Tauri repo root]/tooling/cli/node` folder contains only packaging scripts to properly publish the Rust CLI binaries to NPM.
67-
68-
### Developing Tauri Bundler and Rust CLI
69-
70-
The code for the bundler is located in `[Tauri repo root]/tooling/bundler`, and the code for the Rust CLI is located in `[Tauri repo root]/tooling/cli`. If you are using your local copy of cli.js (see above), any changes you make to the bundler and CLI will be automatically built and applied when running the build or dev command. Otherwise, running `cargo install --path .` in the Rust CLI directory will allow you to run `cargo tauri build` and `cargo tauri dev` anywhere, using the updated copy of the bundler and cli. You will have to run this command each time you make a change in either package.
71-
72-
### Developing Tauri Core and Related Components (Rust API, Macros, Codegen, and Utils)
73-
74-
The code for Tauri Core is located in `[Tauri repo root]/core/tauri`, and the Rust API, Macros, and Utils are in `[Tauri repo root]/core/tauri-(api/macros/utils)`. The easiest way to test your changes is to use the `[Tauri repo root]/examples/helloworld` app. It automatically rebuilds and uses your local copy of the Tauri core packages. Just run `yarn tauri build` or `yarn tauri dev` in the helloworld app directory after making changes to test them out. To use your local changes in another project, edit its `src-tauri/Cargo.toml` file so that the `tauri` key looks like `tauri = { path = "PATH", features = [ "api-all", "cli" ] }`, where `PATH` is the relative path to `[Tauri repo root]/core/tauri`. Then, your local copy of the Tauri core packages will be rebuilt and used whenever you build that project.
75-
76-
#### Building the documentation locally
49+
```bash
50+
cargo run
51+
```
7752

78-
You can build the Rust documentation locally running the following script:
53+
or
7954

8055
```bash
81-
$ RUSTDOCFLAGS="--cfg doc_cfg" cargo +nightly doc --all-features --open
56+
cargo run -- <cli arguments>
8257
```
8358

84-
### Developing the JS API
59+
### Templates
60+
61+
A template is a just combination of two fragments, [`fragment-base`](../packages/cli/fragments/fragment-base) (which is shared between all templates) and another fragment that is specific to the template.
62+
63+
#### Adding a new template
8564

86-
The JS API provides bindings between the developer's JS in the Webview and the builtin Tauri APIs, written in Rust. Its code is located in `[Tauri repo root]/tooling/api`. After making changes to the code, run `yarn build` to build it. To test your changes, we recommend using the API example app, located in `[Tauri repo root]/examples/api`. It will automatically use your local copy of the JS API and provides a helpful UI to test the various commands.
65+
- 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.
66+
- 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
67+
- In `<repo-root>/packages/cli/src/package_manager.rs` add your new template to the appropraite package manager in the `templates` method
8768

8869
## Financial Contribution
8970

.github/ISSUE_TEMPLATE/docs_report.md

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

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Please make sure to read the Pull Request Guidelines: https://github.com/tauri-a
2424

2525
### Checklist
2626
- [ ] When resolving issues, they are referenced in the PR's title (e.g `fix: remove a typo, closes #___, #___`)
27-
- [ ] A change file is added if any packages will require a version bump due to this PR per [the instructions in the readme](https://github.com/tauri-apps/tauri/blob/dev/.changes/readme.md).
27+
- [ ] A change file is added if any packages will require a version bump due to this PR per [the instructions in the readme](https://github.com/tauri-apps/create-tauri-app/blob/dev/.changes/readme.md).
2828
- [ ] I have added a convincing reason for adding this feature, if necessary
2929

3030
### Other information

.github/splash.png

-9 KB
Loading

.github/workflows/audit.yml

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,54 @@
22
# SPDX-License-Identifier: Apache-2.0
33
# SPDX-License-Identifier: MIT
44

5-
name: Audit
5+
name: audit
66

77
on:
88
workflow_dispatch:
9+
schedule:
10+
- cron: '0 0 * * *'
911
push:
12+
branches:
13+
- dev
1014
paths:
15+
- '**/Cargo.lock'
16+
- '**/Cargo.toml'
1117
- '**/package.json'
12-
- '**/yarn.lock'
18+
- '**/pnpm-lock.yaml'
19+
pull_request:
20+
paths:
21+
- '**/Cargo.lock'
22+
- '**/Cargo.toml'
23+
- '**/package.json'
24+
- '**/pnpm-lock.yaml'
25+
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.ref }}
28+
cancel-in-progress: true
1329

1430
jobs:
15-
full-audit:
31+
audit-rust:
1632
runs-on: ubuntu-latest
1733
steps:
1834
- uses: actions/checkout@v2
19-
- run: yarn audit
35+
- name: rust audit
36+
uses: actions-rs/audit-check@v1
37+
with:
38+
token: ${{ secrets.GITHUB_TOKEN }}
2039

21-
prod-audit:
40+
audit-js:
2241
runs-on: ubuntu-latest
2342
steps:
2443
- uses: actions/checkout@v2
25-
- run: yarn audit --groups dependencies
44+
- uses: pnpm/action-setup@v2.2.2
45+
with:
46+
version: 7
47+
- name: Setup node
48+
uses: actions/setup-node@v3
49+
with:
50+
node-version: 16
51+
check-latest: true
52+
cache: 'pnpm'
53+
cache-dependency-path: '**/pnpm-lock.yaml'
54+
- run: pnpm install
55+
- run: pnpm audit

.github/workflows/clippy.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright 2019-2021 Tauri Programme within The Commons Conservancy
2+
# SPDX-License-Identifier: Apache-2.0
3+
# SPDX-License-Identifier: MIT
4+
5+
name: clippy
6+
7+
on:
8+
push:
9+
branches:
10+
- dev
11+
paths:
12+
- '.github/workflows/clippy.yml'
13+
- 'packages/cli/**'
14+
- 'Cargo.lock'
15+
- 'Cargo.toml'
16+
pull_request:
17+
paths:
18+
- .github/workflows/clippy.yml
19+
- packages/cli/**
20+
- Cargo.lock
21+
- Cargo.toml
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.ref }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
clippy:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v3
32+
- name: install stable
33+
uses: actions-rs/toolchain@v1
34+
with:
35+
profile: minimal
36+
toolchain: stable
37+
override: true
38+
components: clippy
39+
40+
- name: clippy
41+
uses: actions-rs/clippy-check@v1
42+
with:
43+
token: ${{ secrets.GITHUB_TOKEN }}
44+
args: --all-targets --all-features -- -D warnings

0 commit comments

Comments
 (0)