Skip to content

Commit

Permalink
Use pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
elibroftw committed May 11, 2024
1 parent 74f3c01 commit 745d02c
Show file tree
Hide file tree
Showing 10 changed files with 3,584 additions and 3,112 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ jobs:
# install nodejs
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash
apt install -y nodejs
# enable yearn
# enable pnpm
corepack enable
cargo install tauri-cli
yarn
pnpm install --frozen-lockfile
# --bundles deb
yarn rls
pnpm rls
- name: Upload deb bundle
uses: actions/upload-artifact@v4
with:
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jobs:
sudo apt install libwebkit2gtk-4.0-dev:arm64 -y
sudo apt install libssl-dev:arm64 -y
export PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu/
yarn
yarn rls --target aarch64-unknown-linux-gnu
pnpm install
pnpm rls --target aarch64-unknown-linux-gnu
- name: Upload deb bundle
uses: actions/upload-artifact@v4
with:
Expand All @@ -72,13 +72,17 @@ jobs:
uses: actions/checkout@v4

# build the changelog based on the commit messages between the versioned tags
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Node.js
uses: actions/setup-node@v4
# NOTE: enterprise developers may hard code a version
with:
node-version: 'lts/*'
cache: yarn
cache: pnpm
# node-version-file: '.nvmrc'

- name: Setup Rust
Expand All @@ -98,12 +102,12 @@ jobs:
- name: Install frontend
run: |
yarn --frozen-lockfile
pnpm install
- name: CI Build
if: ${{ github.ref_type == 'branch' }}
run: |
yarn rls
pnpm rls
- name: CI Upload Windows
if: ${{ github.ref_type == 'branch' && matrix.platform == 'windows-latest' }}
Expand Down
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// see https://code.visualstudio.com/docs/editor/tasks#_can-a-background-task-be-used-as-a-prelaunchtask-in-launchjson
"isBackground": true,
// change this to your `beforeDevCommand`:
"command": "yarn",
"command": "pnpm",
"args": [
"start"
]
Expand All @@ -22,7 +22,7 @@
"type": "shell",
"problemMatcher": [], // TODO
// change this to your `beforeBuildCommand`:
"command": "yarn",
"command": "pnpm",
"args": [
"build"
]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ Tauri and React boilerplate for a modern desktop application. Not a project nor
2. Download this repository and rename the folder to YOUR_APP or click "use this template" and clone your new repo that is referred to henceforth as YOUR_APP
3. Open YOUR_APP in an IDE
4. Follow environment instructions in [`SAMPLE_README.md`](./SAMPLE_README.md)
5. While you run `yarn` to install dependencies,
5. While you run `pnpm install` to install dependencies,
- Modify `productName, identifier, title` found in [`src-tauri/tauri.conf.json`](./src-tauri/tauri.conf.json)
- Modify `authors` in [`src-tauri/Cargo.toml`](./src-tauri/Cargo.toml)
- Modify `HEADER_TITLE, FOOTER` found in [`src/utils.js`](./src/utils.js)
- If you didn't click "use this template", remove the `.git` folder and reinitialize your own git repo
- Delete or replace `LICENSE.md` since this template is public domain
- Edit `SAMPLE_README.md` and replace `README.md`
6. Run `yarn dev` to start developing
6. Run `pnpm dev` to start developing
7. Read [Tips and Trouble Shooting](#tips) section of the new `README.md`
8. If any problems arise, open an issue or contact me

Expand Down
32 changes: 16 additions & 16 deletions SAMPLE_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ App description goes here.
2. Open up an elevated command prompt (Windows) or a normal terminal on non-Windows OS
3. Run `nvm install --lts`
4. Run `nvm use lts` (`--lts` on non-Windows)
- Install `yarn` using `corepack enable`
- Run `yarn` to install frontend dependencies
- Install `pnpm` using `corepack enable`
- Run `pnpm install` to install frontend dependencies
- For testing, you need to `cargo install tauri-driver`, [Install Selenium IDE](https://www.selenium.dev/selenium-ide/), and on Windows add [msedgedriver.exe x64](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/) to your Path environment variable.
- A good place to store `msedgedriver.exe` is `C:\Windows` if you have administrative privileges
- If tests are hanging on Windows, you will need to update `msedgedriver.exe` to the latest version
Expand Down Expand Up @@ -43,7 +43,7 @@ you would list some things related to understanding said cryptocurrency.
### App Icons

```sh
yarn tauri icon path\to\image.ext --output .\src-tauri\icons\
pnpm tauri icon path\to\image.ext --output .\src-tauri\icons\
```

This will overwrite images in .\src-tauri\icons so ensure you are using `git`
Expand All @@ -54,7 +54,7 @@ This only applies when your source icon is not an ico.
I suggest keeping source images in the `git` repo.

```sh
yarn tauri icon .\src-tauri\icons\SystemTray1.png --output .\src-tauri\icons\SystemTray1
pnpm tauri icon .\src-tauri\icons\SystemTray1.png --output .\src-tauri\icons\SystemTray1
```

After running this, simply rename the ico file in the new directory and move it one level up.
Expand Down Expand Up @@ -110,7 +110,7 @@ await invoke('command2', {arg: 'two'}).then(msg => console.log(msg));
### How to Upgrade Mantine?

```sh
yarn upgrade --pattern *mantine*
pnpm upgrade --pattern *mantine*
```

### Playing Audio and Video
Expand All @@ -119,32 +119,32 @@ yarn upgrade --pattern *mantine*
## Scripts in `package.json`

### `yarn dev`
### `pnpm dev`

An alias for `yarn tauri dev` which runs `yarn start` and opens a debug enabled window app that renders the frontend
An alias for `pnpm tauri dev` which runs `pnpm start` and opens a debug enabled window app that renders the frontend

### `yarn test`
### `pnpm test`

Run integrated tests using selenium-webdriver on a release build of the application

### `yarn rls`
### `pnpm rls`

An alias for `yarn tauri build` which builds the frontend and bundles it into a Tauri release build
An alias for `pnpm tauri build` which builds the frontend and bundles it into a Tauri release build

### `yarn update`
### `pnpm update`

Upgrades packages/crates in `./packages.json` and `./src-tauri/Cargo.toml`. This will also cleanup rust builds

### `yarn build`
### `pnpm build`

A performance optimized build of the front-end intended for use in production. Output is the `build` folder.

### `yarn start`
### `pnpm start`

Run the app in the development mode ~~and opens [http://localhost:3000](http://localhost:3000) in your browser~~.
The page should reload when you make changes. You may also see lint errors in the console

### `yarn serve`
### `pnpm serve`

Serve `/build` with the global `serve` package

Expand All @@ -155,13 +155,13 @@ See the section about [running tests](https://facebook.github.io/create-react-ap

## Tips and Trouble Shooting

- Slow computer / low storage / Frontend edits only? `yarn start`
- Slow computer / low storage / Frontend edits only? `pnpm start`
- no Tauri API access of course
- Publishing to the web? Edit `package.json`, `index.html`, `manifest.html`
- Don't want to Alt-Tab? Set `alwaysOnTop` to `true` in `tauri.conf.json`
- Broken npm sub-dependency? Use `resolutions: {subDependency: version}`
- Add `"devtools"` to Tauri features in `Cargo.toml` to get devtools in a production build
- If a cookie is not being set from cross-site, add `SameSite: 'lax'` when setting cookies
- Use `cd src-tauri && cargo clean` to fix abnormal bugs or issues
- Windows VSCode `yarn` package installation issues: **close** not reload all VS Code windows and retry
- Windows VSCode `pnpm install` dependency installation issues: **close** not reload all VS Code windows and retry
- Use `npx --yes npm-check-updates` to check which packages to upgrade, check their changelogs, and then perform updates
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@
"scripts": {
"dev": "tauri dev",
"nvmrc": "node -v > .nvmrc",
"postinstall": "yarn nvmrc",
"predev": "yarn nvmrc",
"postinstall": "pnpm nvmrc",
"predev": "pnpm nvmrc",
"tauri": "tauri",
"start": "vite",
"rls": "dotenv-load tauri build",
"build": "vite build",
"preview": "vite preview",
"serve": "vite preview",
"preinstall": "yarn global add sloc @tauri-apps/cli",
"preinstall": "pnpm add -g add sloc @tauri-apps/cli",
"sloc": "sloc src src-tauri/src",
"update": "concurrently \"yarn upgrade \" \"cd src-tauri && cargo update && cargo clean\"",
"update": "concurrently \"pnpm up\" \"cd src-tauri && cargo update && cargo clean\"",
"test": "mocha"
},
"eslintConfig": {
Expand Down
Loading

0 comments on commit 745d02c

Please sign in to comment.