Skip to content

Commit 451063a

Browse files
committed
fix(ci): pin packageManager to a published bun version; consolidate to vp run tasks
Task 1: vp install --frozen-lockfile failed in CI with "error: Package manager bun@1.4.0 not found on https://registry.npmjs.org/@oven/bun-linux-x64/-/bun-linux-x64-1.4.0.tgz". package.json's packageManager field pinned bun@1.4.0, a version that does not exist on the npm registry mirror vp uses to fetch a pinned package manager (latest published there is 1.3.14). The bun.lock lockfileVersion (1) only requires bun >= 1.2, so pin packageManager to bun@1.3.14 instead. Reproduced the exact failure locally with the same vp 0.2.4 binary and confirmed the fix resolves it. Task 2: collapse the two parallel invocation paths (package.json scripts run via `bun run`, and a handful of vite.config.ts `tasks` that just re-wrapped those scripts via `bun run`) into one entrypoint. vite.config.ts `run.tasks` is now the single source of truth for all 17 project commands (typecheck, test, check, docs:dev/build/preview, book:assemble, book:manifest, book:candidate:prepare/en/zh-TW/all/validate, book:legacy:en/zh-TW/all/validate), each command copied verbatim from the former package.json scripts. package.json's `scripts` block is removed entirely (vp itself now rejects a task/script name collision, confirming vp run tasks alone are sufficient in this pinned CI environment). .github/workflows/main.yml now invokes every task exclusively via `vp run <task>` (including bare `bun scripts/book/*.ts <locale>` calls, replaced with matrix-driven `vp run book:candidate:${{ matrix.locale }}` / `book:legacy:${{ matrix.locale }}`). Task caching is disabled at the run level since these commands depend on untracked env vars (BOOK_DATE, OUTPUT_ROOT, SOURCE_REVISION, etc.) and must always execute, matching prior behavior exactly. No changes to Docker/Pandoc/XeLaTeX legacy renderer internals, the release-gating graph, or the EXPECTED_SOURCE_REVISION guard.
1 parent b7544d9 commit 451063a

3 files changed

Lines changed: 29 additions & 31 deletions

File tree

.github/workflows/main.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Install dependencies (frozen)
3232
run: vp install --frozen-lockfile
3333
- name: Verify
34-
run: bun run check
34+
run: vp run check
3535

3636
docs:
3737
runs-on: ubuntu-latest
@@ -51,7 +51,7 @@ jobs:
5151
run: vp install --frozen-lockfile
5252

5353
- name: Build docs
54-
run: bun run docs:build
54+
run: vp run docs:build
5555

5656
- name: Configure Pages
5757
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'pluralitybook'
@@ -87,7 +87,7 @@ jobs:
8787
echo "SOURCE_REVISION=${{ github.sha }}" >> $GITHUB_ENV
8888
8989
- name: Assemble book & manifest
90-
run: bun run book:assemble
90+
run: vp run book:assemble
9191

9292
- name: Upload Manifest and Manuscripts
9393
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
@@ -124,7 +124,7 @@ jobs:
124124
echo "SOURCE_REVISION=${{ github.sha }}" >> $GITHUB_ENV
125125
126126
- name: Render legacy output
127-
run: bun scripts/book/render-legacy.ts ${{ matrix.locale }}
127+
run: vp run book:legacy:${{ matrix.locale }}
128128

129129
- name: Upload legacy artifact
130130
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
@@ -165,7 +165,7 @@ jobs:
165165
- name: Validate legacy outputs
166166
env:
167167
EXPECTED_SOURCE_REVISION: ${{ github.sha }}
168-
run: bun run book:legacy:validate
168+
run: vp run book:legacy:validate
169169

170170
candidate:
171171
runs-on: ubuntu-latest
@@ -197,7 +197,7 @@ jobs:
197197
echo "SOURCE_REVISION=${{ github.sha }}" >> $GITHUB_ENV
198198
199199
- name: Render candidate output
200-
run: bun scripts/book/render-candidate.ts ${{ matrix.locale }}
200+
run: vp run book:candidate:${{ matrix.locale }}
201201

202202
- name: Upload candidate artifact
203203
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
@@ -237,7 +237,7 @@ jobs:
237237
- name: Validate candidate outputs
238238
env:
239239
EXPECTED_SOURCE_REVISION: ${{ github.sha }}
240-
run: bun run book:candidate:validate
240+
run: vp run book:candidate:validate
241241

242242
# NOTE: The GitHub Pages build/deployment source must be switched from the legacy "gh-pages" branch
243243
# to "GitHub Actions" in the repository settings ONLY after this workflow has run successfully and is green.

package.json

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,7 @@
11
{
22
"name": "plurality-book",
33
"private": true,
4-
"packageManager": "bun@1.4.0",
5-
"scripts": {
6-
"test": "vitest run",
7-
"docs:dev": "vitepress dev docs",
8-
"docs:build": "vitepress build docs",
9-
"docs:preview": "vitepress preview docs",
10-
"typecheck": "tsc --noEmit",
11-
"check": "bun run typecheck && bun run test",
12-
"book:assemble": "bun scripts/book/build.ts all dist/publication",
13-
"book:manifest": "bun scripts/book/manifest.ts dist/publication",
14-
"book:candidate:prepare": "bun scripts/book/prepare-vivliostyle.ts",
15-
"book:candidate:en": "bun scripts/book/render-candidate.ts en",
16-
"book:candidate:zh-TW": "bun scripts/book/render-candidate.ts zh-TW",
17-
"book:candidate:all": "bun scripts/book/render-candidate.ts all",
18-
"book:candidate:validate": "bun scripts/book/validate-candidate.ts dist/publication",
19-
"book:legacy:en": "bun scripts/book/render-legacy.ts en",
20-
"book:legacy:zh-TW": "bun scripts/book/render-legacy.ts zh-TW",
21-
"book:legacy:all": "bun scripts/book/render-legacy.ts all",
22-
"book:legacy:validate": "bun scripts/book/validate-legacy.ts dist/publication"
23-
},
4+
"packageManager": "bun@1.3.14",
245
"devDependencies": {
256
"@types/adm-zip": "0.5.5",
267
"@types/bun": "1.1.18",

vite.config.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,28 @@ import { defineConfig } from 'vite-plus'
22

33
export default defineConfig({
44
run: {
5+
// Task outputs depend on env vars (BOOK_DATE, OUTPUT_ROOT, SOURCE_REVISION, ...) that
6+
// aren't tracked as cache inputs, so caching is disabled to preserve the plain
7+
// "always execute" semantics the previous package.json scripts had.
8+
cache: false,
59
tasks: {
6-
'vp:docs:build': { command: 'bun run docs:build' },
7-
'vp:check': { command: 'bun run check' },
8-
'vp:book': { command: 'bun run book:candidate:all' },
9-
'vp:book:legacy': { command: 'bun run book:legacy:all' },
10+
typecheck: { command: 'tsc --noEmit' },
11+
test: { command: 'vitest run' },
12+
check: { command: ['tsc --noEmit', 'vitest run'] },
13+
'docs:dev': { command: 'vitepress dev docs' },
14+
'docs:build': { command: 'vitepress build docs' },
15+
'docs:preview': { command: 'vitepress preview docs' },
16+
'book:assemble': { command: 'bun scripts/book/build.ts all dist/publication' },
17+
'book:manifest': { command: 'bun scripts/book/manifest.ts dist/publication' },
18+
'book:candidate:prepare': { command: 'bun scripts/book/prepare-vivliostyle.ts' },
19+
'book:candidate:en': { command: 'bun scripts/book/render-candidate.ts en' },
20+
'book:candidate:zh-TW': { command: 'bun scripts/book/render-candidate.ts zh-TW' },
21+
'book:candidate:all': { command: 'bun scripts/book/render-candidate.ts all' },
22+
'book:candidate:validate': { command: 'bun scripts/book/validate-candidate.ts dist/publication' },
23+
'book:legacy:en': { command: 'bun scripts/book/render-legacy.ts en' },
24+
'book:legacy:zh-TW': { command: 'bun scripts/book/render-legacy.ts zh-TW' },
25+
'book:legacy:all': { command: 'bun scripts/book/render-legacy.ts all' },
26+
'book:legacy:validate': { command: 'bun scripts/book/validate-legacy.ts dist/publication' },
1027
},
1128
},
1229
})

0 commit comments

Comments
 (0)