refactor(repo): add /tooling folder (#1457)

This commit is contained in:
Lucas Fernandes Nogueira
2021-04-12 01:59:25 -03:00
committed by GitHub
parent a6def7066e
commit aea614587b
242 changed files with 159 additions and 6315 deletions

8
.github/CODEOWNERS vendored
View File

@@ -13,10 +13,12 @@
/examples/ @tauri-apps/testing
/cli/tauri-bundler/ @tauri-apps/bundler
/tooling/api/ @tauri-apps/core
/cli/core/ @tauri-apps/core
/tooling/bundler/ @tauri-apps/bundler
/cli/tauri.js/ @tauri-apps/js-cli
/tooling/cli.rs/ @tauri-apps/core
/tooling/cli.js/ @tauri-apps/js-cli
/core/** @tauri-apps/core

View File

@@ -46,43 +46,43 @@ Hi! We, the maintainers, are really excited that you are interested in contribut
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.
To set up your machine for development, follow the [Tauri setup guide](https://tauri.studio/en/docs/getting-started/intro#setting-up-your-environment) 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/API (`cli/tauri.js` and `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.
To set up your machine for development, follow the [Tauri setup guide](https://tauri.studio/en/docs/getting-started/intro#setting-up-your-environment) 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/API (`tooling/cli.js` and `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.
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.
### Packages Overview
- The JS API (`/api`) contains JS bindings to the builtin Rust functions in the Rust API.
- Tauri.js (`/cli/tauri.js`) is the primary CLI for creating and developing Tauri apps.
- The Rust CLI (`/cli/core`) is a new version of the CLI that will replace Tauri.js, but now it only supports build and dev commands. Tauri.js will automatically use the Rust CLI for these commands.
- Tauri Bundler (`/cli/tauri-bundler`) is used by the Rust CLI to package executables into installers.
- The JS API (`/tooling/api`) contains JS bindings to the builtin Rust functions in the Rust API.
- The Rust CLI (`/tooling/cli.rs`) is the primary CLI for creating and developing Tauri apps.
- cli.js (`/tooling/cli.js`) is a Node.js CLI wrapper for `cli.rs`.
- Tauri Bundler (`/tooling/bundler`) is used by the Rust CLI to package executables into installers.
- 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.
- The Macros (`/core/tauri-macros`) are used by Tauri Core for various functions.
### Developing The Node.js CLI (Tauri.js)
### Developing The Node.js CLI (cli.js)
Tauri.js is a CLI tool that houses the `init`, `info`, `icon`, and `deps` command. It also handles the `build` and `dev` command by forwarding them to the Rust CLI, which will eventually replace this modules completely. The code for Tauri.js is located in `[Tauri repo root]/cli/tauri.js`. There are a few package scripts you should be aware of:
`cli.js` is a CLI tool that houses the `icon`, and `deps` command. The code for cli.js is located in `[Tauri repo root]/tooling/cli.js`. There are a few package scripts you should be aware of:
- `build` builds the CLI
- `test` runs the unit and e2e test suite
- `lint` runs ESLint to catch linting errors
- `format` formats code with Prettier to match the style guide
To test your changes, we recommend using the helloworld example app, located in `[Tauri repo root]/examples/helloworld`. Run `yarn tauri [COMMAND]` to run a command using your local Tauri.js copy. You will need to rebuild Tauri.js after every change by running `yarn build` in the Tauri.js directory.
To test your changes, we recommend using the helloworld example app, located in `[Tauri repo root]/examples/helloworld`. Run `yarn tauri [COMMAND]` to run a command using your local cli.js copy. You will need to rebuild cli.js after every change by running `yarn build` in the cli.js directory.
If you want to use your local copy of Tauri.js in another app, we recommend using [Yarn link](https://classic.yarnpkg.com/en/docs/cli/link/). First, make sure you have don't have Tauri.js installed globally by running `npm uninstall -g tauri && yarn global remove tauri`. Then, run `yarn link` in the Tauri.js directory (note that the setup script will do this for you, so you can skip this step if you ran that). Now, you can just run `tauri [COMMAND]` anywhere, and your local copy will be used.
If you want to use your local copy of cli.js in another app, we recommend using [yarn link](https://classic.yarnpkg.com/en/docs/cli/link/). First, make sure you have don't have cli.js installed globally by running `npm uninstall -g tauri && yarn global remove tauri`. Then, run `yarn link` in the cli.js directory (note that the setup script will do this for you, so you can skip this step if you ran that). Now, you can just run `tauri [COMMAND]` anywhere, and your local copy will be used.
### Developing Tauri Bundler and Rust CLI
The code for the bundler is located in `[Tauri repo root]/cli/tauri-bundler`, and the code for the Rust CLI is located in `[Tauri repo root]/cli/core`. If you are using your local copy of Tauri.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.
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.rs`. 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.
### Developing Tauri Core and Related Components (Rust API, Macros, and Utils)
### Developing Tauri Core and Related Components (Rust API, Macros, Codegen, and Utils)
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.
### Developing the JS API
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]/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.
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.
## Financial Contribution

View File

@@ -8,8 +8,8 @@ on:
paths:
- '.github/workflows/artifacts-updater.yml'
- 'core/tauri/**'
- 'cli/core/**'
- 'cli/tauri-bundler/**'
- 'tooling/cli.rs/**'
- 'tooling/bundler/**'
- 'examples/updater/**'
jobs:
@@ -32,18 +32,18 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
- run: cargo install --path ./cli/core --force
- run: cargo install --path ./tooling/cli.rs --force
- name: install cli deps via yarn
working-directory: ./cli/tauri.js
working-directory: ./tooling/cli.js
run: yarn
- name: build cli
working-directory: ./cli/tauri.js
working-directory: ./tooling/cli.js
run: yarn build
- name: build sample artifacts (updater)
working-directory: ./examples/updater
run: |
yarn install
node ../../cli/tauri.js/bin/tauri build
node ../../tooling/cli.js/bin/tauri build
env:
TAURI_PRIVATE_KEY: dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5YTBGV3JiTy9lRDZVd3NkL0RoQ1htZmExNDd3RmJaNmRMT1ZGVjczWTBKZ0FBQkFBQUFBQUFBQUFBQUlBQUFBQWdMekUzVkE4K0tWQ1hjeGt1Vkx2QnRUR3pzQjVuV0ZpM2czWXNkRm9hVUxrVnB6TUN3K1NheHJMREhQbUVWVFZRK3NIL1VsMDBHNW5ET1EzQno0UStSb21nRW4vZlpTaXIwZFh5ZmRlL1lSN0dKcHdyOUVPclVvdzFhVkxDVnZrbHM2T1o4Tk1NWEU9Cg==
- uses: actions/upload-artifact@v2

View File

@@ -30,5 +30,5 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: yarn audit
working-directory: cli/tauri.js
working-directory: tooling/cli.js
run: yarn audit

View File

@@ -71,10 +71,10 @@ jobs:
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
- name: yarn install for cli
working-directory: tauri/cli/tauri.js
working-directory: tauri/tooling/cli.js
run: yarn
- name: build tauri.js
working-directory: tauri/cli/tauri.js
- name: build cli.js
working-directory: tauri/tooling/cli.js
run: |
yarn build-release
yarn global add $PWD

View File

@@ -10,7 +10,7 @@ on:
- '.github/workflows/core-lint-fmt.yml'
- 'core/**'
- 'examples/**'
- 'cli/core/**'
- 'tooling/cli.rs/**'
jobs:
workspace_clippy_fmt_check:
@@ -48,7 +48,7 @@ jobs:
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./cli/core/Cargo.toml --all-targets --all-features -- -D warnings
args: --manifest-path ./tooling/cli.rs/Cargo.toml --all-targets --all-features -- -D warnings
name: cli
- uses: actions-rs/toolchain@v1
with:
@@ -59,7 +59,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path ./cli/core/Cargo.toml --all -- --check
args: --manifest-path ./tooling/cli.rs/Cargo.toml --all -- --check
core_clippy_check:
runs-on: ubuntu-latest

View File

@@ -106,8 +106,8 @@ jobs:
fail-fast: false
matrix:
package:
- name: tauri.js
registryName: tauri
- name: cli.js
registryName: \@tauri-apps/cli
- name: tauri-bundler
registryName: tauri-bundler
- name: tauri-utils

View File

@@ -8,7 +8,7 @@ on:
pull_request:
paths:
- '.github/workflows/js-lint.yml'
- 'cli/tauri.js/**'
- 'tooling/cli.js/**'
jobs:
eslint-check:
@@ -19,11 +19,11 @@ jobs:
with:
node-version: '12'
- name: install deps via yarn
working-directory: ./cli/tauri.js/
working-directory: ./tooling/cli.js/
run: yarn
- name: run eslint
working-directory: ./cli/tauri.js/
working-directory: ./tooling/cli.js/
run: yarn lint
- name: run prettier
working-directory: ./cli/tauri.js/
working-directory: ./tooling/cli.js/
run: yarn format:check

View File

@@ -8,7 +8,7 @@ on:
pull_request:
paths:
- '.github/workflows/test-bundler.yml'
- 'cli/tauri-bundler/**'
- 'tooling/bundler/**'
env:
RUST_BACKTRACE: 1
@@ -34,7 +34,7 @@ jobs:
sudo apt-get install -y webkit2gtk-4.0
- name: test
run: |
cd ./cli/tauri-bundler
cd ./tooling/bundler
cargo test
clippy-fmt-check:
@@ -52,7 +52,7 @@ jobs:
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./cli/tauri-bundler/Cargo.toml --all-targets -- -D warnings
args: --manifest-path ./tooling/bundler/Cargo.toml --all-targets -- -D warnings
name: bundler
- name: install rustfmt
uses: actions-rs/toolchain@v1
@@ -65,4 +65,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path ./cli/tauri-bundler/Cargo.toml --all -- --check
args: --manifest-path ./tooling/bundler/Cargo.toml --all -- --check

View File

@@ -55,13 +55,13 @@ jobs:
toolchain: stable
override: true
- name: build api
working-directory: ./api
working-directory: ./tooling/api
run: yarn && yarn build
- name: build CLI
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ./cli/core/Cargo.toml
args: --manifest-path ./tooling/cli.rs/Cargo.toml
test-tauri-js-cli:
runs-on: ${{ matrix.platform }}
@@ -81,10 +81,10 @@ jobs:
- name: test
timeout-minutes: 30
run: |
cd ./cli/tauri.js
cd ./tooling/cli.js
yarn
yarn test
- name: run release build
timeout-minutes: 15
working-directory: cli/tauri.js
working-directory: tooling/cli.js
run: yarn build-release

View File

@@ -9,8 +9,8 @@ on:
paths:
- '.github/workflows/udeps.yml'
- 'core/**'
- 'cli/tauri-bundler/**'
- 'cli/core/**'
- 'tooling/bundler/**'
- 'tooling/cli.rs/**'
jobs:
udeps:
@@ -45,13 +45,13 @@ jobs:
- name: Cache bundler cargo target
uses: actions/cache@v2
with:
path: cli/tauri-bundler/target
path: tooling/bundler/target
key: ubuntu-latest-nightly-cargo-build-bundler-target-${{ hashFiles('**/Cargo.toml') }}
- name: Cache CLI cargo target
uses: actions/cache@v2
with:
path: cli/core/target
path: tooling/cli.rs/target
key: ubuntu-latest-nightly-cargo-build-cli-target-${{ hashFiles('**/Cargo.toml') }}
- uses: actions-rs/cargo@v1
@@ -72,9 +72,9 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: udeps
args: --manifest-path ./cli/tauri-bundler/Cargo.toml --all-targets --all-features
args: --manifest-path ./tooling/bundler/Cargo.toml --all-targets --all-features
- uses: actions-rs/cargo@v1
with:
command: udeps
args: --manifest-path ./cli/core/Cargo.toml --all-targets --all-features
args: --manifest-path ./tooling/cli.rs/Cargo.toml --all-targets --all-features

View File

@@ -47,7 +47,7 @@ jobs:
- name: run typedocusaurus
uses: tauri-apps/typedocusaurus/github-action@v1
with:
originPath: ./tauri/api/
originPath: ./tauri/tooling/api/
sidebarFile: sidebars.json
targetPath: en/api/js
docusaurusPath: ./tauri-docs/