Skip to content

Commit 870702a

Browse files
committed
feat(pack): Switch package manager to bun
1 parent 26a7fd8 commit 870702a

9 files changed

Lines changed: 1030 additions & 4143 deletions

File tree

.github/workflows/build-app.yml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ on:
55
- main
66
paths:
77
- .github/workflows/build-app.yml
8-
- 'apps/app/**'
9-
- 'packages/shared/**'
10-
- 'packages/ui/**'
11-
- 'packages/configs/**'
8+
- "apps/app/**"
9+
- "packages/shared/**"
10+
- "packages/ui/**"
11+
- "packages/configs/**"
1212
pull_request:
1313
branches:
1414
- main
1515
paths:
1616
- .github/workflows/build-app.yml
17-
- 'apps/app/**'
18-
- 'packages/ui/**'
19-
- 'packages/shared/**'
17+
- "apps/app/**"
18+
- "packages/ui/**"
19+
- "packages/shared/**"
2020
workflow_dispatch:
2121

2222
permissions:
@@ -27,35 +27,35 @@ jobs:
2727
strategy:
2828
fail-fast: false
2929
matrix:
30-
platform: [ macos-latest, windows-latest, ubuntu-latest ]
30+
platform: [macos-latest, windows-latest, ubuntu-latest]
3131

3232
runs-on: ${{ matrix.platform }}
3333

3434
steps:
3535
- name: Checkout repository
3636
uses: actions/checkout@v5
3737
with:
38-
submodules: 'true'
38+
submodules: "true"
3939

40-
- name: Install pnpm
41-
uses: pnpm/action-setup@v4
40+
- name: Install bun
41+
uses: oven-sh/setup-bun@v2
4242
with:
4343
run_install: false
4444

4545
- name: Setup node
4646
uses: actions/setup-node@v6
4747
with:
4848
node-version: lts/*
49-
cache: "pnpm"
50-
cache-dependency-path: pnpm-lock.yaml
49+
cache: "bun"
50+
cache-dependency-path: bun.lock
5151

52-
- name: Cache pnpm store
52+
- name: Cache bun store
5353
uses: actions/cache@v4
5454
with:
55-
path: ${{ matrix.platform == 'windows-latest' && '~\\AppData\\Local\\pnpm-store' || '~/.pnpm-store' }}
56-
key: ${{ matrix.platform }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
55+
path: ${{ matrix.platform == 'windows-latest' && '~\\AppData\\Local\\bun-store' || '~/.bun-store' }}
56+
key: ${{ matrix.platform }}-bun-${{ hashFiles('bun.lock') }}
5757
restore-keys: |
58-
${{ matrix.platform }}-pnpm-
58+
${{ matrix.platform }}-bun-
5959
6060
- name: Cache Cargo registry
6161
uses: actions/cache@v4
@@ -71,7 +71,7 @@ jobs:
7171
${{ matrix.platform }}-cargo-
7272
7373
- name: Install NPM dependencies
74-
run: pnpm install --no-frozen-lockfile
74+
run: bun install --no-frozen-lockfile
7575

7676
- name: Install dependencies (ubuntu only)
7777
if: matrix.platform == 'ubuntu-latest'
@@ -82,7 +82,7 @@ jobs:
8282
- name: Build app
8383
env:
8484
IS_ACTION_BUILD: true
85-
run: pnpm app:build
85+
run: bun app:build
8686

8787
- name: Upload Artifacts
8888
uses: actions/upload-artifact@v5
@@ -95,18 +95,17 @@ jobs:
9595
target/release/bundle/*/*.dmg
9696
target/release/bundle/*/*.app.tar.gz
9797
target/release/bundle/*/*.app.tar.gz.sig
98-
98+
9999
target/release/bundle/*/*.AppImage
100100
target/release/bundle/*/*.AppImage.tar.gz
101101
target/release/bundle/*/*.AppImage.tar.gz.sig
102102
target/release/bundle/*/*.deb
103103
target/release/bundle/*/*.rpm
104-
104+
105105
target/release/bundle/msi/*.msi
106106
target/release/bundle/msi/*.msi.zip
107107
target/release/bundle/msi/*.msi.zip.sig
108-
108+
109109
target/release/bundle/nsis/*.exe
110110
target/release/bundle/nsis/*.nsis.zip
111111
target/release/bundle/nsis/*.nsis.zip.sig
112-

.github/workflows/build-web.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,25 @@ jobs:
5454
with:
5555
submodules: 'true'
5656

57-
- name: Install pnpm
58-
uses: pnpm/action-setup@v4
57+
- name: Install bun
58+
uses: oven-sh/setup-bun@v2
5959
with:
6060
run_install: false
6161

6262
- name: Setup node
6363
uses: actions/setup-node@v6
6464
with:
6565
node-version: lts/*
66-
cache: "pnpm"
67-
cache-dependency-path: pnpm-lock.yaml
66+
cache: "bun"
67+
cache-dependency-path: bun.lock
6868

69-
- name: Cache pnpm store
69+
- name: Cache bun store
7070
uses: actions/cache@v4
7171
with:
72-
path: ${{ matrix.platform == 'windows-latest' && '~\\AppData\\Local\\pnpm-store' || '~/.pnpm-store' }}
73-
key: ${{ matrix.platform }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
72+
path: ${{ matrix.platform == 'windows-latest' && '~\\AppData\\Local\\bun-store' || '~/.bun-store' }}
73+
key: ${{ matrix.platform }}-bun-${{ hashFiles('bun.lock') }}
7474
restore-keys: |
75-
${{ matrix.platform }}-pnpm-
75+
${{ matrix.platform }}-bun-
7676
7777
- name: Cache Cargo registry
7878
uses: actions/cache@v4
@@ -88,7 +88,7 @@ jobs:
8888
${{ matrix.platform }}-cargo-
8989
9090
- name: Install NPM dependencies
91-
run: pnpm install --no-frozen-lockfile
91+
run: bun install --no-frozen-lockfile
9292

9393
- name: Install Rust
9494
uses: dtolnay/rust-toolchain@stable
@@ -101,7 +101,7 @@ jobs:
101101
IS_ACTION_BUILD: true
102102
run: |
103103
cd apps/web
104-
pnpm frontend:build
104+
bun frontend:build
105105
cargo build --release --target ${{ matrix.target }}
106106
107107
- name: Strip Binary (macos & ubuntu only)

apps/app/src-tauri/tauri.conf.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"version": "0.1.0",
55
"identifier": "cn.com.mcsl.future.tauri",
66
"build": {
7-
"beforeDevCommand": "pnpm frontend:dev",
7+
"beforeDevCommand": "bun frontend:dev",
88
"devUrl": "http://localhost:3001/",
9-
"beforeBuildCommand": "pnpm frontend:build",
9+
"beforeBuildCommand": "bun frontend:build",
1010
"frontendDist": "../dist"
1111
},
1212
"app": {

apps/web/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# 构建阶段 - 前端构建
22
FROM node:18-alpine AS frontend-builder
33

4-
RUN npm install -g pnpm
4+
RUN npm install -g bun
55

66
WORKDIR /app
77

88
COPY . .
99

10-
RUN pnpm install --frozen-lockfile
10+
RUN bun install --frozen-lockfile
1111

1212
WORKDIR apps/web
1313

14-
RUN pnpm frontend:build
14+
RUN bun run frontend:build
1515

1616
# 构建阶段 - Rust后端构建
1717
FROM rust:alpine AS backend-builder
@@ -52,4 +52,4 @@ EXPOSE 11451
5252
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
5353
CMD curl -f http://localhost:11451/api/ || exit 1
5454

55-
CMD ["/app/mcsl_future_web"]
55+
CMD ["/app/mcsl_future_web"]

apps/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "0.1.0",
55
"type": "module",
66
"scripts": {
7-
"build": "pnpm frontend:build && cargo build --release",
7+
"build": "bun frontend:build && cargo build --release",
88
"build:docker": "cd ../../; docker build -f apps/web/Dockerfile --progress=plain -t mcsl-future-web .; cd -",
99
"backend:dev": "cargo run",
1010
"frontend:dev": "rsbuild dev",

0 commit comments

Comments
 (0)