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
75 changed files with 5692 additions and 5360 deletions

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