Skip to content

Commit 75ec4ac

Browse files
committed
v3: postInstall config option now replaces the postinstall script found in package.json
1 parent 374b6b9 commit 75ec4ac

File tree

6 files changed

+9
-22
lines changed

6 files changed

+9
-22
lines changed

.changeset/tame-apricots-clap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
v3: postInstall config option now replaces the postinstall script found in package.json

packages/cli-v3/e2e/createContainerFile.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { readFileSync } from "node:fs";
22
import { writeFile } from "node:fs/promises";
33
import { join, resolve } from "node:path";
4-
import { cliRootPath } from "../src/utilities/resolveInternalFilePath";
54
import { ReadConfigResult } from "../src/utilities/configFiles";
65

76
type CreateContainerFileOptions = {
@@ -25,14 +24,5 @@ export async function createContainerFile(options: CreateContainerFileOptions) {
2524

2625
let containerFileContents = readFileSync(containerFilePath, "utf-8");
2726

28-
if (config.postInstall) {
29-
containerFileContents = containerFileContents.replace(
30-
"__POST_INSTALL__",
31-
`RUN ${config.postInstall}`
32-
);
33-
} else {
34-
containerFileContents = containerFileContents.replace("__POST_INSTALL__", "");
35-
}
36-
3727
await writeFile(join(tempDir, "Containerfile"), containerFileContents);
3828
}

packages/cli-v3/src/Containerfile.prod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ COPY --chown=node:node . .
3434
USER node
3535
RUN npm ci --no-fund --no-audit && npm cache clean --force
3636

37-
__POST_INSTALL__
38-
3937
# Development or production stage builds upon the base stage
4038
FROM base AS final
4139

packages/cli-v3/src/commands/deploy.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,7 @@ async function compileProject(
13231323
dependencies,
13241324
scripts: {
13251325
...javascriptProject.scripts,
1326+
...(typeof config.postInstall === "string" ? { postinstall: config.postInstall } : {}),
13261327
},
13271328
};
13281329

@@ -1364,15 +1365,6 @@ async function compileProject(
13641365

13651366
let containerFileContents = readFileSync(containerFilePath, "utf-8");
13661367

1367-
if (config.postInstall) {
1368-
containerFileContents = containerFileContents.replace(
1369-
"__POST_INSTALL__",
1370-
`RUN ${config.postInstall}`
1371-
);
1372-
} else {
1373-
containerFileContents = containerFileContents.replace("__POST_INSTALL__", "");
1374-
}
1375-
13761368
await writeFile(join(tempDir, "Containerfile"), containerFileContents);
13771369

13781370
const contentHasher = createHash("sha256");

references/v3-catalog/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"queues": "ts-node -r tsconfig-paths/register ./src/queues.ts",
99
"build:client": "tsup-node ./src/clientUsage.ts --format esm,cjs",
1010
"client": "ts-node -r dotenv/config -r tsconfig-paths/register ./src/clientUsage.ts",
11-
"triggerWithLargePayload": "ts-node -r dotenv/config -r tsconfig-paths/register ./src/triggerWithLargePayload.ts"
11+
"triggerWithLargePayload": "ts-node -r dotenv/config -r tsconfig-paths/register ./src/triggerWithLargePayload.ts",
12+
"postinstall": "echo 'package.json postinstall'"
1213
},
1314
"dependencies": {
1415
"@ffmpeg-installer/ffmpeg": "^1.1.0",

references/v3-catalog/trigger.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export const config: TriggerConfig = {
5151
dependenciesToBundle: [/@sindresorhus/, "escape-string-regexp", /@t3-oss/],
5252
instrumentations: [new OpenAIInstrumentation()],
5353
logLevel: "info",
54+
postInstall: "echo '========== config.postInstall'",
5455
onStart: async (payload, { ctx }) => {
5556
if (ctx.organization.id === "clsylhs0v0002dyx75xx4pod1") {
5657
console.log("Initializing the app data source");

0 commit comments

Comments
 (0)