build: migrate repo to use pnpm as the package manager (#10607)

* build: migrate repo to use `pnpm` as the pacakge manager

* corepack enable

* update lock file

* format files

* format .github

* fix audit js

* wrap in quotes

* --frozen-lockfile

* simplify packageManager field

* lockfile

* remove cache from audit workflow
This commit is contained in:
Amr Bashir 2024-08-17 05:04:08 +03:00 committed by GitHub
parent 9e891933d8
commit 01f6aa3405
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
75 changed files with 5692 additions and 5360 deletions

View File

@ -81,16 +81,16 @@
"getPublishedVersion": "node ../../.scripts/covector/package-latest-version.js npm ${ pkgFile.pkg.name } ${ pkgFile.pkg.version }",
"prepublish": [
{
"command": "yarn",
"command": "pnpm i --frozen-lockfile",
"dryRunCommand": true
},
{
"command": "echo '<details>\n<summary><em><h4>Yarn Audit</h4></em></summary>\n\n```'",
"command": "echo '<details>\n<summary><em><h4>PNPM Audit</h4></em></summary>\n\n```'",
"dryRunCommand": true,
"pipe": true
},
{
"command": "yarn audit",
"command": "pnpm audit",
"dryRunCommand": true,
"runFromRoot": true,
"pipe": true
@ -108,12 +108,12 @@
"publish": [
"sleep 15s",
{
"command": "echo '<details>\n<summary><em><h4>Yarn Publish</h4></em></summary>\n\n```'",
"command": "echo '<details>\n<summary><em><h4>PNPM Publish</h4></em></summary>\n\n```'",
"dryRunCommand": true,
"pipe": true
},
{
"command": "yarn publish --access public --loglevel silly --tag next --provenance",
"command": "pnpm publish --access public --loglevel silly --tag next --provenance",
"dryRunCommand": "npm publish --dry-run --access public --provenance",
"pipe": true
},
@ -142,16 +142,16 @@
],
"prepublish": [
{
"command": "yarn",
"command": "pnpm",
"dryRunCommand": true
},
{
"command": "echo '<details>\n<summary><em><h4>Yarn Audit</h4></em></summary>\n\n```'",
"command": "echo '<details>\n<summary><em><h4>PNPM Audit</h4></em></summary>\n\n```'",
"dryRunCommand": true,
"pipe": true
},
{
"command": "yarn audit",
"command": "pnpm audit",
"dryRunCommand": true,
"runFromRoot": true,
"pipe": true
@ -162,18 +162,18 @@
"pipe": true
},
{
"command": "yarn npm-pack",
"command": "pnpm npm-pack",
"dryRunCommand": true
}
],
"publish": [
{
"command": "echo '<details>\n<summary><em><h4>Yarn Publish</h4></em></summary>\n\n```'",
"command": "echo '<details>\n<summary><em><h4>PNPM Publish</h4></em></summary>\n\n```'",
"dryRunCommand": true,
"pipe": true
},
{
"command": "yarn npm-publish",
"command": "pnpm npm-publish",
"dryRunCommand": true,
"pipe": true
},

View File

@ -24,7 +24,7 @@ Prerequisites are mainly derived from VS Code's instructions for usage of develo
### A note on filesystem performance
Due to limitations in how Docker shares files between the Docker host and a container, it's also recommended that developers [clone Tauri source code into a container volume](https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-clone-repository-in-container-volume). This is optional, but highly advised as many filesystem/IO heavy operations (`cargo build`, `yarn install`, etc) will be very slow if they operate on directories shared with a Docker container from the Docker host.
Due to limitations in how Docker shares files between the Docker host and a container, it's also recommended that developers [clone Tauri source code into a container volume](https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-clone-repository-in-container-volume). This is optional, but highly advised as many filesystem/IO heavy operations (`cargo build`, `pnpm install`, etc) will be very slow if they operate on directories shared with a Docker container from the Docker host.
To do this, open your project with VS Code and run **Remote-Containers: Clone Repository in Container Volume...** from the Command Palette (<kbd>F1</kbd>).

View File

@ -1,4 +1,3 @@
# Contributor Covenant Code of Conduct
## Our Pledge
@ -18,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
- Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of
- The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
@ -130,4 +129,4 @@ For answers to common questions about this code of conduct, see the FAQ at
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
[translations]: https://www.contributor-covenant.org/translations

View File

@ -48,7 +48,7 @@ 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.app/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.
To set up your machine for development, follow the [Tauri setup guide](https://tauri.app/v1/guides/getting-started/prerequisites/) to get all the tools you need to develop Tauri apps. The only additional tool you may need is [PNPM](https://pnpm.io/), 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.
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 repository in order to run correctly.
@ -78,7 +78,7 @@ $ RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --open
### 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]/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.
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 `pnpm 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

@ -45,7 +45,7 @@ body:
id: info
attributes:
label: Full `tauri info` output
description: "Output of `npm run tauri info` or `cargo tauri info`"
description: 'Output of `npm run tauri info` or `cargo tauri info`'
render: text
validations:
required: true

View File

@ -1,8 +1,7 @@
---
name: 📚 Docs Report
about: Create a report to help us improve the docs
title: "[docs] "
title: '[docs] '
labels: 'type: documentation'
assignees: ''
---

View File

@ -22,7 +22,7 @@ body:
attributes:
label: "Describe the solution you'd like"
description: A clear description of what change you would like
placeholder: "I would like to..."
placeholder: 'I would like to...'
validations:
required: true
@ -31,7 +31,7 @@ body:
attributes:
label: Alternatives considered
description: "Any alternative solutions you've considered"
- type: textarea
id: context
attributes:

View File

@ -14,7 +14,7 @@ on:
- '**/Cargo.lock'
- '**/Cargo.toml'
- '**/package.json'
- '**/yarn.lock'
- '**/pnpm-lock.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@ -34,11 +34,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: audit workspace
run: yarn audit
- name: audit @tauri-apps/api
working-directory: tooling/api
run: yarn audit
- name: audit @tauri-apps/cli
working-directory: tooling/cli/node
run: yarn audit
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: '18'
- run: pnpm audit

View File

@ -39,7 +39,6 @@ jobs:
- 'core/tauri-config-schema/schema.json'
- 'core/tauri-acl-schema/*.json'
api:
runs-on: ubuntu-latest
needs: changes
@ -49,7 +48,7 @@ jobs:
- name: build api
working-directory: tooling/api
run: yarn && yarn build
run: pnpm i --frozen-lockfile && pnpm build
- name: check api
run: ./.scripts/ci/has-diff.sh

View File

@ -27,4 +27,4 @@ jobs:
uses: jbolda/covector/packages/action@covector-v0
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: "status"
command: 'status'

View File

@ -164,11 +164,11 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'
cache: yarn
cache: 'yarn'
cache-dependency-path: tooling/*/yarn.lock
- name: cargo login

View File

@ -48,9 +48,9 @@ jobs:
timeout-minutes: 30
run: |
cd ./tooling/cli/node
yarn
yarn build
yarn test
pnpm i --frozen-lockfile
pnpm build
pnpm test
version-or-publish:
runs-on: ubuntu-latest
@ -70,12 +70,12 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
cache: yarn
cache-dependency-path: tooling/*/yarn.lock
cache: 'pnpm'
- name: cargo login
run: cargo login ${{ secrets.ORG_CRATES_IO_TOKEN }}

View File

@ -66,8 +66,9 @@ jobs:
with:
targets: ${{ matrix.target.name }}
- run: corepack enable
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
@ -112,9 +113,9 @@ jobs:
- name: Test
run: |
cd tooling/api
yarn && yarn build
pnpm i --frozen-lockfile && pnpm build
cd ../../examples/api
yarn
pnpm i --frozen-lockfile
. .setup-cross.sh
chmod +x cargo-tauri
chmod +x $HOME/.cargo/bin/cross

View File

@ -16,45 +16,38 @@ concurrency:
cancel-in-progress: true
jobs:
eslint-cli:
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
cache-dependency-path: tooling/cli/node/yarn.lock
- name: install deps via yarn
working-directory: ./tooling/cli/node/
run: yarn
# nothing to lint
#- name: run lint
# working-directory: ./tooling/cli/node/
# run: yarn lint
- name: run format
working-directory: ./tooling/cli/node/
run: yarn format:check
cache: 'pnpm'
- run: pnpm i --frozen-lockfile
- run: pnpm format:check
eslint-api:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
cache-dependency-path: tooling/api/yarn.lock
cache: 'pnpm'
- run: pnpm i --frozen-lockfile
- run: pnpm eslint:check
- name: install deps via yarn
working-directory: ./tooling/api/
run: yarn
- name: run ts:check
working-directory: ./tooling/api/
run: yarn ts:check
- name: run lint
working-directory: ./tooling/api/
run: yarn lint
- name: run format
working-directory: ./tooling/api/
run: yarn format:check
typescript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'pnpm'
- run: pnpm i --frozen-lockfile
- run: pnpm ts:check

View File

@ -30,45 +30,45 @@ jobs:
target: x86_64-apple-darwin
architecture: x64
build: |
yarn build:release --target=x86_64-apple-darwin
pnpm build:release --target=x86_64-apple-darwin
strip -x *.node
- host: windows-latest
build: yarn build:release
build: pnpm build:release
target: x86_64-pc-windows-msvc
architecture: x64
- host: windows-latest
build: yarn build:release --target i686-pc-windows-msvc
build: pnpm build:release --target i686-pc-windows-msvc
target: i686-pc-windows-msvc
architecture: x64
- host: windows-latest
architecture: x64
target: aarch64-pc-windows-msvc
build: yarn build:release --target aarch64-pc-windows-msvc --features native-tls-vendored --cargo-flags="--no-default-features"
build: pnpm build:release --target aarch64-pc-windows-msvc --features native-tls-vendored --cargo-flags="--no-default-features"
- host: ubuntu-20.04
target: x86_64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
build: |
cd tooling/cli/node
yarn build:release --target x86_64-unknown-linux-gnu
pnpm build:release --target x86_64-unknown-linux-gnu
strip *.node
- host: ubuntu-20.04
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |
cd tooling/cli/node
yarn build:release
pnpm build:release
strip *.node
- host: macos-latest
target: aarch64-apple-darwin
build: |
yarn build:release --features native-tls-vendored --target=aarch64-apple-darwin
pnpm build:release --features native-tls-vendored --target=aarch64-apple-darwin
strip -x *.node
- host: ubuntu-20.04
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: |
cd tooling/cli/node
yarn build:release --target aarch64-unknown-linux-gnu
pnpm build:release --target aarch64-unknown-linux-gnu
aarch64-unknown-linux-gnu-strip *.node
- host: ubuntu-20.04
architecture: x64
@ -77,7 +77,7 @@ jobs:
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y
build: |
yarn build:release --target=armv7-unknown-linux-gnueabihf
pnpm build:release --target=armv7-unknown-linux-gnueabihf
arm-linux-gnueabihf-strip *.node
- host: ubuntu-20.04
architecture: x64
@ -86,20 +86,20 @@ jobs:
build: |
cd tooling/cli/node
rustup target add aarch64-unknown-linux-musl
yarn build:release --target aarch64-unknown-linux-musl
pnpm build:release --target aarch64-unknown-linux-musl
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
name: stable - ${{ matrix.settings.target }} - node@16
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
- run: corepack enable
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
if: ${{ !matrix.settings.docker }}
with:
node-version: 16
check-latest: true
cache: yarn
cache-dependency-path: 'tooling/cli/node/yarn.lock'
cache: 'pnpm'
architecture: ${{ matrix.settings.architecture }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
@ -116,7 +116,7 @@ jobs:
if: ${{ matrix.settings.setup }}
shell: bash
- name: Install dependencies
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm i --frozen-lockfile --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000
- name: Build in docker
uses: addnab/docker-run-action@v3
@ -157,7 +157,7 @@ jobs:
# prepare: |
# pkg install -y curl node14 python2
# curl -qL https://www.npmjs.com/install.sh | sh
# npm install -g yarn
# npm install -g pnpm
# curl https://sh.rustup.rs -sSf --output rustup.sh
# sh rustup.sh -y --profile minimal --default-toolchain stable
# export PATH="/usr/local/cargo/bin:$PATH"
@ -165,8 +165,8 @@ jobs:
# rustc --version
# echo "~~~~ node -v ~~~~"
# node -v
# echo "~~~~ yarn --version ~~~~"
# yarn --version
# echo "~~~~ pnpm --version ~~~~"
# pnpm --version
# run: |
# export PATH="/usr/local/cargo/bin:$PATH"
# pwd
@ -175,8 +175,8 @@ jobs:
# env
# freebsd-version
# cd ./tooling/cli/node/
# yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
# yarn build:release
# pnpm i --frozen-lockfile --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000
# pnpm build:release
# strip -x *.node
# rm -rf node_modules
# rm -rf ../target
@ -205,15 +205,15 @@ jobs:
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
- run: corepack enable
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
cache-dependency-path: 'tooling/cli/node/yarn.lock'
cache: 'pnpm'
- name: Install dependencies
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm i --frozen-lockfile --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000
- name: Download artifacts
uses: actions/download-artifact@v3
with:
@ -223,7 +223,7 @@ jobs:
run: ls -R .
shell: bash
- name: Test bindings
run: yarn test
run: pnpm test
test-linux-x64-gnu-binding:
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
needs:
@ -238,15 +238,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
cache-dependency-path: 'tooling/cli/node/yarn.lock'
cache: 'pnpm'
- name: Install dependencies
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm i --frozen-lockfile --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000
- name: Download artifacts
uses: actions/download-artifact@v3
with:
@ -260,7 +260,7 @@ jobs:
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev
- name: Test bindings
run: yarn test
run: pnpm test
test-linux-x64-musl-binding:
name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }}
needs:
@ -277,15 +277,15 @@ jobs:
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
steps:
- uses: actions/checkout@v4
- run: corepack enable
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
cache-dependency-path: 'tooling/cli/node/yarn.lock'
cache: 'pnpm'
- name: Install dependencies
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm i --frozen-lockfile --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000
- name: Download artifacts
uses: actions/download-artifact@v3
with:
@ -296,13 +296,13 @@ jobs:
shell: bash
- name: Setup and run tests
run: |
yarn tauri --help
pnpm tauri --help
ls -la
#- name: Setup and run tests
# run: |
# rustup install stable
# rustup default stable
# yarn test
# pnpm test
# ls -la
test-linux-arm-bindings:
name: Test bindings on ${{ matrix.image }} - node@${{ matrix.node }}
@ -327,7 +327,7 @@ jobs:
run: ls -R .
shell: bash
- name: Install dependencies
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm i --frozen-lockfile --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
- name: Download aarch64-gnu artifacts
uses: actions/download-artifact@v3
with:
@ -356,7 +356,7 @@ jobs:
fnm install ${{ matrix.node }}
fnm use ${{ matrix.node }}
cd tooling/cli/node
yarn tauri --help
pnpm tauri --help
ls -la
publish:
name: Publish
@ -369,21 +369,21 @@ jobs:
#- test-linux-arm-bindings
steps:
- uses: actions/checkout@v4
- run: corepack enable
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
cache: yarn
cache-dependency-path: 'tooling/cli/node/yarn.lock'
cache: 'pnpm'
- name: Install dependencies
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm i --frozen-lockfile --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: tooling/cli/node/artifacts
- name: Move artifacts
run: yarn artifacts
run: pnpm artifacts
- name: List packages
run: ls -R ./npm
shell: bash

View File

@ -37,9 +37,9 @@ jobs:
- name: Ensure that the tool cache is populated with the cargo-vet binary
run: cargo install --root ${{ runner.tool_cache }}/cargo-vet --version ${{ env.CARGO_VET_VERSION }} cargo-vet
# Enable this again to break the workflow once we have a reasonable amount of suggestions to get to a clean base line
# - name: Invoke cargo-vet
# run: cargo vet --locked
# Enable this again to break the workflow once we have a reasonable amount of suggestions to get to a clean base line
# - name: Invoke cargo-vet
# run: cargo vet --locked
- name: Provide audit suggestions
run: cargo vet suggest

View File

@ -42,20 +42,18 @@ jobs:
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.1
- run: corepack enable
- name: setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
cache-dependency-path: |
tooling/api/yarn.lock
examples/api/yarn.lock
cache: 'pnpm'
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: gradle
cache: 'gradle'
- name: Setup NDK
uses: nttld/setup-ndk@v1
@ -95,11 +93,11 @@ jobs:
- name: build Tauri API
working-directory: ./tooling/api
run: yarn && yarn build
run: pnpm i --frozen-lockfile && pnpm build
- name: install API example dependencies
working-directory: ./examples/api
run: yarn
run: pnpm i --frozen-lockfile
- name: init Android Studio project
working-directory: ./examples/api

View File

@ -38,12 +38,12 @@ jobs:
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
- run: corepack enable
- name: setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
cache-dependency-path: tooling/cli/node/yarn.lock
cache: 'pnpm'
- name: install Linux dependencies
if: matrix.platform == 'ubuntu-latest'
@ -61,6 +61,6 @@ jobs:
timeout-minutes: 30
run: |
cd ./tooling/cli/node
yarn
yarn build
yarn test
pnpm i --frozen-lockfile
pnpm build
pnpm test

View File

@ -32,23 +32,14 @@ jobs:
fail-fast: false
matrix:
platform:
- {
target: x86_64-pc-windows-msvc,
os: windows-latest
}
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- {
target: aarch64-pc-windows-msvc,
os: windows-latest,
args: --no-default-features --features native-tls-vendored
}
- {
target: x86_64-unknown-linux-gnu,
os: ubuntu-latest
}
- {
target: x86_64-apple-darwin,
os: macos-latest
}
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
- { target: x86_64-apple-darwin, os: macos-latest }
steps:
- uses: actions/checkout@v4

1
.husky/.gitignore vendored
View File

@ -1 +0,0 @@
_

View File

@ -10,8 +10,8 @@ if [ -z "$(git diff --name-only tooling/api)" ]; then
echo "skipping api - no changes detected"
else
cd tooling/api
yarn format
yarn lint:fix
pnpm format
pnpm eslint:fix
cd ../..
fi
@ -19,6 +19,6 @@ if [ -z "$(git diff --name-only tooling/cli/node)" ]; then
echo "skipping \`@tauri-apps/cli\` - no changes detected"
else
cd tooling/cli/node
yarn format
pnpm format
cd ../../..
fi

View File

@ -1,17 +1,36 @@
/.github
/.changes
/.husky
/.vscode
/audits
node_modules
target
dist
/core/tauri/scripts/bundle.global.js
/tooling/cli/templates
/tooling/cli/node
/tooling/cli/schema.json
/core/tauri-config-schema/schema.json
/.vscode
# dependcies and artifacts directories
node_modules/
target/
dist/
# lock files
pnpm-lock.yaml
# autogenerated and minimized js file
core/tauri/scripts/bundle.global.js
# this file is an IIFE, shouldn't be formatted
core/tauri/scripts/process-ipc-message-fn.js
# cli templates should be formatted manually
# it also includes invalid json files that
# prettier can't handle
tooling/cli/templates
# autogenerated files
**/autogenerated/**/*.md
tooling/cli/node/index.js
tooling/cli/node/index.d.ts
CHANGELOG.md
*.wxs
**/reference.md
*schema.json
core/tauri/scripts/process-ipc-message-fn.js
# WiX templates
*.wxs
# examples /gen directory
examples/**/src-tauri/gen

View File

@ -6,7 +6,7 @@
echo "Building API definitions..."
cd tooling\api
yarn; yarn build
pnpm i; pnpm build
cd ..\..
echo "Installing the Tauri Rust CLI..."
@ -23,8 +23,8 @@ $result = $host.ui.PromptForChoice("Node.js CLI", "Do you want to install the No
switch ($result) {
0{
cd tooling\cli\node
yarn; yarn build; yarn link
pnpm i; pnpm build; pnpm link
cd ..\..
echo "Tauri Node.js CLI installed. use `yarn link @tauri-apps/cli` and run it with '$ yarn tauri [COMMAND]'."
echo "Tauri Node.js CLI installed. use `pnpm link @tauri-apps/cli` and run it with '$ pnpm tauri [COMMAND]'."
}
}

View File

@ -6,7 +6,7 @@
echo "Building API definitions..."
cd tooling/api
yarn && yarn build
pnpm i && pnpm build
cd ../..
echo "Building the Tauri Rust CLI..."
@ -20,9 +20,9 @@ select yn in "Yes" "No"; do
case $yn in
Yes )
cd tooling/cli/node
yarn && yarn build && yarn link
pnpm i && pnpm build && pnpm link
cd ../../..
echo "Tauri Node.js CLI installed. use `yarn link @tauri-apps/cli` and run it with '$ yarn tauri [COMMAND]'."
echo "Tauri Node.js CLI installed. use `pnpm link @tauri-apps/cli` and run it with '$ pnpm tauri [COMMAND]'."
break;;
No ) break;;
esac

View File

@ -128,7 +128,7 @@ Because of the many ways to build front-ends, we will stick with a common node.j
The easiest way to do this is to run the following:
```
npx create-tauri-app
npm create tauri-app
```
Which will ask you a bunch of questions about the framework you want to install and then create everything you need in a single folder - some via the placement of template files and some through normal installation procedures of your framework.
@ -138,6 +138,8 @@ Which will ask you a bunch of questions about the framework you want to install
Once everything is installed, you can run:
```
pnpm tauri dev
-or-
yarn tauri dev
-or-
npm run tauri dev
@ -157,7 +159,7 @@ If you modify your rust code or anything in the Cargo.toml, the window will clos
If you need to get deeper insight into your current project, or triage requires investigation of installed components, just run:
```
yarn tauri info
pnpm tauri info
```
## What does the Release flow look like?
@ -169,7 +171,7 @@ Depending upon the operating system that the developer (or CI) is building the a
To kick off this process, just:
```
yarn tauri build
pnpm tauri build
```
After some time, the process will end and you can see the results in the `./src-tauri/target/release` folder.

View File

@ -43,13 +43,13 @@ The list of Tauri's features includes, but is not limited to:
Tauri currently supports development and distribution on the following platforms:
| Platform | Versions |
| :----------------- | :-------------------------------------------------------------------------------------------------------------- |
| Windows | 7 and above |
| macOS | 10.15 and above |
| Linux | webkit2gtk 4.0 for Tauri v1 (for example Ubuntu 18.04). webkit2gtk 4.1 for Tauri v2 (for example Ubuntu 22.04). |
| iOS/iPadOS (beta) | 9 and above |
| Android (beta) | 7 and above |
| Platform | Versions |
| :---------------- | :-------------------------------------------------------------------------------------------------------------- |
| Windows | 7 and above |
| macOS | 10.15 and above |
| Linux | webkit2gtk 4.0 for Tauri v1 (for example Ubuntu 18.04). webkit2gtk 4.1 for Tauri v2 (for example Ubuntu 22.04). |
| iOS/iPadOS (beta) | 9 and above |
| Android (beta) | 7 and above |
## Contributing

View File

@ -25,24 +25,18 @@ Windows:
- Install dependencies (Run inside of this folder `examples/api/`)
```bash
# with yarn
$ yarn
# with npm
$ npm install
$ pnpm i
```
- Run the app in development mode (Run inside of this folder `examples/api/`)
```bash
# with yarn
$ yarn tauri dev
# with npm
$ npm run tauri dev
$ pnpm tauri dev
```
- Build an run the release app (Run inside of this folder `examples/api/`)
```bash
$ yarn tauri build
$ pnpm tauri build
$ ./src-tauri/target/release/app
```

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en" theme="dark">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -2,9 +2,7 @@
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "secondary-window",
"description": "capability for secondary window",
"windows": [
"main-*"
],
"windows": ["main-*"],
"permissions": [
{
"identifier": "sample:allow-ping",

View File

@ -2,10 +2,7 @@
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "run-app",
"description": "permissions to run the app",
"windows": [
"main",
"main-*"
],
"windows": ["main", "main-*"],
"permissions": [
{
"identifier": "allow-log-operation",
@ -62,4 +59,4 @@
"core:webview:allow-create-webview-window",
"core:webview:allow-print"
]
}
}

View File

@ -6,8 +6,8 @@
"build": {
"frontendDist": "../dist",
"devUrl": "http://localhost:1420",
"beforeDevCommand": "yarn dev",
"beforeBuildCommand": "yarn build"
"beforeDevCommand": "pnpm dev",
"beforeBuildCommand": "pnpm build"
},
"app": {
"withGlobalTauri": true,

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<style>

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<style>

View File

@ -22,27 +22,18 @@ Windows:
- Install dependencies (Run inside of this folder `examples/resources/`)
```bash
# with yarn
$ yarn
# with npm
$ npm install
$ yarn tauri
$ yarn package
$ pnpm i
```
- Run the app in development mode (Run inside of this folder `examples/resources/`)
```bash
# with yarn
$ yarn tauri dev
# with npm
$ npm run tauri dev
$ pnpm tauri dev
```
- Build an run the release app (Run inside of this folder `examples/resources/`)
```bash
$ yarn tauri build
$ pnpm tauri build
$ ./src-tauri/target/release/app
```

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,11 +1,6 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "app",
"permissions": [
"core:event:default",
"core:window:default"
],
"windows": [
"main"
]
}
"permissions": ["core:event:default", "core:window:default"],
"windows": ["main"]
}

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -13,15 +13,13 @@
"scripts": {
"format": "prettier --write . --config .prettierrc --ignore-path .prettierignore",
"format:check": "prettier --check . --config .prettierrc --ignore-path .prettierignore",
"postinstall": "husky install"
"eslint:check": "pnpm run -r eslint:check",
"ts:check": "pnpm run -r ts:check",
"postinstall": "husky"
},
"devDependencies": {
"covector": "^0.9.0",
"husky": "^6.0.0",
"husky": "^9.1.4",
"prettier": "^3.3.2"
},
"dependencies": {
"typescript": "^5.4.5"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
"packageManager": "pnpm@9.7.0"
}

5400
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

6
pnpm-workspace.yaml Normal file
View File

@ -0,0 +1,6 @@
packages:
- tooling/api
- tooling/cli/node
- examples/api
- examples/resources
- examples/file-associations

View File

@ -32,8 +32,9 @@ To learn more about the details of how all of these pieces fit together, please
The preferred method is to install this module locally as a dependency:
```
$ npm install --save @tauri-apps/api
$ pnpm add @tauri-apps/api
$ yarn add @tauri-apps/api
$ npm add @tauri-apps/api
```
## Semver

View File

@ -37,13 +37,11 @@
},
"scripts": {
"build": "rollup -c --configPlugin typescript",
"npm-pack": "yarn build && cd ./dist && npm pack",
"npm-publish": "yarn build && cd ./dist && yarn publish --access public --loglevel silly --tag next",
"npm-pack": "pnpm build && cd ./dist && npm pack",
"npm-publish": "pnpm build && cd ./dist && pnpm publish --access public --loglevel silly --tag next",
"ts:check": "tsc --noEmit",
"lint": "eslint src/**.ts",
"lint:fix": "eslint src/**.ts --fix",
"format": "prettier --write . --config ../../.prettierrc --ignore-path .gitignore --ignore-path ../../.prettierignore",
"format:check": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore --ignore-path ../../.prettierignore"
"eslint:check": "eslint src/**.ts",
"eslint:fix": "eslint src/**.ts --fix"
},
"devDependencies": {
"@eslint/js": "^9.4.0",
@ -60,11 +58,6 @@
"rollup": "4.20.0",
"tslib": "^2.6.3",
"typescript": "^5.4.5",
"typescript-eslint": "rc-v8"
},
"engines": {
"node": ">= 18.18",
"npm": ">= 6.6.0",
"yarn": ">= 1.19.1"
"typescript-eslint": "^8.1.0"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -7,5 +7,4 @@ test
.eslintrc
.prettierignore
rustfmt.toml
yarn.lock
*.node

View File

@ -1,4 +1,5 @@
# @tauri-apps/cli
<img align="right" src="https://github.com/tauri-apps/tauri/raw/dev/app-icon.png" height="128" width="128">
[![status](https://img.shields.io/badge/status-stable-blue.svg)](https://github.com/tauri-apps/tauri/tree/dev)
@ -10,34 +11,42 @@
[![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation)
[![support](https://img.shields.io/badge/sponsor-Open%20Collective-blue.svg)](https://opencollective.com/tauri)
| Component | Version |
| --------- | ------------------------------------------- |
| @tauri-apps/cli | ![](https://img.shields.io/npm/v/@tauri-apps/cli.svg) |
| Component | Version |
| --------------- | ----------------------------------------------------- |
| @tauri-apps/cli | ![](https://img.shields.io/npm/v/@tauri-apps/cli.svg) |
## About Tauri
Tauri is a polyglot and generic system that is very composable and allows engineers to make a wide variety of applications. It is used for building applications for Desktop Computers using a combination of Rust tools and HTML rendered in a Webview. Apps built with Tauri can ship with any number of pieces of an optional JS API / Rust API so that webviews can control the system via message passing. In fact, developers can extend the default API with their own functionality and bridge the Webview and Rust-based backend easily.
Tauri apps can have custom menus and have tray-type interfaces. They can be updated, and are managed by the user's operating system as expected. They are very small, because they use the system's webview. They do not ship a runtime, since the final binary is compiled from rust. This makes the reversing of Tauri apps not a trivial task.
## This module
Written in Typescript and packaged such that it can be used with `npm`, `pnpm`, `yarn`, and `bun`, this library provides a node.js runner for common tasks when using Tauri, like `yarn tauri dev`. For the most part it is a wrapper around [tauri-cli](https://github.com/tauri-apps/tauri/blob/dev/tooling/cli).
Written in Typescript and packaged such that it can be used with `npm`, `pnpm`, `yarn`, and `bun`, this library provides a node.js runner for common tasks when using Tauri, like `pnpm tauri dev`. For the most part it is a wrapper around [tauri-cli](https://github.com/tauri-apps/tauri/blob/dev/tooling/cli).
To learn more about the details of how all of these pieces fit together, please consult this [ARCHITECTURE.md](https://github.com/tauri-apps/tauri/blob/dev/ARCHITECTURE.md) document.
## Installation
The preferred method is to install this module locally as a development dependency:
```
$ npm install --save-dev @tauri-apps/cli
$ yarn add --dev @tauri-apps/cli
$ pnpm add -D @tauri-apps/cli
$ yarn add -D @tauri-apps/cli
$ npm add -D @tauri-apps/cli
```
## Semver
**tauri** is following [Semantic Versioning 2.0](https://semver.org/).
## Licenses
Code: (c) 2019 - 2021 - The Tauri Programme within The Commons Conservancy.
MIT or MIT/Apache 2.0 where applicable.
Logo: CC-BY-NC-ND
- Original Tauri Logo Designs by [Daniel Thompson-Yvetot](https://github.com/nothingismagick) and [Guillaume Chau](https://github.com/akryum)

View File

@ -7,5 +7,9 @@
/* auto-generated by NAPI-RS */
export function run(args: Array<string>, binName: string | undefined | null, callback: (...args: any[]) => any): void
export function run(
args: Array<string>,
binName: string | undefined | null,
callback: (...args: any[]) => any
): void
export function logError(error: string): void

View File

@ -21,7 +21,10 @@ function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
const lddPath = require('child_process').execSync('which ldd').toString().trim()
const lddPath = require('child_process')
.execSync('which ldd')
.toString()
.trim()
return readFileSync(lddPath, 'utf8').includes('musl')
} catch (e) {
return true
@ -48,7 +51,9 @@ switch (platform) {
}
break
case 'arm':
localFileExisted = existsSync(join(__dirname, 'cli.android-arm-eabi.node'))
localFileExisted = existsSync(
join(__dirname, 'cli.android-arm-eabi.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./cli.android-arm-eabi.node')
@ -135,9 +140,7 @@ switch (platform) {
}
break
case 'arm64':
localFileExisted = existsSync(
join(__dirname, 'cli.darwin-arm64.node')
)
localFileExisted = existsSync(join(__dirname, 'cli.darwin-arm64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./cli.darwin-arm64.node')

View File

@ -5,4 +5,7 @@
/* tslint:disable */
/* eslint-disable */
export function run(args: Array<string>, binName: string | undefined | null): Promise<void>
export function run(
args: Array<string>,
binName: string | undefined | null
): Promise<void>

View File

@ -46,9 +46,6 @@
"jest-transform-toml": "1.0.0",
"prettier": "3.3.2"
},
"resolutions": {
"json5": "2.2.3"
},
"engines": {
"node": ">= 10"
},
@ -63,8 +60,6 @@
"prepack": "cp ../schema.json .",
"test": "jest --runInBand --forceExit --no-cache",
"version": "napi version",
"tauri": "node ./tauri.js",
"format": "prettier --write ./package.json ./tauri.js",
"format:check": "prettier --check ./package.json ./tauri.js"
"tauri": "node ./tauri.js"
}
}

View File

@ -30,7 +30,15 @@ describe('[CLI] @tauri-apps/cli template', () => {
await move(outPath, cacheOutPath)
}
await cli.run(['init', '--directory', process.cwd(), '--force', '--tauri-path', resolve(currentDirName, '../../../../../..'), '--ci'])
await cli.run([
'init',
'--directory',
process.cwd(),
'--force',
'--tauri-path',
resolve(currentDirName, '../../../../../..'),
'--ci'
])
if (outExists) {
await move(cacheOutPath, outPath)

View File

@ -11,12 +11,7 @@ const warn = logger('app:spawn')
/*
Returns pid, takes onClose
*/
module.exports.spawn = (
cmd,
params,
cwd,
onClose
) => {
module.exports.spawn = (cmd, params, cwd, onClose) => {
log(`Running "${cmd} ${params.join(' ')}"`)
log()
@ -44,12 +39,7 @@ module.exports.spawn = (
/*
Returns nothing, takes onFail
*/
module.exports.spawnSync = (
cmd,
params,
cwd,
onFail
) => {
module.exports.spawnSync = (cmd, params, cwd, onFail) => {
log(`[sync] Running "${cmd} ${params.join(' ')}"`)
log()

File diff suppressed because it is too large Load Diff

View File

@ -3,8 +3,8 @@
"build": {
"distDir": "../dist",
"devPath": "http://localhost:5173",
"beforeDevCommand": "yarn dev",
"beforeBuildCommand": "yarn build"
"beforeDevCommand": "pnpm dev",
"beforeBuildCommand": "pnpm build"
},
"package": {
"productName": "Tauri API",
@ -133,4 +133,4 @@
"menuOnLeftClick": false
}
}
}
}

View File

@ -62,4 +62,4 @@
"csp": null
}
}
}
}

View File

@ -3,8 +3,8 @@
"version": "0.1.0",
"identifier": "com.tauri.dev",
"build": {
"beforeDevCommand": "yarn dev",
"beforeBuildCommand": "yarn build",
"beforeDevCommand": "pnpm dev",
"beforeBuildCommand": "pnpm build",
"devUrl": "http://localhost:1420",
"frontendDist": "../dist"
},

View File

@ -18,8 +18,8 @@
],
"scripts": {
"build": "rollup -c",
"prepublishOnly": "yarn build",
"pretest": "yarn build"
"prepublishOnly": "pnpm build",
"pretest": "pnpm build"
},
"dependencies": {
"@tauri-apps/api": ">=2.0.0-beta.6"