fix(outbox) : resolve server-only imports in worker
This commit is contained in:
@@ -12,6 +12,7 @@ WORKDIR /app
|
|||||||
COPY . .
|
COPY . .
|
||||||
RUN bun build scripts/outbox-worker.ts \
|
RUN bun build scripts/outbox-worker.ts \
|
||||||
--target=bun \
|
--target=bun \
|
||||||
|
--conditions=react-server \
|
||||||
--minify \
|
--minify \
|
||||||
--outfile=dist/outbox-worker.js && \
|
--outfile=dist/outbox-worker.js && \
|
||||||
bun build backend/discord.ts \
|
bun build backend/discord.ts \
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
"db:studio": "drizzle-kit studio",
|
"db:studio": "drizzle-kit studio",
|
||||||
"import:guides": "bun scripts/import-google-guides.ts",
|
"import:guides": "bun scripts/import-google-guides.ts",
|
||||||
"worker:discord": "bun backend/discord.ts",
|
"worker:discord": "bun backend/discord.ts",
|
||||||
"worker:outbox": "bun scripts/outbox-worker.ts",
|
"worker:outbox": "bun --conditions=react-server scripts/outbox-worker.ts",
|
||||||
"security:audit": "bun scripts/security-audit.ts"
|
"security:audit": "bun scripts/security-audit.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -102,12 +102,23 @@ describe("production deployment contract", () => {
|
|||||||
"ENV NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID=${NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID}",
|
"ENV NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID=${NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID}",
|
||||||
);
|
);
|
||||||
expect(dockerfile).toContain("backend/discord.ts");
|
expect(dockerfile).toContain("backend/discord.ts");
|
||||||
|
expect(dockerfile).toMatch(
|
||||||
|
/bun build scripts\/outbox-worker\.ts[\s\S]*?--conditions=react-server[\s\S]*?--outfile=dist\/outbox-worker\.js/u,
|
||||||
|
);
|
||||||
expect(dockerfile).toMatch(
|
expect(dockerfile).toMatch(
|
||||||
/bun build backend\/discord\.ts[\s\S]*?--conditions=react-server[\s\S]*?--outfile=dist\/discord\.js/u,
|
/bun build backend\/discord\.ts[\s\S]*?--conditions=react-server[\s\S]*?--outfile=dist\/discord\.js/u,
|
||||||
);
|
);
|
||||||
expect(dockerfile).toContain("./worker/discord.js");
|
expect(dockerfile).toContain("./worker/discord.js");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("runs the outbox worker with server-only module resolution locally", async () => {
|
||||||
|
const packageJson = JSON.parse(await repositoryFile("package.json"));
|
||||||
|
|
||||||
|
expect(packageJson.scripts["worker:outbox"]).toBe(
|
||||||
|
"bun --conditions=react-server scripts/outbox-worker.ts",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it("verifies first, publishes immutable images, and migrates before rollout", async () => {
|
it("verifies first, publishes immutable images, and migrates before rollout", async () => {
|
||||||
const workflow = await repositoryFile(".gitea/workflows/ci.yml");
|
const workflow = await repositoryFile(".gitea/workflows/ci.yml");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user