use pnpm for Desktop Electron App (#7679)

This commit is contained in:
Lifei Zhou
2026-03-11 08:46:05 -04:00
committed by GitHub
parent a28c306b23
commit 02bc7ed745
20 changed files with 13856 additions and 21417 deletions
+7 -7
View File
@@ -60,17 +60,17 @@
- `just check-openapi-schema` - OpenAPI schema validation
**Desktop app checks:**
- `npm ci` - Fresh dependency install (in `ui/desktop/`)
- `npm run lint:check` - ESLint + Prettier
- `npm run test:run` - Vitest tests
- `pnpm install --frozen-lockfile` - Fresh dependency install (in `ui/desktop/`)
- `pnpm run lint:check` - ESLint + Prettier
- `pnpm run test:run` - Vitest tests
**Setup steps CI performs:**
- Installs system dependencies (libdbus, gnome-keyring, libxcb)
- Activates hermit environment (`source bin/activate-hermit`)
- Caches Cargo and npm dependencies
- Runs `npm ci` before any npm scripts (ensures all packages are installed)
- Caches Cargo and pnpm dependencies
- Runs `pnpm install --frozen-lockfile` before any pnpm scripts (ensures all packages are installed)
**Key insight**: Commands like `npx` check local `node_modules` first, which CI installs via `npm ci`. Don't flag these as broken unless you can explain why CI setup wouldn't handle it.
**Key insight**: Commands like `npx` check local `node_modules` first, which CI installs via `pnpm install --frozen-lockfile`. Don't flag these as broken unless you can explain why CI setup wouldn't handle it.
## Skip These (Low Value)
@@ -78,7 +78,7 @@ Do not comment on:
- **Style/formatting** - CI handles this (rustfmt, prettier)
- **Clippy warnings** - CI handles this (clippy)
- **Test failures** - CI handles this (full test suite)
- **Missing dependencies** - CI handles this (npm ci will fail)
- **Missing dependencies** - CI handles this (pnpm install will fail)
- **Minor naming suggestions** - unless truly confusing
- **Suggestions to add comments** - for self-documenting code
- **Refactoring suggestions** - unless there's a clear bug or maintainability issue
+7 -7
View File
@@ -60,7 +60,7 @@ jobs:
# Update version in package.json
source ./bin/activate-hermit
cd ui/desktop
npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version
pnpm version ${{ inputs.version }} --no-git-tag-version --allow-same-version
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
@@ -94,18 +94,18 @@ jobs:
run: |
cp target/x86_64-apple-darwin/release/goosed ui/desktop/src/bin/goosed
- name: Cache npm dependencies
- name: Cache pnpm dependencies
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
path: |
ui/desktop/node_modules
.hermit/node/cache
key: intel-npm-cache-v1-${{ runner.os }}-${{ hashFiles('ui/desktop/package-lock.json') }}
key: intel-pnpm-cache-v1-${{ runner.os }}-${{ hashFiles('ui/desktop/pnpm-lock.yaml') }}
restore-keys: |
intel-npm-cache-v1-${{ runner.os }}-
intel-pnpm-cache-v1-${{ runner.os }}-
- name: Install dependencies
run: source ../../bin/activate-hermit && npm ci
run: source ../../bin/activate-hermit && pnpm install --frozen-lockfile
working-directory: ui/desktop
# Configure Electron builder for Intel architecture
@@ -125,7 +125,7 @@ jobs:
attempt=0
max_attempts=2
until [ $attempt -ge $max_attempts ]; do
npm run bundle:intel && break
pnpm run bundle:intel && break
attempt=$((attempt + 1))
echo "Attempt $attempt failed. Retrying..."
sleep 5
+8 -7
View File
@@ -37,8 +37,9 @@ jobs:
rm -f Cargo.toml.bak
# Update version in package.json
source ./bin/activate-hermit
cd ui/desktop
npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version
pnpm version ${{ inputs.version }} --no-git-tag-version --allow-same-version
- name: Debug workflow info
env:
@@ -120,21 +121,21 @@ jobs:
chmod +x ui/desktop/src/bin/goosed
ls -la ui/desktop/src/bin/
- name: Cache npm dependencies
- name: Cache pnpm dependencies
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
path: |
ui/desktop/node_modules
.hermit/node/cache
key: linux-npm-cache-v1-${{ runner.os }}-${{ hashFiles('ui/desktop/package-lock.json') }}
key: linux-pnpm-cache-v1-${{ runner.os }}-${{ hashFiles('ui/desktop/pnpm-lock.yaml') }}
restore-keys: |
linux-npm-cache-v1-${{ runner.os }}-
linux-pnpm-cache-v1-${{ runner.os }}-
- name: Install npm dependencies
- name: Install pnpm dependencies
run: |
source ./bin/activate-hermit
cd ui/desktop
npm ci
pnpm install --frozen-lockfile
# Verify installation
ls -la node_modules/.bin/ | head -5
@@ -145,7 +146,7 @@ jobs:
echo "Building Linux packages (.deb, .rpm, and .flatpak)..."
# Build all configured packages
npm run make -- --platform=linux --arch=x64
pnpm run make -- --platform=linux --arch=x64
echo "Build completed. Checking output..."
ls -la out/
+8 -5
View File
@@ -55,6 +55,9 @@ jobs:
with:
node-version: 24.10.0
- name: Install pnpm
run: npm install -g pnpm@10.30.3
- name: Cache node_modules
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
@@ -62,9 +65,9 @@ jobs:
node_modules
ui/desktop/node_modules
.hermit/node/cache
key: windows-npm-cache-v1-${{ runner.os }}-node24-${{ hashFiles('**/package-lock.json') }}
key: windows-pnpm-cache-v1-${{ runner.os }}-node24-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
windows-npm-cache-v1-${{ runner.os }}-node24-
windows-pnpm-cache-v1-${{ runner.os }}-node24-
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
@@ -130,17 +133,17 @@ jobs:
git config --global url."https://github.com/".insteadOf "git@github.com:"
git config --global url."https://github.com/".insteadOf "git+ssh://git@github.com/"
- name: Build desktop UI with npm
- name: Build desktop UI with pnpm
shell: bash
env:
ELECTRON_PLATFORM: win32
run: |
cd ui/desktop
npm ci
pnpm install --frozen-lockfile
node scripts/build-main.js
node scripts/prepare-platform-binaries.js
npm run make -- --platform=win32 --arch=x64
pnpm run make -- --platform=win32 --arch=x64
- name: Copy exe to final out folder and prepare flat distribution
shell: bash
+6 -6
View File
@@ -105,7 +105,7 @@ jobs:
source ./bin/activate-hermit
# Update version in package.json
cd ui/desktop
npm version "${VERSION}" --no-git-tag-version --allow-same-version
pnpm version "${VERSION}" --no-git-tag-version --allow-same-version
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
@@ -131,18 +131,18 @@ jobs:
run: |
cp target/release/goosed ui/desktop/src/bin/goosed
- name: Cache npm dependencies
- name: Cache pnpm dependencies
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
path: |
ui/desktop/node_modules
.hermit/node/cache
key: macos-npm-cache-v1-${{ runner.os }}-${{ hashFiles('ui/desktop/package-lock.json') }}
key: macos-pnpm-cache-v1-${{ runner.os }}-${{ hashFiles('ui/desktop/pnpm-lock.yaml') }}
restore-keys: |
macos-npm-cache-v1-${{ runner.os }}-
macos-pnpm-cache-v1-${{ runner.os }}-
- name: Install dependencies
run: source ../../bin/activate-hermit && npm ci
run: source ../../bin/activate-hermit && pnpm install --frozen-lockfile
working-directory: ui/desktop
# Check disk space before bundling
@@ -155,7 +155,7 @@ jobs:
attempt=0
max_attempts=2
until [ $attempt -ge $max_attempts ]; do
npm run bundle:default && break
pnpm run bundle:default && break
attempt=$((attempt + 1))
echo "Attempt $attempt failed. Retrying..."
sleep 5
+7 -11
View File
@@ -120,7 +120,7 @@ jobs:
uses: Swatinem/rust-cache@v2
- name: Install Node.js Dependencies for OpenAPI Check
run: source ../../bin/activate-hermit && npm ci
run: source ../../bin/activate-hermit && pnpm install --frozen-lockfile
working-directory: ui/desktop
- name: Check OpenAPI Schema is Up-to-Date
@@ -141,28 +141,24 @@ jobs:
# Temporarily disabled due to GitHub Actions bug on macOS runners
# https://github.com/actions/runner-images/issues/13341
# https://github.com/actions/runner/issues/4134
# - name: Cache npm dependencies
# - name: Cache pnpm dependencies
# uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
# with:
# path: |
# ui/desktop/node_modules
# .hermit/node/cache
# key: ci-npm-cache-v1-${{ runner.os }}-${{ hashFiles('ui/desktop/package-lock.json') }}
# key: ci-pnpm-cache-v1-${{ runner.os }}-${{ hashFiles('ui/desktop/pnpm-lock.yaml') }}
# restore-keys: |
# ci-npm-cache-v1-${{ runner.os }}-
- name: Check lockfile has cross-platform entries
run: ./scripts/check-lockfile-platforms.sh
working-directory: ui/desktop
# ci-pnpm-cache-v1-${{ runner.os }}-
- name: Install Dependencies
run: source ../../bin/activate-hermit && npm ci
run: source ../../bin/activate-hermit && pnpm install --frozen-lockfile
working-directory: ui/desktop
- name: Run Lint
run: source ../../bin/activate-hermit && npm run lint:check
run: source ../../bin/activate-hermit && pnpm run lint:check
working-directory: ui/desktop
- name: Run Tests
run: source ../../bin/activate-hermit && npm run test:run
run: source ../../bin/activate-hermit && pnpm run test:run
working-directory: ui/desktop
+2 -2
View File
@@ -267,7 +267,7 @@ jobs:
run: chmod +x target/debug/goosed
- name: Install Node.js Dependencies
run: source ../../bin/activate-hermit && npm ci
run: source ../../bin/activate-hermit && pnpm install --frozen-lockfile
working-directory: ui/desktop
- name: Run Integration Tests
@@ -279,5 +279,5 @@ jobs:
SHELL: /bin/bash
run: |
echo 'export PATH=/some/fake/path:$PATH' >> $HOME/.bash_profile
source ../../bin/activate-hermit && npm run test:integration:debug
source ../../bin/activate-hermit && pnpm run test:integration:debug
working-directory: ui/desktop