Skip to content

Commit

Permalink
refactor(repo): add /tooling folder (#1457)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Apr 12, 2021
1 parent a6def70 commit aea6145
Show file tree
Hide file tree
Showing 242 changed files with 159 additions and 6,315 deletions.
2 changes: 1 addition & 1 deletion .changes/cli-no-targets.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"tauri-cli": minor
"cli.rs": minor
---

You can now run `cargo tauri build -t none` to speed up the build if you don't need executables.
2 changes: 1 addition & 1 deletion .changes/cli-rust.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"tauri-cli": minor
"cli.rs": minor
"tauri-bundler": minor
---

Expand Down
2 changes: 1 addition & 1 deletion .changes/command-shell.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"tauri-cli": patch
"cli.rs": patch
---

Run `beforeDevCommand` and `beforeBuildCommand` in a shell.
22 changes: 11 additions & 11 deletions .changes/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,46 +140,46 @@
},
"packages": {
"api": {
"path": "./api",
"path": "./tooling/api",
"manager": "javascript",
"assets": [
{
"path": "./api/tauri-${ pkgFile.version }.tgz",
"path": "./tooling/api/tauri-${ pkgFile.version }.tgz",
"name": "api-${ pkgFile.version }.tgz"
}
]
},
"tauri-bundler": {
"path": "./cli/tauri-bundler",
"path": "./tooling/bundler",
"manager": "rust"
},
"tauri-cli": {
"path": "./cli/core",
"cli.rs": {
"path": "./tooling/cli.rs",
"manager": "rust",
"dependencies": [
"api",
"tauri-bundler",
"tauri"
]
},
"tauri.js": {
"path": "./cli/tauri.js",
"cli.js": {
"path": "./tooling/cli.js",
"manager": "javascript",
"dependencies": [
"tauri-cli"
"cli.rs"
],
"assets": [
{
"path": "./cli/tauri.js/tauri-${ pkgFile.version }.tgz",
"name": "tauri.js-${ pkgFile.version }.tgz"
"path": "./tooling/cli.js/tauri-${ pkgFile.version }.tgz",
"name": "cli.js-${ pkgFile.version }.tgz"
}
]
},
"create-tauri-app": {
"path": "./cli/create-tauri-app",
"manager": "javascript",
"dependencies": [
"tauri.js"
"cli.js"
]
},
"tauri-utils": {
Expand Down
2 changes: 1 addition & 1 deletion .changes/fix-blank-hyperlinks-polyfiil.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"tauri-cli": patch
"cli.rs": patch
---

Fixes `<a target="_blank">` polyfill.
2 changes: 1 addition & 1 deletion .changes/fix-ts-api-typings.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"tauri.js": patch
"cli.js": patch
"tauri": minor
---

Expand Down
4 changes: 2 additions & 2 deletions .changes/license.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
"api": patch
"tauri-bundler": patch
"tauri-cli": patch
"tauri.js": patch
"cli.rs": patch
"cli.js": patch
"tauri-utils": patch
"tauri-macros": patch
"tauri-build": patch
Expand Down
2 changes: 1 addition & 1 deletion .changes/package-config.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
"tauri": minor
"tauri-cli": minor
"cli.rs": minor
---

Adds `productName` and `version` configs on `tauri.conf.json > package`.
4 changes: 2 additions & 2 deletions .changes/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Use the following format:
---
"api": patch
"tauri-bundler": patch
"tauri-cli": patch
"tauri.js": patch
"cli.rs": patch
"cli.js": patch
"tauri-utils": patch
"tauri-macros": patch
"tauri-build": patch
Expand Down
4 changes: 2 additions & 2 deletions .changes/refactor-info.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
"tauri-cli": minor
"tauri.js": minor
"cli.rs": minor
"cli.js": minor
---

The `info` command was rewritten in Rust.
4 changes: 2 additions & 2 deletions .changes/refactor-init.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
"tauri-cli": minor
"tauri.js": minor
"cli.rs": minor
"cli.js": minor
---

The `init` command was rewritten in Rust.
2 changes: 1 addition & 1 deletion .changes/remove-no-server.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
"tauri": minor
"tauri.js": minor
"cli.js": minor
---

Removed the `no-server` mode, the `inliner`, the `dev` server proxy and the `loadAsset` API.
2 changes: 1 addition & 1 deletion .changes/revert-and-shift-tauri-create.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
"create-tauri-app": minor
"tauri.js": patch
"cli.js": patch
---

Revert `tauri create` deletion and shift remaining pieces that weren't deleted to `create-tauri-app`.
2 changes: 1 addition & 1 deletion .changes/tauri-api.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"tauri.js": minor
"cli.js": minor
---

The Tauri API interface is now shipped with the `@tauri-apps/api` package instead of the deprecated `tauri` package.
Expand Down
2 changes: 1 addition & 1 deletion .changes/tauri-cli.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"tauri.js": minor
"cli.js": minor
---

The Tauri Node.js CLI package is now `@tauri-apps/cli`.
4 changes: 2 additions & 2 deletions .changes/tauri-dev-propagate-args.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
"tauri-cli": patch
"tauri.js": patch
"cli.rs": patch
"cli.js": patch
---

All the arguments passed after `tauri dev --` are now propagated to the binary.
4 changes: 2 additions & 2 deletions .changes/taurijs-dead-code-elim.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"tauri.js": patch
"cli.js": patch
---

Eliminate the dead code in tauri.js. Also removed some unused dependencies and updated the publish config that we are not publishing the Typescript files (since this is now primarily a CLI).
Eliminate the dead code in cli.js. Also removed some unused dependencies and updated the publish config that we are not publishing the Typescript files (since this is now primarily a CLI).
2 changes: 1 addition & 1 deletion .changes/updater-alpha.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"tauri-cli": minor
"cli.rs": minor
"tauri-bundler": minor
"tauri": minor
---
Expand Down
8 changes: 5 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 12 additions & 12 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/artifacts-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/build-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/core-lint-fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- '.github/workflows/core-lint-fmt.yml'
- 'core/**'
- 'examples/**'
- 'cli/core/**'
- 'tooling/cli.rs/**'

jobs:
workspace_clippy_fmt_check:
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/covector-version-or-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/js-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
pull_request:
paths:
- '.github/workflows/js-lint.yml'
- 'cli/tauri.js/**'
- 'tooling/cli.js/**'

jobs:
eslint-check:
Expand All @@ -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
Loading

0 comments on commit aea6145

Please sign in to comment.