From b4fbf06615001c1e47287f6b39271cf1fb004909 Mon Sep 17 00:00:00 2001 From: Ltcc0 <3381983963@qq.com> Date: Sat, 25 Jul 2026 21:38:34 +0800 Subject: [PATCH] fix: redeploy Railway services for shared package changes --- railway.api.toml | 9 +++++++ railway.wechat.toml | 9 +++++++ railway.worker.toml | 9 +++++++ scripts/railway-config.test.mjs | 43 +++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 scripts/railway-config.test.mjs diff --git a/railway.api.toml b/railway.api.toml index 2db5f6e..5618df6 100644 --- a/railway.api.toml +++ b/railway.api.toml @@ -1,6 +1,15 @@ [build] builder = "NIXPACKS" buildCommand = "corepack pnpm install --frozen-lockfile && corepack pnpm --filter @tomeet/api... typecheck" +watchPatterns = [ + "/apps/api/**", + "/packages/**", + "/package.json", + "/pnpm-lock.yaml", + "/pnpm-workspace.yaml", + "/tsconfig.base.json", + "/railway.api.toml", +] [deploy] startCommand = "corepack pnpm --filter @tomeet/api start" diff --git a/railway.wechat.toml b/railway.wechat.toml index 1b0eb68..0ede631 100644 --- a/railway.wechat.toml +++ b/railway.wechat.toml @@ -1,6 +1,15 @@ [build] builder = "RAILPACK" buildCommand = "corepack enable && pnpm install --frozen-lockfile" +watchPatterns = [ + "/apps/wechat-ilink-worker/**", + "/packages/**", + "/package.json", + "/pnpm-lock.yaml", + "/pnpm-workspace.yaml", + "/tsconfig.base.json", + "/railway.wechat.toml", +] [deploy] startCommand = "pnpm --filter @tomeet/wechat-ilink-worker start" diff --git a/railway.worker.toml b/railway.worker.toml index a2c99fa..df6391c 100644 --- a/railway.worker.toml +++ b/railway.worker.toml @@ -1,6 +1,15 @@ [build] builder = "NIXPACKS" buildCommand = "corepack pnpm install --frozen-lockfile && corepack pnpm --filter @tomeet/intelligence-worker... typecheck" +watchPatterns = [ + "/apps/intelligence-worker/**", + "/packages/**", + "/package.json", + "/pnpm-lock.yaml", + "/pnpm-workspace.yaml", + "/tsconfig.base.json", + "/railway.worker.toml", +] [deploy] startCommand = "corepack pnpm --filter @tomeet/intelligence-worker start" diff --git a/scripts/railway-config.test.mjs b/scripts/railway-config.test.mjs new file mode 100644 index 0000000..c666847 --- /dev/null +++ b/scripts/railway-config.test.mjs @@ -0,0 +1,43 @@ +import assert from "node:assert/strict"; +import { readFile } from "node:fs/promises"; +import test from "node:test"; + +const sharedWatchPatterns = [ + "/packages/**", + "/package.json", + "/pnpm-lock.yaml", + "/pnpm-workspace.yaml", + "/tsconfig.base.json" +]; + +const configs = [ + { + file: "railway.api.toml", + appPattern: "/apps/api/**" + }, + { + file: "railway.worker.toml", + appPattern: "/apps/intelligence-worker/**" + }, + { + file: "railway.wechat.toml", + appPattern: "/apps/wechat-ilink-worker/**" + } +]; + +function readStringArray(source, key) { + const match = source.match(new RegExp(`^${key}\\s*=\\s*\\[([\\s\\S]*?)\\]`, "mu")); + assert.ok(match, `${key} must be configured`); + return [...match[1].matchAll(/"([^"]+)"/gu)].map((entry) => entry[1]); +} + +test("Railway services redeploy for shared workspace changes", async () => { + for (const config of configs) { + const source = await readFile(new URL(`../${config.file}`, import.meta.url), "utf8"); + assert.deepEqual(readStringArray(source, "watchPatterns"), [ + config.appPattern, + ...sharedWatchPatterns, + `/${config.file}` + ]); + } +});