From 5fa5b2f6843f62f7260627397646213863cd0725 Mon Sep 17 00:00:00 2001 From: Eyejoker Date: Fri, 29 May 2026 23:52:32 +0900 Subject: [PATCH] fix: refresh root deps during deploy Add a root bun install after git pull so file: dependencies are refreshed before build and runtime verification. --- package.json | 2 +- src/deploy-script.test.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/deploy-script.test.ts diff --git a/package.json b/package.json index 0438aac..6c16267 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "build:all": "bun run build && bun run dashboard:build && bun run build:runners", "build:runtime": "bun run build:all", "verify:dist": "bash scripts/check-dist-fresh.sh", - "deploy": "git pull --ff-only && bun run build:all && bun run verify:dist && bun setup/index.ts --step migrate-room-registrations && systemctl --user restart ejclaw", + "deploy": "git pull --ff-only && bun install --frozen-lockfile && bun run build:all && bun run verify:dist && bun setup/index.ts --step migrate-room-registrations && systemctl --user restart ejclaw", "start": "bun dist/index.js", "dev": "bun --watch src/index.ts", "test": "vitest run", diff --git a/src/deploy-script.test.ts b/src/deploy-script.test.ts new file mode 100644 index 0000000..b05110f --- /dev/null +++ b/src/deploy-script.test.ts @@ -0,0 +1,27 @@ +import fs from 'fs'; +import path from 'path'; +import { describe, expect, it } from 'vitest'; + +type PackageJson = { + scripts?: Record; +}; + +describe('deploy script', () => { + it('refreshes root file dependencies after pulling before building', () => { + const packageJson = JSON.parse( + fs.readFileSync( + path.resolve(import.meta.dirname, '../package.json'), + 'utf8', + ), + ) as PackageJson; + + const deploy = packageJson.scripts?.deploy ?? ''; + const pullIndex = deploy.indexOf('git pull --ff-only'); + const rootInstallIndex = deploy.indexOf('bun install --frozen-lockfile'); + const buildIndex = deploy.indexOf('bun run build:all'); + + expect(pullIndex).toBeGreaterThanOrEqual(0); + expect(rootInstallIndex).toBeGreaterThan(pullIndex); + expect(rootInstallIndex).toBeLessThan(buildIndex); + }); +});