trigger.dev 3.0.0-beta.5 → 3.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Containerfile.prod +10 -2
- package/dist/index.js +96 -19
- package/dist/index.js.map +1 -1
- package/dist/templates/trigger.config.ts.template +1 -1
- package/dist/workers/dev/worker-facade.js +1 -1
- package/dist/workers/prod/entry-point.js +21 -20
- package/dist/workers/prod/worker-facade.js +1 -1
- package/package.json +4 -5
package/dist/Containerfile.prod
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
FROM node:20-
|
|
1
|
+
FROM node:20-bookworm-slim@sha256:d4cdfc305abe5ea78da7167bf78263c22596dc332f2654b662890777ea166224 AS base
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
|
4
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
5
|
+
busybox \
|
|
6
|
+
dumb-init \
|
|
7
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
4
8
|
|
|
9
|
+
# Create and set workdir with appropriate permissions
|
|
10
|
+
RUN mkdir /app && chown node:node /app
|
|
5
11
|
WORKDIR /app
|
|
6
12
|
|
|
7
13
|
# copy all the files just in case anything is needed in postinstall
|
|
8
14
|
COPY --chown=node:node . .
|
|
15
|
+
|
|
16
|
+
USER node
|
|
9
17
|
RUN npm ci --no-fund --no-audit && npm cache clean --force
|
|
10
18
|
|
|
11
19
|
# Development or production stage builds upon the base stage
|
package/dist/index.js
CHANGED
|
@@ -801,7 +801,7 @@ import invariant from "tiny-invariant";
|
|
|
801
801
|
import { z as z4 } from "zod";
|
|
802
802
|
|
|
803
803
|
// package.json
|
|
804
|
-
var version = "3.0.0-beta.
|
|
804
|
+
var version = "3.0.0-beta.7";
|
|
805
805
|
var dependencies = {
|
|
806
806
|
"@clack/prompts": "^0.7.0",
|
|
807
807
|
"@depot/cli": "0.0.1-cli.2.55.0",
|
|
@@ -817,7 +817,7 @@ var dependencies = {
|
|
|
817
817
|
"@opentelemetry/sdk-trace-base": "^1.22.0",
|
|
818
818
|
"@opentelemetry/sdk-trace-node": "^1.22.0",
|
|
819
819
|
"@opentelemetry/semantic-conventions": "^1.22.0",
|
|
820
|
-
"@trigger.dev/core": "workspace:^3.0.0-beta.
|
|
820
|
+
"@trigger.dev/core": "workspace:^3.0.0-beta.6",
|
|
821
821
|
"@types/degit": "^2.8.3",
|
|
822
822
|
chalk: "^5.2.0",
|
|
823
823
|
chokidar: "^3.5.3",
|
|
@@ -851,7 +851,6 @@ var dependencies = {
|
|
|
851
851
|
"simple-git": "^3.19.0",
|
|
852
852
|
"socket.io-client": "^4.7.4",
|
|
853
853
|
"source-map-support": "^0.5.21",
|
|
854
|
-
"supports-color": "^9.4.0",
|
|
855
854
|
"terminal-link": "^3.0.0",
|
|
856
855
|
"tiny-invariant": "^1.2.0",
|
|
857
856
|
"tsconfig-paths": "^4.2.0",
|
|
@@ -895,7 +894,7 @@ var package_default = {
|
|
|
895
894
|
type: "module",
|
|
896
895
|
exports: "./dist/index.js",
|
|
897
896
|
bin: {
|
|
898
|
-
|
|
897
|
+
triggerdev: "./dist/index.js"
|
|
899
898
|
},
|
|
900
899
|
devDependencies: {
|
|
901
900
|
"@trigger.dev/core-apps": "workspace:*",
|
|
@@ -1694,7 +1693,6 @@ async function normalizeConfig(config) {
|
|
|
1694
1693
|
// src/utilities/initialBanner.ts
|
|
1695
1694
|
import { spinner } from "@clack/prompts";
|
|
1696
1695
|
import chalk3 from "chalk";
|
|
1697
|
-
import supportsColor from "supports-color";
|
|
1698
1696
|
import checkForUpdate from "update-check";
|
|
1699
1697
|
|
|
1700
1698
|
// src/utilities/getVersion.ts
|
|
@@ -1743,7 +1741,7 @@ ${logo()} ${chalkGrey("(v3 Developer Preview)")}`;
|
|
|
1743
1741
|
text3 = `${text3} (update available ${chalk3.green(maybeNewVersion)})`;
|
|
1744
1742
|
}
|
|
1745
1743
|
}
|
|
1746
|
-
logger.log(text3 + "\n" +
|
|
1744
|
+
logger.log(text3 + "\n" + chalkGrey("-".repeat(54)));
|
|
1747
1745
|
}
|
|
1748
1746
|
function printDevBanner() {
|
|
1749
1747
|
logger.log(
|
|
@@ -2733,6 +2731,38 @@ import { Glob } from "glob";
|
|
|
2733
2731
|
import { readFileSync } from "node:fs";
|
|
2734
2732
|
import { extname, isAbsolute } from "node:path";
|
|
2735
2733
|
import tsConfigPaths from "tsconfig-paths";
|
|
2734
|
+
function bundleTriggerDevCore(buildIdentifier, tsconfigPath) {
|
|
2735
|
+
return {
|
|
2736
|
+
name: "trigger-bundle-core",
|
|
2737
|
+
setup(build3) {
|
|
2738
|
+
build3.onResolve({ filter: /.*/ }, (args) => {
|
|
2739
|
+
if (args.path !== "@trigger.dev/core/v3") {
|
|
2740
|
+
return void 0;
|
|
2741
|
+
}
|
|
2742
|
+
const triggerSdkPath = __require.resolve("@trigger.dev/sdk/v3", { paths: [process.cwd()] });
|
|
2743
|
+
logger.debug(`[${buildIdentifier}][trigger-bundle-core] Resolved @trigger.dev/sdk/v3`, {
|
|
2744
|
+
...args,
|
|
2745
|
+
triggerSdkPath
|
|
2746
|
+
});
|
|
2747
|
+
const resolvedPath = __require.resolve("@trigger.dev/core/v3", {
|
|
2748
|
+
paths: [triggerSdkPath]
|
|
2749
|
+
});
|
|
2750
|
+
logger.debug(
|
|
2751
|
+
`[${buildIdentifier}][trigger-bundle-core] Externalizing @trigger.dev/core/v3`,
|
|
2752
|
+
{
|
|
2753
|
+
...args,
|
|
2754
|
+
triggerSdkPath,
|
|
2755
|
+
resolvedPath
|
|
2756
|
+
}
|
|
2757
|
+
);
|
|
2758
|
+
return {
|
|
2759
|
+
path: resolvedPath,
|
|
2760
|
+
external: false
|
|
2761
|
+
};
|
|
2762
|
+
});
|
|
2763
|
+
}
|
|
2764
|
+
};
|
|
2765
|
+
}
|
|
2736
2766
|
function workerSetupImportConfigPlugin(configPath) {
|
|
2737
2767
|
return {
|
|
2738
2768
|
name: "trigger-worker-setup",
|
|
@@ -3543,15 +3573,22 @@ async function buildAndPushSelfHostedImage(options) {
|
|
|
3543
3573
|
const errors = [];
|
|
3544
3574
|
let digest;
|
|
3545
3575
|
try {
|
|
3546
|
-
await new Promise((res, rej) => {
|
|
3576
|
+
const processCode = await new Promise((res, rej) => {
|
|
3547
3577
|
buildProcess.stderr?.on("data", (data) => {
|
|
3548
3578
|
const text3 = data.toString();
|
|
3549
3579
|
errors.push(text3);
|
|
3550
3580
|
logger.debug(text3);
|
|
3551
3581
|
});
|
|
3552
3582
|
buildProcess.on("error", (e) => rej(e));
|
|
3553
|
-
buildProcess.on("close", () => res());
|
|
3583
|
+
buildProcess.on("close", (code) => res(code));
|
|
3554
3584
|
});
|
|
3585
|
+
if (processCode !== 0) {
|
|
3586
|
+
return {
|
|
3587
|
+
ok: false,
|
|
3588
|
+
error: "Error building image",
|
|
3589
|
+
logs: extractLogs(errors)
|
|
3590
|
+
};
|
|
3591
|
+
}
|
|
3555
3592
|
digest = extractImageDigest(errors);
|
|
3556
3593
|
span.setAttributes({
|
|
3557
3594
|
"image.digest": digest
|
|
@@ -3573,7 +3610,7 @@ async function buildAndPushSelfHostedImage(options) {
|
|
|
3573
3610
|
cwd: options.cwd
|
|
3574
3611
|
});
|
|
3575
3612
|
try {
|
|
3576
|
-
await new Promise((res, rej) => {
|
|
3613
|
+
const processCode = await new Promise((res, rej) => {
|
|
3577
3614
|
pushProcess.stdout?.on("data", (data) => {
|
|
3578
3615
|
const text3 = data.toString();
|
|
3579
3616
|
logger.debug(text3);
|
|
@@ -3583,8 +3620,15 @@ async function buildAndPushSelfHostedImage(options) {
|
|
|
3583
3620
|
logger.debug(text3);
|
|
3584
3621
|
});
|
|
3585
3622
|
pushProcess.on("error", (e) => rej(e));
|
|
3586
|
-
pushProcess.on("close", () => res());
|
|
3623
|
+
pushProcess.on("close", (code) => res(code));
|
|
3587
3624
|
});
|
|
3625
|
+
if (processCode !== 0) {
|
|
3626
|
+
return {
|
|
3627
|
+
ok: false,
|
|
3628
|
+
error: "Error pushing image",
|
|
3629
|
+
logs: extractLogs(errors)
|
|
3630
|
+
};
|
|
3631
|
+
}
|
|
3588
3632
|
span.end();
|
|
3589
3633
|
} catch (e) {
|
|
3590
3634
|
recordSpanException4(span, e);
|
|
@@ -4327,6 +4371,12 @@ var BackgroundWorker = class {
|
|
|
4327
4371
|
await installPackages(this.params.dependencies, { cwd: dirname2(this.path) });
|
|
4328
4372
|
}
|
|
4329
4373
|
let resolved = false;
|
|
4374
|
+
const cwd = dirname2(this.path);
|
|
4375
|
+
const fullEnv = {
|
|
4376
|
+
...this.params.env,
|
|
4377
|
+
...this.#readEnvVars()
|
|
4378
|
+
};
|
|
4379
|
+
logger.debug("Initializing worker", { path: this.path, cwd, fullEnv });
|
|
4330
4380
|
this.tasks = await new Promise((resolve4, reject) => {
|
|
4331
4381
|
const child = fork(this.path, {
|
|
4332
4382
|
stdio: [
|
|
@@ -4338,10 +4388,8 @@ var BackgroundWorker = class {
|
|
|
4338
4388
|
"pipe",
|
|
4339
4389
|
"ipc"
|
|
4340
4390
|
],
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
...this.#readEnvVars()
|
|
4344
|
-
}
|
|
4391
|
+
cwd,
|
|
4392
|
+
env: fullEnv
|
|
4345
4393
|
});
|
|
4346
4394
|
const timeout = setTimeout(() => {
|
|
4347
4395
|
if (resolved) {
|
|
@@ -4544,9 +4592,11 @@ var TaskRunProcess = class {
|
|
|
4544
4592
|
OTEL_EXPORTER_OTLP_COMPRESSION: "none",
|
|
4545
4593
|
...this.worker.debugOtel ? { OTEL_LOG_LEVEL: "debug" } : {}
|
|
4546
4594
|
};
|
|
4595
|
+
const cwd = dirname2(this.path);
|
|
4547
4596
|
logger.debug(`[${this.execution.run.id}] initializing task run process`, {
|
|
4548
4597
|
env: fullEnv,
|
|
4549
|
-
path: this.path
|
|
4598
|
+
path: this.path,
|
|
4599
|
+
cwd
|
|
4550
4600
|
});
|
|
4551
4601
|
this._child = fork(this.path, {
|
|
4552
4602
|
stdio: [
|
|
@@ -4558,7 +4608,7 @@ var TaskRunProcess = class {
|
|
|
4558
4608
|
"pipe",
|
|
4559
4609
|
"ipc"
|
|
4560
4610
|
],
|
|
4561
|
-
cwd
|
|
4611
|
+
cwd,
|
|
4562
4612
|
env: fullEnv,
|
|
4563
4613
|
execArgv: this.worker.debuggerOn ? ["--inspect-brk", "--trace-uncaught", "--no-warnings=ExperimentalWarning"] : ["--trace-uncaught", "--no-warnings=ExperimentalWarning"]
|
|
4564
4614
|
});
|
|
@@ -4713,6 +4763,7 @@ function runtimeCheck(minimumMajor, minimumMinor) {
|
|
|
4713
4763
|
}
|
|
4714
4764
|
|
|
4715
4765
|
// src/commands/dev.tsx
|
|
4766
|
+
import { findUp as findUp2, pathExists as pathExists2 } from "find-up";
|
|
4716
4767
|
var apiClient;
|
|
4717
4768
|
var DevCommandOptions = CommonCommandOptions.extend({
|
|
4718
4769
|
debugger: z5.boolean().default(false),
|
|
@@ -4978,6 +5029,7 @@ function useDev({
|
|
|
4978
5029
|
__PROJECT_CONFIG__: JSON.stringify(config)
|
|
4979
5030
|
},
|
|
4980
5031
|
plugins: [
|
|
5032
|
+
bundleTriggerDevCore("workerFacade", config.tsconfigPath),
|
|
4981
5033
|
bundleDependenciesPlugin(
|
|
4982
5034
|
"workerFacade",
|
|
4983
5035
|
(config.dependenciesToBundle ?? []).concat([/^@trigger.dev/]),
|
|
@@ -5033,7 +5085,7 @@ function useDev({
|
|
|
5033
5085
|
await fs7.promises.writeFile(sourceMapPath2, sourceMapFile.text);
|
|
5034
5086
|
}
|
|
5035
5087
|
const environmentVariablesResponse = await environmentClient.getEnvironmentVariables(config.project);
|
|
5036
|
-
const processEnv = gatherProcessEnv();
|
|
5088
|
+
const processEnv = await gatherProcessEnv();
|
|
5037
5089
|
const backgroundWorker = new BackgroundWorker(fullPath, {
|
|
5038
5090
|
projectConfig: config,
|
|
5039
5091
|
dependencies: dependencies2,
|
|
@@ -5264,7 +5316,7 @@ ${task.filePath} -> ${task.exportName}`).join("")}`;
|
|
|
5264
5316
|
}).join("");
|
|
5265
5317
|
return `Duplicate ${chalkTask("task id")} detected:${duplicateTable}`;
|
|
5266
5318
|
}
|
|
5267
|
-
function gatherProcessEnv() {
|
|
5319
|
+
async function gatherProcessEnv() {
|
|
5268
5320
|
const env = {
|
|
5269
5321
|
NODE_ENV: process.env.NODE_ENV ?? "development",
|
|
5270
5322
|
PATH: process.env.PATH,
|
|
@@ -5275,12 +5327,37 @@ function gatherProcessEnv() {
|
|
|
5275
5327
|
NVM_BIN: process.env.NVM_BIN,
|
|
5276
5328
|
LANG: process.env.LANG,
|
|
5277
5329
|
TERM: process.env.TERM,
|
|
5278
|
-
NODE_PATH: process.env.NODE_PATH,
|
|
5330
|
+
NODE_PATH: await amendNodePathWithPnpmNodeModules(process.env.NODE_PATH),
|
|
5279
5331
|
HOME: process.env.HOME,
|
|
5280
5332
|
BUN_INSTALL: process.env.BUN_INSTALL
|
|
5281
5333
|
};
|
|
5282
5334
|
return Object.fromEntries(Object.entries(env).filter(([key, value]) => value !== void 0));
|
|
5283
5335
|
}
|
|
5336
|
+
async function amendNodePathWithPnpmNodeModules(nodePath) {
|
|
5337
|
+
const pnpmModulesPath = await findPnpmNodeModulesPath();
|
|
5338
|
+
if (!pnpmModulesPath) {
|
|
5339
|
+
return nodePath;
|
|
5340
|
+
}
|
|
5341
|
+
if (nodePath) {
|
|
5342
|
+
if (nodePath.includes(pnpmModulesPath)) {
|
|
5343
|
+
return nodePath;
|
|
5344
|
+
}
|
|
5345
|
+
return `${nodePath}:${pnpmModulesPath}`;
|
|
5346
|
+
}
|
|
5347
|
+
return pnpmModulesPath;
|
|
5348
|
+
}
|
|
5349
|
+
async function findPnpmNodeModulesPath() {
|
|
5350
|
+
return await findUp2(
|
|
5351
|
+
async (directory) => {
|
|
5352
|
+
const pnpmModules = join5(directory, "node_modules", ".pnpm", "node_modules");
|
|
5353
|
+
const hasPnpmNodeModules = await pathExists2(pnpmModules);
|
|
5354
|
+
if (hasPnpmNodeModules) {
|
|
5355
|
+
return pnpmModules;
|
|
5356
|
+
}
|
|
5357
|
+
},
|
|
5358
|
+
{ type: "directory" }
|
|
5359
|
+
);
|
|
5360
|
+
}
|
|
5284
5361
|
|
|
5285
5362
|
// src/commands/init.ts
|
|
5286
5363
|
import { intro as intro4, isCancel, log as log3, outro as outro4, select as select2, spinner as spinner5, text } from "@clack/prompts";
|