Skip to content

Commit

Permalink
build: migrate repo to use pnpm as the package manager (tauri-apps#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
amrbashir authored Aug 17, 2024
1 parent 9e89193 commit 01f6aa3
Show file tree
Hide file tree
Showing 75 changed files with 5,692 additions and 5,360 deletions.
22 changes: 11 additions & 11 deletions .changes/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
},
Expand Down Expand Up @@ -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
Expand All @@ -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
},
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>).

Expand Down
23 changes: 11 additions & 12 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Contributor Covenant Code of Conduct

## Our Pledge
Expand All @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/docs_report.md
Original file line number Diff line number Diff line change
@@ -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: ''

---
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -31,7 +31,7 @@ body:
attributes:
label: Alternatives considered
description: "Any alternative solutions you've considered"

- type: textarea
id: context
attributes:
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- '**/Cargo.lock'
- '**/Cargo.toml'
- '**/package.json'
- '**/yarn.lock'
- '**/pnpm-lock.yaml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -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
3 changes: 1 addition & 2 deletions .github/workflows/check-generated-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:
- 'core/tauri-config-schema/schema.json'
- 'core/tauri-acl-schema/*.json'
api:
runs-on: ubuntu-latest
needs: changes
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/covector-comment-on-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
uses: jbolda/covector/packages/action@covector-v0
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: "status"
command: 'status'
4 changes: 2 additions & 2 deletions .github/workflows/covector-version-or-publish-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/covector-version-or-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
53 changes: 23 additions & 30 deletions .github/workflows/lint-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit 01f6aa3

Please sign in to comment.