diff --git a/.changeset/little-lemons-grab.md b/.changeset/little-lemons-grab.md
new file mode 100644
index 0000000000..71041f1385
--- /dev/null
+++ b/.changeset/little-lemons-grab.md
@@ -0,0 +1,5 @@
+---
+"trigger.dev": patch
+---
+
+All experimental flags have been promoted to non-experimental, but the experimental ones still work (for now). keepNames and autoDetectExternal now default to true.
diff --git a/docs/tasks/scheduled.mdx b/docs/tasks/scheduled.mdx
index aea6efb9db..47c7854373 100644
--- a/docs/tasks/scheduled.mdx
+++ b/docs/tasks/scheduled.mdx
@@ -3,7 +3,10 @@ title: "Scheduled tasks (cron)"
description: "A task that is triggered on a recurring schedule using cron syntax."
---
-Scheduled tasks are only for recurring tasks. If you want to trigger a one-off task at a future time, you should [use the delay option](/triggering#delay).
+
+ Scheduled tasks are only for recurring tasks. If you want to trigger a one-off task at a future
+ time, you should [use the delay option](/triggering#delay).
+
## Defining a scheduled task
@@ -104,6 +107,9 @@ export const secondScheduledTask = schedules.task({
//5am every day Tokyo time
pattern: "0 5 * * *",
timezone: "Asia/Tokyo",
+ //optional, defaults to all environments
+ //possible values are "PRODUCTION", "STAGING", "PREVIEW" and "DEVELOPMENT"
+ environments: ["PRODUCTION", "STAGING"],
},
run: async (payload) => {},
});
diff --git a/packages/cli-v3/src/build/bundle.ts b/packages/cli-v3/src/build/bundle.ts
index d8687922d1..597b46854a 100644
--- a/packages/cli-v3/src/build/bundle.ts
+++ b/packages/cli-v3/src/build/bundle.ts
@@ -176,8 +176,14 @@ async function createBuildOptions(
const customConditions = options.resolvedConfig.build?.conditions ?? [];
const conditions = [...customConditions, "trigger.dev", "module", "node"];
- const keepNames = options.resolvedConfig.build?.experimental_keepNames ?? false;
- const minify = options.resolvedConfig.build?.experimental_minify ?? false;
+ const keepNames =
+ options.resolvedConfig.build?.keepNames ??
+ options.resolvedConfig.build?.experimental_keepNames ??
+ true;
+ const minify =
+ options.resolvedConfig.build?.minify ??
+ options.resolvedConfig.build?.experimental_minify ??
+ false;
const $buildPlugins = await buildPlugins(options.target, options.resolvedConfig);
diff --git a/packages/cli-v3/src/build/externals.ts b/packages/cli-v3/src/build/externals.ts
index 90a2e07514..c35f90cf18 100644
--- a/packages/cli-v3/src/build/externals.ts
+++ b/packages/cli-v3/src/build/externals.ts
@@ -159,11 +159,16 @@ function createExternalsCollector(
isExternalCache.clear();
});
+ const autoDetectExternal =
+ resolvedConfig.build?.autoDetectExternal ??
+ resolvedConfig.build?.experimental_autoDetectExternal ??
+ true;
+
build.onEnd(async () => {
logger.debug("[externals][onEnd] Collected externals", {
externals,
maybeExternals,
- autoDetectExternal: !!resolvedConfig.build?.experimental_autoDetectExternal,
+ autoDetectExternal,
packageJsonCache: packageJsonCache.size,
isExternalCache: isExternalCache.size,
});
@@ -265,7 +270,7 @@ function createExternalsCollector(
});
});
- if (resolvedConfig.build?.experimental_autoDetectExternal) {
+ if (autoDetectExternal) {
build.onResolve(
{ filter: /.*/, namespace: "file" },
async (args: esbuild.OnResolveArgs): Promise => {
diff --git a/packages/cli-v3/src/dev/devSupervisor.ts b/packages/cli-v3/src/dev/devSupervisor.ts
index e86ea4eb45..a445748473 100644
--- a/packages/cli-v3/src/dev/devSupervisor.ts
+++ b/packages/cli-v3/src/dev/devSupervisor.ts
@@ -101,22 +101,21 @@ class DevSupervisor implements WorkerRuntime {
// Initialize the task run process pool
const env = await this.#getEnvVars();
+ const processKeepAlive =
+ this.options.config.processKeepAlive ?? this.options.config.experimental_processKeepAlive;
+
const enableProcessReuse =
- typeof this.options.config.experimental_processKeepAlive === "boolean"
- ? this.options.config.experimental_processKeepAlive
- : typeof this.options.config.experimental_processKeepAlive === "object"
- ? this.options.config.experimental_processKeepAlive.enabled
+ typeof processKeepAlive === "boolean"
+ ? processKeepAlive
+ : typeof processKeepAlive === "object"
+ ? processKeepAlive.enabled
: false;
const maxPoolSize =
- typeof this.options.config.experimental_processKeepAlive === "object"
- ? this.options.config.experimental_processKeepAlive.devMaxPoolSize ?? 25
- : 25;
+ typeof processKeepAlive === "object" ? processKeepAlive.devMaxPoolSize ?? 25 : 25;
const maxExecutionsPerProcess =
- typeof this.options.config.experimental_processKeepAlive === "object"
- ? this.options.config.experimental_processKeepAlive.maxExecutionsPerProcess ?? 50
- : 50;
+ typeof processKeepAlive === "object" ? processKeepAlive.maxExecutionsPerProcess ?? 50 : 50;
if (enableProcessReuse) {
logger.debug("[DevSupervisor] Enabling process reuse", {
@@ -359,9 +358,10 @@ class DevSupervisor implements WorkerRuntime {
config: this.options.config,
});
- const cwd = this.options.config.experimental_devProcessCwdInBuildDir
- ? worker.build.outputPath
- : undefined;
+ const cwd =
+ this.options.config.legacyDevProcessCwdBehaviour === true
+ ? undefined
+ : worker.build.outputPath;
//new run
runController = new DevRunController({
diff --git a/packages/cli-v3/src/entryPoints/managed-index-worker.ts b/packages/cli-v3/src/entryPoints/managed-index-worker.ts
index 03c4ff4b14..98593cfc6e 100644
--- a/packages/cli-v3/src/entryPoints/managed-index-worker.ts
+++ b/packages/cli-v3/src/entryPoints/managed-index-worker.ts
@@ -147,6 +147,8 @@ if (typeof config.machine === "string") {
});
}
+const processKeepAlive = config.processKeepAlive ?? config.experimental_processKeepAlive;
+
await sendMessageInCatalog(
indexerToWorkerMessages,
"INDEX_COMPLETE",
@@ -163,10 +165,10 @@ await sendMessageInCatalog(
customConditions: buildManifest.customConditions,
initEntryPoint: buildManifest.initEntryPoint,
processKeepAlive:
- typeof config.experimental_processKeepAlive === "object"
- ? config.experimental_processKeepAlive
- : typeof config.experimental_processKeepAlive === "boolean"
- ? { enabled: config.experimental_processKeepAlive }
+ typeof processKeepAlive === "object"
+ ? processKeepAlive
+ : typeof processKeepAlive === "boolean"
+ ? { enabled: processKeepAlive }
: undefined,
timings,
},
diff --git a/packages/core/src/v3/config.ts b/packages/core/src/v3/config.ts
index 838a464dcf..08d1e90359 100644
--- a/packages/core/src/v3/config.ts
+++ b/packages/core/src/v3/config.ts
@@ -19,6 +19,25 @@ export type CompatibilityFlagFeatures = {
[key in CompatibilityFlag]: boolean;
};
+type ProcessKeepAlive =
+ | boolean
+ | {
+ enabled: boolean;
+ /**
+ * The maximum number of executions per process. If the process has run more than this number of times, it will be killed.
+ *
+ * @default 50
+ */
+ maxExecutionsPerProcess?: number;
+
+ /**
+ * The maximum number of processes to keep alive in dev.
+ *
+ * @default 25
+ */
+ devMaxPoolSize?: number;
+ };
+
export type TriggerConfig = {
/**
* @default "node"
@@ -171,30 +190,43 @@ export type TriggerConfig = {
external?: string[];
/**
- * **WARNING: This is an experimental feature and might be removed in a future version.**
+ * This still works but use `autoDetectExternal` instead.
*
+ * @deprecated (use autoDetectExternal instead)
+ */
+ experimental_autoDetectExternal?: boolean;
+
+ /**
* Automatically detect dependencies that shouldn't be bundled and mark them as external. For example, native modules.
*
- * Turning this on will not affect dependencies that were manually added to the `external` array.
+ * Turn this off if you are having issues and want to manually specify all `external` dependencies.
*
- * @default false
- *
- * @deprecated (experimental)
+ * @default true
*/
- experimental_autoDetectExternal?: boolean;
+ autoDetectExternal?: boolean;
/**
- * **WARNING: This is an experimental feature and might be removed in a future version.**
+ * This still works but use `keepNames` instead.
*
- * Preserve the original names of functions and classes in the bundle. This can fix issues with frameworks that rely on the original names for registration and binding, for example MikroORM.
+ * @deprecated (use keepNames instead)
+ */
+ experimental_keepNames?: boolean;
+
+ /* Set to false to minify the original names of functions and classes in the bundle.
+ * This can make bundles smaller at the cost of compatibility with frameworks that rely on function/class/variable names.
*
* @link https://esbuild.github.io/api/#keep-names
*
- * @default false
+ * @default true
+ */
+ keepNames?: boolean;
+
+ /**
+ * This still works but use `minify` instead.
*
- * @deprecated (experimental)
+ * @deprecated (use minify instead)
*/
- experimental_keepNames?: boolean;
+ experimental_minify?: boolean;
/**
* **WARNING: This is an experimental feature and might be removed in a future version.**
@@ -206,10 +238,8 @@ export type TriggerConfig = {
* @link https://esbuild.github.io/api/#minify
*
* @default false
- *
- * @deprecated (experimental)
*/
- experimental_minify?: boolean;
+ minify?: boolean;
jsx?: {
/**
@@ -234,38 +264,31 @@ export type TriggerConfig = {
env?: Record;
};
+ /**
+ * This still works but use `processKeepAlive` instead.
+ *
+ * @deprecated (use processKeepAlive instead)
+ */
+ experimental_processKeepAlive?: ProcessKeepAlive;
+
/**
* @default false
* @description Keep the process alive after the task has finished running so the next task doesn't have to wait for the process to start up again.
*
* Note that the process could be killed at any time, and we don't make any guarantees about the process being alive for a certain amount of time
*/
- experimental_processKeepAlive?:
- | boolean
- | {
- enabled: boolean;
- /**
- * The maximum number of executions per process. If the process has run more than this number of times, it will be killed.
- *
- * @default 50
- */
- maxExecutionsPerProcess?: number;
-
- /**
- * The maximum number of processes to keep alive in dev.
- *
- * @default 25
- */
- devMaxPoolSize?: number;
- };
+ processKeepAlive?: ProcessKeepAlive;
/**
* @default false
- * @description When running the dev CLI, set the current working directory to the build directory.
+ * @description If set to true when running the dev CLI, the current working directory will be set to where the command is run from.
+ *
+ * The new default (when this flag isn't passed) is to set the current working directory to the build directory.
+ * This more closely matches the behavior of the CLI when running in production and is highly recommended.
*
- * Currently, the process.cwd() is set to the root of the project.
+ * This impacts the value of process.cwd() in your task code.
*/
- experimental_devProcessCwdInBuildDir?: boolean;
+ legacyDevProcessCwdBehaviour?: boolean;
/**
* @deprecated Use `dirs` instead