trigger.dev 0.0.0-v3-trigger-dirs-20240423123825 → 0.0.0-v3-update-command-20240423125505

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/index.js CHANGED
@@ -777,15 +777,15 @@ var require_retry2 = __commonJS({
777
777
  import { Command as Command2 } from "commander";
778
778
 
779
779
  // src/commands/deploy.ts
780
- import { intro as intro3, log as log3, outro as outro3 } from "@clack/prompts";
780
+ import { intro as intro4, log as log5, outro as outro4 } from "@clack/prompts";
781
781
  import { depot } from "@depot/cli";
782
782
  import { context, trace as trace2 } from "@opentelemetry/api";
783
783
  import {
784
784
  TaskMetadataFailedToParseData,
785
785
  detectDependencyVersion,
786
- flattenAttributes as flattenAttributes2
786
+ flattenAttributes as flattenAttributes2,
787
+ recordSpanException as recordSpanException4
787
788
  } from "@trigger.dev/core/v3";
788
- import { recordSpanException as recordSpanException4 } from "@trigger.dev/core/v3/workers";
789
789
  import chalk5 from "chalk";
790
790
  import { Option as CommandOption } from "commander";
791
791
  import { build as build2 } from "esbuild";
@@ -793,14 +793,14 @@ import { execa as execa2 } from "execa";
793
793
  import { createHash } from "node:crypto";
794
794
  import { readFileSync as readFileSync2 } from "node:fs";
795
795
  import { copyFile, mkdir, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
796
- import { dirname, join as join5, relative as relative3, posix } from "node:path";
796
+ import { dirname, join as join6, relative as relative3, posix } from "node:path";
797
797
  import { setTimeout as setTimeout2 } from "node:timers/promises";
798
798
  import terminalLink2 from "terminal-link";
799
799
  import invariant from "tiny-invariant";
800
- import { z as z4 } from "zod";
800
+ import { z as z5 } from "zod";
801
801
 
802
802
  // package.json
803
- var version = "0.0.0-v3-trigger-dirs-20240423123825";
803
+ var version = "0.0.0-v3-update-command-20240423125505";
804
804
  var dependencies = {
805
805
  "@clack/prompts": "^0.7.0",
806
806
  "@depot/cli": "0.0.1-cli.2.55.0",
@@ -816,7 +816,7 @@ var dependencies = {
816
816
  "@opentelemetry/sdk-trace-base": "^1.22.0",
817
817
  "@opentelemetry/sdk-trace-node": "^1.22.0",
818
818
  "@opentelemetry/semantic-conventions": "^1.22.0",
819
- "@trigger.dev/core": "workspace:0.0.0-v3-trigger-dirs-20240423123825",
819
+ "@trigger.dev/core": "workspace:0.0.0-v3-update-command-20240423125505",
820
820
  "@types/degit": "^2.8.3",
821
821
  chalk: "^5.2.0",
822
822
  chokidar: "^3.5.3",
@@ -1141,8 +1141,7 @@ async function zodfetch(schema, url, requestInit) {
1141
1141
  }
1142
1142
 
1143
1143
  // src/cli/common.ts
1144
- import { flattenAttributes } from "@trigger.dev/core/v3";
1145
- import { recordSpanException } from "@trigger.dev/core/v3/workers";
1144
+ import { flattenAttributes, recordSpanException } from "@trigger.dev/core/v3";
1146
1145
  import { z } from "zod";
1147
1146
 
1148
1147
  // src/telemetry/tracing.ts
@@ -1319,6 +1318,7 @@ var logger = new Logger();
1319
1318
  import { outro } from "@clack/prompts";
1320
1319
 
1321
1320
  // src/utilities/cliOutput.ts
1321
+ import { log } from "@clack/prompts";
1322
1322
  import chalk2 from "chalk";
1323
1323
  var green = "#4FFF54";
1324
1324
  var purple = "#735BF3";
@@ -1367,6 +1367,18 @@ function prettyPrintDate(date = /* @__PURE__ */ new Date()) {
1367
1367
  formattedDate += "." + ("00" + date.getMilliseconds()).slice(-3);
1368
1368
  return formattedDate;
1369
1369
  }
1370
+ function prettyWarning(header, body, footer) {
1371
+ const prefix = "Warning: ";
1372
+ const indent = Array(prefix.length).fill(" ").join("");
1373
+ const spacing = "\n\n";
1374
+ const prettyPrefix = chalkWarning(prefix);
1375
+ const withIndents = (text3) => text3?.split("\n").map((line) => `${indent}${line}`).join("\n");
1376
+ const prettyBody = withIndents(body);
1377
+ const prettyFooter = withIndents(footer);
1378
+ log.warn(
1379
+ `${prettyPrefix}${header}${prettyBody ? `${spacing}${prettyBody}` : ""}${prettyFooter ? `${spacing}${prettyFooter}` : ""}`
1380
+ );
1381
+ }
1370
1382
 
1371
1383
  // src/cli/common.ts
1372
1384
  var CommonCommandOptions = z.object({
@@ -1475,6 +1487,9 @@ async function createFile(path7, contents) {
1475
1487
  async function pathExists(path7) {
1476
1488
  return fsSync.existsSync(path7);
1477
1489
  }
1490
+ async function removeFile(path7) {
1491
+ await fsModule.unlink(path7);
1492
+ }
1478
1493
  async function readFile(path7) {
1479
1494
  return await fsModule.readFile(path7, "utf8");
1480
1495
  }
@@ -1482,8 +1497,8 @@ async function readJSONFile(path7) {
1482
1497
  const fileContents = await fsModule.readFile(path7, "utf8");
1483
1498
  return JSON.parse(fileContents);
1484
1499
  }
1485
- async function writeJSONFile(path7, json) {
1486
- await writeFile(path7, JSON.stringify(json), "utf8");
1500
+ async function writeJSONFile(path7, json, pretty = false) {
1501
+ await writeFile(path7, JSON.stringify(json, void 0, pretty ? 2 : void 0), "utf8");
1487
1502
  }
1488
1503
  function readJSONFileSync(path7) {
1489
1504
  const fileContents = fsSync.readFileSync(path7, "utf8");
@@ -1541,12 +1556,9 @@ async function getTriggerDirectories(dirPath) {
1541
1556
  const entries = await fs2.promises.readdir(dirPath, { withFileTypes: true });
1542
1557
  const triggerDirectories = [];
1543
1558
  for (const entry of entries) {
1544
- if (!entry.isDirectory() || IGNORED_DIRS.includes(entry.name) || entry.name.startsWith("."))
1559
+ if (!entry.isDirectory() || IGNORED_DIRS.includes(entry.name))
1545
1560
  continue;
1546
1561
  const fullPath = join(dirPath, entry.name);
1547
- if (fullPath.endsWith("app/api/trigger")) {
1548
- continue;
1549
- }
1550
1562
  if (entry.name === "trigger") {
1551
1563
  triggerDirectories.push(fullPath);
1552
1564
  }
@@ -1620,15 +1632,6 @@ async function getConfigPath(dir, fileName) {
1620
1632
  });
1621
1633
  return await findUp(fileName ? [fileName] : CONFIG_FILES, { cwd: dir });
1622
1634
  }
1623
- async function findFilePath(dir, fileName) {
1624
- const result = await findUp([fileName], { cwd: dir });
1625
- logger.debug("Searched for the file", {
1626
- dir,
1627
- fileName,
1628
- result
1629
- });
1630
- return result;
1631
- }
1632
1635
  async function readConfig(dir, options) {
1633
1636
  const absoluteDir = path2.resolve(process.cwd(), dir);
1634
1637
  const configPath = await getConfigPath(dir, options?.configFile);
@@ -1681,7 +1684,6 @@ async function resolveConfig(path7, config) {
1681
1684
  config.triggerDirectories = await findTriggerDirectories(path7);
1682
1685
  }
1683
1686
  config.triggerDirectories = resolveTriggerDirectories(config.triggerDirectories);
1684
- logger.debug("Resolved trigger directories", { triggerDirectories: config.triggerDirectories });
1685
1687
  if (!config.triggerUrl) {
1686
1688
  config.triggerUrl = CLOUD_API_URL;
1687
1689
  }
@@ -1689,7 +1691,7 @@ async function resolveConfig(path7, config) {
1689
1691
  config.projectDir = path7;
1690
1692
  }
1691
1693
  if (!config.tsconfigPath) {
1692
- config.tsconfigPath = await findFilePath(path7, "tsconfig.json");
1694
+ config.tsconfigPath = await getConfigPath(path7, "tsconfig.json");
1693
1695
  }
1694
1696
  return config;
1695
1697
  }
@@ -1715,29 +1717,29 @@ function getVersion() {
1715
1717
  }
1716
1718
 
1717
1719
  // src/utilities/windows.ts
1718
- import { log, spinner as clackSpinner } from "@clack/prompts";
1720
+ import { log as log2, spinner as clackSpinner } from "@clack/prompts";
1719
1721
  var isWindows = process.platform === "win32";
1720
1722
  function escapeImportPath(path7) {
1721
1723
  return isWindows ? path7.replaceAll("\\", "\\\\") : path7;
1722
1724
  }
1723
1725
  var ballmerSpinner = () => ({
1724
1726
  start: (msg) => {
1725
- log.step(msg ?? "");
1727
+ log2.step(msg ?? "");
1726
1728
  },
1727
1729
  stop: (msg, code) => {
1728
- log.message(msg ?? "");
1730
+ log2.message(msg ?? "");
1729
1731
  },
1730
1732
  message: (msg) => {
1731
- log.message(msg ?? "");
1733
+ log2.message(msg ?? "");
1732
1734
  }
1733
1735
  });
1734
1736
  var spinner = () => isWindows ? ballmerSpinner() : clackSpinner();
1735
1737
 
1736
1738
  // src/utilities/initialBanner.ts
1737
1739
  async function printInitialBanner(performUpdateCheck = true) {
1738
- const packageVersion = getVersion();
1740
+ const cliVersion = getVersion();
1739
1741
  const text3 = `
1740
- ${logo()} ${chalkGrey(`(${packageVersion})`)}
1742
+ ${logo()} ${chalkGrey(`(${cliVersion})`)}
1741
1743
  `;
1742
1744
  logger.info(text3);
1743
1745
  let maybeNewVersion;
@@ -1747,7 +1749,7 @@ ${logo()} ${chalkGrey(`(${packageVersion})`)}
1747
1749
  maybeNewVersion = await updateCheck();
1748
1750
  if (maybeNewVersion !== void 0) {
1749
1751
  loadingSpinner.stop(`Update available ${chalk3.green(maybeNewVersion)}`);
1750
- const currentMajor = parseInt(packageVersion.split(".")[0]);
1752
+ const currentMajor = parseInt(cliVersion.split(".")[0]);
1751
1753
  const newMajor = parseInt(maybeNewVersion.split(".")[0]);
1752
1754
  if (newMajor > currentMajor) {
1753
1755
  logger.warn(
@@ -1762,9 +1764,10 @@ After installation, run Trigger.dev with \`npx trigger.dev\`.`
1762
1764
  }
1763
1765
  }
1764
1766
  async function printStandloneInitialBanner(performUpdateCheck = true) {
1765
- const packageVersion = getVersion();
1767
+ const cliVersion = getVersion();
1766
1768
  logger.log(`
1767
- ${logo()} ${chalkGrey("(v3 Developer Preview)")}`);
1769
+ ${logo()} ${chalkGrey(`(${cliVersion})`)}
1770
+ `);
1768
1771
  if (performUpdateCheck) {
1769
1772
  const maybeNewVersion = await updateCheck();
1770
1773
  if (maybeNewVersion !== void 0) {
@@ -1773,7 +1776,10 @@ ${logo()} ${chalkGrey("(v3 Developer Preview)")}`);
1773
1776
  }
1774
1777
  logger.log(`${chalkGrey("-".repeat(54))}`);
1775
1778
  }
1776
- function printDevBanner() {
1779
+ function printDevBanner(printTopBorder = true) {
1780
+ if (printTopBorder) {
1781
+ logger.log(chalkGrey("-".repeat(54)));
1782
+ }
1777
1783
  logger.log(
1778
1784
  `${chalkGrey("Key:")} ${chalkWorker("Version")} ${chalkGrey("|")} ${chalkTask(
1779
1785
  "Task"
@@ -1785,7 +1791,7 @@ async function doUpdateCheck() {
1785
1791
  let update = null;
1786
1792
  try {
1787
1793
  update = await checkForUpdate(package_default, {
1788
- distTag: package_default.version.startsWith("0.0.0") ? "beta" : "latest"
1794
+ distTag: package_default.version.startsWith("3.0.0-beta") ? "beta" : "latest"
1789
1795
  });
1790
1796
  } catch (err) {
1791
1797
  }
@@ -1854,8 +1860,8 @@ async function setPackageJsonDeps(path7, deps) {
1854
1860
  }
1855
1861
 
1856
1862
  // src/commands/login.ts
1857
- import { intro as intro2, log as log2, outro as outro2, select } from "@clack/prompts";
1858
- import { recordSpanException as recordSpanException3 } from "@trigger.dev/core/v3/workers";
1863
+ import { intro as intro2, log as log3, outro as outro2, select } from "@clack/prompts";
1864
+ import { recordSpanException as recordSpanException3 } from "@trigger.dev/core/v3";
1859
1865
 
1860
1866
  // ../../node_modules/.pnpm/open@10.0.3/node_modules/open/index.js
1861
1867
  import process6 from "node:process";
@@ -2225,14 +2231,14 @@ var baseOpen = async (options) => {
2225
2231
  }
2226
2232
  const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
2227
2233
  if (options.wait) {
2228
- return new Promise((resolve4, reject) => {
2234
+ return new Promise((resolve5, reject) => {
2229
2235
  subprocess.once("error", reject);
2230
2236
  subprocess.once("close", (exitCode) => {
2231
2237
  if (!options.allowNonzeroExitCode && exitCode > 0) {
2232
2238
  reject(new Error(`Exited with code ${exitCode}`));
2233
2239
  return;
2234
2240
  }
2235
- resolve4(subprocess);
2241
+ resolve5(subprocess);
2236
2242
  });
2237
2243
  });
2238
2244
  }
@@ -2349,7 +2355,7 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
2349
2355
  return error;
2350
2356
  };
2351
2357
  async function pRetry(input, options) {
2352
- return new Promise((resolve4, reject) => {
2358
+ return new Promise((resolve5, reject) => {
2353
2359
  options = {
2354
2360
  onFailedAttempt() {
2355
2361
  },
@@ -2372,7 +2378,7 @@ async function pRetry(input, options) {
2372
2378
  try {
2373
2379
  const result = await input(attemptNumber);
2374
2380
  cleanUp();
2375
- resolve4(result);
2381
+ resolve5(result);
2376
2382
  } catch (error) {
2377
2383
  try {
2378
2384
  if (!(error instanceof Error)) {
@@ -2405,7 +2411,7 @@ import { z as z3 } from "zod";
2405
2411
  import { intro, note } from "@clack/prompts";
2406
2412
 
2407
2413
  // src/utilities/session.ts
2408
- import { recordSpanException as recordSpanException2 } from "@trigger.dev/core/v3/workers";
2414
+ import { recordSpanException as recordSpanException2 } from "@trigger.dev/core/v3";
2409
2415
  var tracer2 = getTracer();
2410
2416
  async function isLoggedIn(profile = "default") {
2411
2417
  return await tracer2.startActiveSpan("isLoggedIn", async (span) => {
@@ -2647,11 +2653,11 @@ async function login(options) {
2647
2653
  }
2648
2654
  }
2649
2655
  if (opts.embedded) {
2650
- log2.step("You must login to continue.");
2656
+ log3.step("You must login to continue.");
2651
2657
  }
2652
2658
  const apiClient2 = new CliApiClient(authConfig?.apiUrl ?? opts.defaultApiUrl);
2653
2659
  const authorizationCodeResult = await createAuthorizationCode(apiClient2);
2654
- log2.step(
2660
+ log3.step(
2655
2661
  `Please visit the following URL to login:
2656
2662
  ${chalkLink(authorizationCodeResult.url)}`
2657
2663
  );
@@ -2685,7 +2691,7 @@ ${chalkLink(authorizationCodeResult.url)}`
2685
2691
  throw new Error(whoAmIResult.error);
2686
2692
  }
2687
2693
  if (opts.embedded) {
2688
- log2.step("Logged in successfully");
2694
+ log3.step("Logged in successfully");
2689
2695
  } else {
2690
2696
  outro2("Logged in successfully");
2691
2697
  }
@@ -2704,7 +2710,7 @@ ${chalkLink(authorizationCodeResult.url)}`
2704
2710
  } catch (e) {
2705
2711
  getPersonalAccessTokenSpinner.stop(`Failed to get access token`);
2706
2712
  if (e instanceof AbortError) {
2707
- log2.error(e.message);
2713
+ log3.error(e.message);
2708
2714
  }
2709
2715
  recordSpanException3(span, e);
2710
2716
  span.end();
@@ -2789,7 +2795,7 @@ function bundleTriggerDevCore(buildIdentifier, tsconfigPath) {
2789
2795
  name: "trigger-bundle-core",
2790
2796
  setup(build3) {
2791
2797
  build3.onResolve({ filter: /.*/ }, (args) => {
2792
- if (!args.path.startsWith("@trigger.dev/core/v3")) {
2798
+ if (args.path !== "@trigger.dev/core/v3") {
2793
2799
  return void 0;
2794
2800
  }
2795
2801
  const triggerSdkPath = __require.resolve("@trigger.dev/sdk/v3", { paths: [process.cwd()] });
@@ -2797,14 +2803,17 @@ function bundleTriggerDevCore(buildIdentifier, tsconfigPath) {
2797
2803
  ...args,
2798
2804
  triggerSdkPath
2799
2805
  });
2800
- const resolvedPath = __require.resolve(args.path, {
2806
+ const resolvedPath = __require.resolve("@trigger.dev/core/v3", {
2801
2807
  paths: [triggerSdkPath]
2802
2808
  });
2803
- logger.debug(`[${buildIdentifier}][trigger-bundle-core] Externalizing ${args.path}`, {
2804
- ...args,
2805
- triggerSdkPath,
2806
- resolvedPath
2807
- });
2809
+ logger.debug(
2810
+ `[${buildIdentifier}][trigger-bundle-core] Externalizing @trigger.dev/core/v3`,
2811
+ {
2812
+ ...args,
2813
+ triggerSdkPath,
2814
+ resolvedPath
2815
+ }
2816
+ );
2808
2817
  return {
2809
2818
  path: resolvedPath,
2810
2819
  external: false
@@ -3128,7 +3137,13 @@ import { join as join4 } from "node:path";
3128
3137
 
3129
3138
  // src/utilities/getUserPackageManager.ts
3130
3139
  import { findUp as findUp2 } from "find-up";
3140
+ import { basename } from "path";
3131
3141
  async function getUserPackageManager(path7) {
3142
+ const packageManager = await detectPackageManager(path7);
3143
+ logger.debug("Detected package manager", { packageManager });
3144
+ return packageManager;
3145
+ }
3146
+ async function detectPackageManager(path7) {
3132
3147
  try {
3133
3148
  return await detectPackageManagerFromArtifacts(path7);
3134
3149
  } catch (error) {
@@ -3150,19 +3165,33 @@ function detectPackageManagerFromCurrentCommand() {
3150
3165
  }
3151
3166
  }
3152
3167
  async function detectPackageManagerFromArtifacts(path7) {
3153
- const packageFiles = [
3154
- { name: "yarn.lock", pm: "yarn" },
3155
- { name: "pnpm-lock.yaml", pm: "pnpm" },
3156
- { name: "package-lock.json", pm: "npm" },
3157
- { name: "npm-shrinkwrap.json", pm: "npm" }
3158
- ];
3159
- for (const { name, pm } of packageFiles) {
3160
- const foundPath = await findUp2(name, { cwd: path7 });
3161
- if (typeof foundPath === "string") {
3162
- return pm;
3163
- }
3168
+ const artifacts = {
3169
+ yarn: "yarn.lock",
3170
+ pnpm: "pnpm-lock.yaml",
3171
+ npm: "package-lock.json",
3172
+ npmShrinkwrap: "npm-shrinkwrap.json"
3173
+ };
3174
+ const foundPath = await findUp2(Object.values(artifacts), { cwd: path7 });
3175
+ if (!foundPath) {
3176
+ throw new Error("Could not detect package manager from artifacts");
3177
+ }
3178
+ logger.debug("Found path from package manager artifacts", { foundPath });
3179
+ switch (basename(foundPath)) {
3180
+ case artifacts.yarn:
3181
+ return "yarn";
3182
+ case artifacts.pnpm:
3183
+ return "pnpm";
3184
+ case artifacts.npm:
3185
+ case artifacts.npmShrinkwrap:
3186
+ return "npm";
3187
+ default:
3188
+ throw new Error(`Unhandled package manager detection path: ${foundPath}`);
3164
3189
  }
3165
- throw new Error("Could not detect package manager from artifacts");
3190
+ }
3191
+
3192
+ // src/utilities/assertExhaustive.ts
3193
+ function assertExhaustive(x) {
3194
+ throw new Error("Unexpected object: " + x);
3166
3195
  }
3167
3196
 
3168
3197
  // src/utilities/javascriptProject.ts
@@ -3221,17 +3250,25 @@ var JavascriptProject = class {
3221
3250
  }
3222
3251
  get scripts() {
3223
3252
  return {
3224
- postinstall: this.packageJson.scripts?.postinstall
3253
+ postinstall: this.packageJson.scripts?.postinstall ?? ""
3225
3254
  };
3226
3255
  }
3256
+ async install() {
3257
+ const command = await this.#getCommand();
3258
+ try {
3259
+ await command.installDependencies({
3260
+ cwd: this.projectPath
3261
+ });
3262
+ } catch (error) {
3263
+ logger.debug(`Failed to install dependencies using ${command.name}`, {
3264
+ error
3265
+ });
3266
+ }
3267
+ }
3227
3268
  async resolve(packageName, options) {
3228
3269
  if (BuiltInModules.has(packageName)) {
3229
3270
  return void 0;
3230
3271
  }
3231
- if (!this._packageManager) {
3232
- this._packageManager = await getUserPackageManager(this.projectPath);
3233
- }
3234
- const packageManager = this._packageManager;
3235
3272
  const opts = { allowDev: false, ...options };
3236
3273
  const packageJsonVersion = this.packageJson.dependencies?.[packageName];
3237
3274
  if (typeof packageJsonVersion === "string") {
@@ -3243,7 +3280,7 @@ var JavascriptProject = class {
3243
3280
  return devPackageJsonVersion;
3244
3281
  }
3245
3282
  }
3246
- const command = packageManager === "npm" ? new NPMCommands() : packageManager === "pnpm" ? new PNPMCommands() : new YarnCommands();
3283
+ const command = await this.#getCommand();
3247
3284
  try {
3248
3285
  const version2 = await command.resolveDependencyVersion(packageName, {
3249
3286
  cwd: this.projectPath
@@ -3258,14 +3295,39 @@ var JavascriptProject = class {
3258
3295
  });
3259
3296
  }
3260
3297
  }
3298
+ async #getCommand() {
3299
+ const packageManager = await this.getPackageManager();
3300
+ switch (packageManager) {
3301
+ case "npm":
3302
+ return new NPMCommands();
3303
+ case "pnpm":
3304
+ return new PNPMCommands();
3305
+ case "yarn":
3306
+ return new YarnCommands();
3307
+ default:
3308
+ assertExhaustive(packageManager);
3309
+ }
3310
+ }
3311
+ async getPackageManager() {
3312
+ if (!this._packageManager) {
3313
+ this._packageManager = await getUserPackageManager(this.projectPath);
3314
+ }
3315
+ return this._packageManager;
3316
+ }
3261
3317
  };
3262
3318
  var PNPMCommands = class {
3263
3319
  get name() {
3264
3320
  return "pnpm";
3265
3321
  }
3322
+ get cmd() {
3323
+ return process.platform === "win32" ? "pnpm.cmd" : "pnpm";
3324
+ }
3325
+ async installDependencies(options) {
3326
+ const { stdout, stderr } = await $({ cwd: options.cwd })`${this.cmd} install`;
3327
+ logger.debug(`Installing dependencies using ${this.name}`, { stdout, stderr });
3328
+ }
3266
3329
  async resolveDependencyVersion(packageName, options) {
3267
- const cmd = process.platform === "win32" ? "pnpm.cmd" : "pnpm";
3268
- const { stdout } = await $({ cwd: options.cwd })`${cmd} list ${packageName} -r --json`;
3330
+ const { stdout } = await $({ cwd: options.cwd })`${this.cmd} list ${packageName} -r --json`;
3269
3331
  const result = JSON.parse(stdout);
3270
3332
  logger.debug(`Resolving ${packageName} version using pnpm`, { result });
3271
3333
  for (const dep of result) {
@@ -3280,9 +3342,15 @@ var NPMCommands = class {
3280
3342
  get name() {
3281
3343
  return "npm";
3282
3344
  }
3345
+ get cmd() {
3346
+ return process.platform === "win32" ? "pnpm.cmd" : "pnpm";
3347
+ }
3348
+ async installDependencies(options) {
3349
+ const { stdout, stderr } = await $({ cwd: options.cwd })`${this.cmd} install`;
3350
+ logger.debug(`Installing dependencies using ${this.name}`, { stdout, stderr });
3351
+ }
3283
3352
  async resolveDependencyVersion(packageName, options) {
3284
- const cmd = process.platform === "win32" ? "npm.cmd" : "npm";
3285
- const { stdout } = await $({ cwd: options.cwd })`${cmd} list ${packageName} --json`;
3353
+ const { stdout } = await $({ cwd: options.cwd })`${this.cmd} list ${packageName} --json`;
3286
3354
  const output = JSON.parse(stdout);
3287
3355
  logger.debug(`Resolving ${packageName} version using npm`, { output });
3288
3356
  return this.#recursivelySearchDependencies(output.dependencies, packageName);
@@ -3305,9 +3373,15 @@ var YarnCommands = class {
3305
3373
  get name() {
3306
3374
  return "yarn";
3307
3375
  }
3376
+ get cmd() {
3377
+ return process.platform === "win32" ? "pnpm.cmd" : "pnpm";
3378
+ }
3379
+ async installDependencies(options) {
3380
+ const { stdout, stderr } = await $({ cwd: options.cwd })`${this.cmd} install`;
3381
+ logger.debug(`Installing dependencies using ${this.name}`, { stdout, stderr });
3382
+ }
3308
3383
  async resolveDependencyVersion(packageName, options) {
3309
- const cmd = process.platform === "win32" ? "yarn.cmd" : "yarn";
3310
- const { stdout } = await $({ cwd: options.cwd })`${cmd} info ${packageName} --json`;
3384
+ const { stdout } = await $({ cwd: options.cwd })`${this.cmd} info ${packageName} --json`;
3311
3385
  const lines = stdout.split("\n");
3312
3386
  logger.debug(`Resolving ${packageName} version using yarn`, { lines });
3313
3387
  for (const line of lines) {
@@ -3328,22 +3402,219 @@ function cliRootPath() {
3328
3402
  return __dirname2;
3329
3403
  }
3330
3404
 
3405
+ // src/commands/update.ts
3406
+ import { confirm, intro as intro3, isCancel, log as log4, outro as outro3 } from "@clack/prompts";
3407
+ import { run as ncuRun } from "npm-check-updates";
3408
+ import { z as z4 } from "zod";
3409
+ import { join as join5, resolve as resolve2 } from "path";
3410
+ var UpdateCommandOptions = CommonCommandOptions.pick({
3411
+ logLevel: true,
3412
+ skipTelemetry: true
3413
+ });
3414
+ function configureUpdateCommand(program2) {
3415
+ return program2.command("update").description("Updates all @trigger.dev/* packages to match the CLI version").argument("[path]", "The path to the directory that contains the package.json file", ".").option(
3416
+ "-l, --log-level <level>",
3417
+ "The CLI log level to use (debug, info, log, warn, error, none). This does not effect the log level of your trigger.dev tasks.",
3418
+ "log"
3419
+ ).option("--skip-telemetry", "Opt-out of sending telemetry").action(async (path7, options) => {
3420
+ wrapCommandAction("dev", UpdateCommandOptions, options, async (opts) => {
3421
+ await printStandloneInitialBanner(true);
3422
+ await updateCommand(path7, opts);
3423
+ });
3424
+ });
3425
+ }
3426
+ var NcuRunResult = z4.record(z4.string());
3427
+ var triggerPackageFilter = /^@trigger\.dev/;
3428
+ async function updateCommand(dir, options) {
3429
+ await updateTriggerPackages(dir, options);
3430
+ }
3431
+ async function updateTriggerPackages(dir, options, embedded, requireUpdate) {
3432
+ if (!embedded) {
3433
+ intro3("Updating packages");
3434
+ }
3435
+ const projectPath = resolve2(process.cwd(), dir);
3436
+ const { packageJson, readonlyPackageJson, packageJsonPath } = await getPackageJson(projectPath);
3437
+ if (!packageJson) {
3438
+ log4.error("Failed to load package.json. Try to re-run with `-l debug` to see what's going on.");
3439
+ return;
3440
+ }
3441
+ const cliVersion = getVersion();
3442
+ const newCliVersion = await updateCheck();
3443
+ if (newCliVersion) {
3444
+ prettyWarning(
3445
+ "You're not running the latest CLI version, please consider updating ASAP",
3446
+ "To update, run: `(p)npm i trigger.dev@beta`\nOr run with: `(p)npx trigger.dev@beta`",
3447
+ "Yarn works too!"
3448
+ );
3449
+ }
3450
+ const triggerDependencies = getTriggerDependencies(packageJson);
3451
+ function getVersionMismatches(deps, targetVersion) {
3452
+ const mismatches = [];
3453
+ for (const dep of deps) {
3454
+ if (dep.version === targetVersion) {
3455
+ continue;
3456
+ }
3457
+ mismatches.push(dep);
3458
+ }
3459
+ return mismatches;
3460
+ }
3461
+ const versionMismatches = getVersionMismatches(triggerDependencies, cliVersion);
3462
+ if (versionMismatches.length === 0) {
3463
+ if (!embedded) {
3464
+ outro3(`Nothing to do${newCliVersion ? " ..but you should really update your CLI!" : ""}`);
3465
+ }
3466
+ return;
3467
+ }
3468
+ prettyWarning(
3469
+ "Mismatch between your CLI version and installed packages",
3470
+ "We recommend pinned versions for guaranteed compatibility"
3471
+ );
3472
+ if (!process.stdout.isTTY) {
3473
+ outro3("Deploy failed");
3474
+ console.log(
3475
+ `ERROR: Version mismatch detected while running in CI. This won't end well. Aborting.
3476
+
3477
+ Please run the dev command locally and check that your CLI version matches the one printed below. Additionally, all \`@trigger.dev/*\` packages also need to match this version.
3478
+
3479
+ If your local CLI version doesn't match the one below, you may want to add the \`trigger.dev\` package to your dependencies. You will also have to update your workflow deploy command to \`npx trigger.dev deploy\` to ensure your pinned CLI version is used.
3480
+
3481
+ CLI version: ${cliVersion}
3482
+
3483
+ Current package versions that don't match the CLI:
3484
+ ${versionMismatches.map((dep) => `- ${dep.name}@${dep.version}`).join("\n")}
3485
+ `
3486
+ );
3487
+ process.exit(1);
3488
+ }
3489
+ log4.message("");
3490
+ const userWantsToUpdate = await updateConfirmation(versionMismatches, cliVersion);
3491
+ if (isCancel(userWantsToUpdate)) {
3492
+ throw new OutroCommandError();
3493
+ }
3494
+ if (!userWantsToUpdate) {
3495
+ if (requireUpdate) {
3496
+ outro3("You shall not pass!");
3497
+ logger.log(
3498
+ `${chalkError(
3499
+ "X Error:"
3500
+ )} Update required: Version mismatches will cause errors and headaches. Don't use \`--skip-update-check\`, just update, please.
3501
+ `
3502
+ );
3503
+ process.exit(1);
3504
+ }
3505
+ if (!embedded) {
3506
+ outro3("You've been warned!");
3507
+ }
3508
+ return;
3509
+ }
3510
+ const installSpinner = spinner();
3511
+ installSpinner.start("Writing new package.json file");
3512
+ const packageJsonBackupPath = `${packageJsonPath}.bak`;
3513
+ await writeJSONFile(packageJsonBackupPath, readonlyPackageJson, true);
3514
+ const exitHandler = async (sig) => {
3515
+ log4.warn(
3516
+ `You may have to manually roll back any package.json changes. Backup written to ${packageJsonBackupPath}`
3517
+ );
3518
+ };
3519
+ process.prependOnceListener("exit", exitHandler);
3520
+ mutatePackageJsonWithUpdatedPackages(packageJson, versionMismatches, cliVersion);
3521
+ await writeJSONFile(packageJsonPath, packageJson, true);
3522
+ async function revertPackageJsonChanges() {
3523
+ await writeJSONFile(packageJsonPath, readonlyPackageJson, true);
3524
+ await removeFile(packageJsonBackupPath);
3525
+ }
3526
+ installSpinner.message("Installing new package versions");
3527
+ const jsProject = new JavascriptProject(projectPath);
3528
+ let packageManager;
3529
+ try {
3530
+ packageManager = await jsProject.getPackageManager();
3531
+ installSpinner.message(`Installing new package versions with ${packageManager}`);
3532
+ await jsProject.install();
3533
+ } catch (error) {
3534
+ installSpinner.stop(
3535
+ `Failed to install new package versions${packageManager ? ` with ${packageManager}` : ""}`
3536
+ );
3537
+ process.removeListener("exit", exitHandler);
3538
+ await revertPackageJsonChanges();
3539
+ throw error;
3540
+ }
3541
+ installSpinner.stop("Installed new package versions");
3542
+ process.removeListener("exit", exitHandler);
3543
+ await removeFile(packageJsonBackupPath);
3544
+ if (!embedded) {
3545
+ outro3(
3546
+ `Packages updated${newCliVersion ? " ..but you should really update your CLI too!" : ""}`
3547
+ );
3548
+ }
3549
+ }
3550
+ function getTriggerDependencies(packageJson) {
3551
+ const deps = [];
3552
+ for (const type of ["dependencies", "devDependencies"]) {
3553
+ for (const [name, version2] of Object.entries(packageJson[type] ?? {})) {
3554
+ if (!version2) {
3555
+ continue;
3556
+ }
3557
+ if (version2.startsWith("workspace")) {
3558
+ continue;
3559
+ }
3560
+ if (!triggerPackageFilter.test(name)) {
3561
+ continue;
3562
+ }
3563
+ deps.push({ type, name, version: version2 });
3564
+ }
3565
+ }
3566
+ return deps;
3567
+ }
3568
+ function mutatePackageJsonWithUpdatedPackages(packageJson, depsToUpdate, targetVersion) {
3569
+ for (const { type, name, version: version2 } of depsToUpdate) {
3570
+ if (!packageJson[type]) {
3571
+ throw new Error(
3572
+ `No ${type} entry found in package.json. Please try to upgrade manually instead.`
3573
+ );
3574
+ }
3575
+ packageJson[type][name] = targetVersion;
3576
+ }
3577
+ }
3578
+ function printUpdateTable(depsToUpdate, targetVersion) {
3579
+ log4.message("Suggested updates");
3580
+ const tableData = depsToUpdate.map((dep) => ({
3581
+ package: dep.name,
3582
+ old: dep.version,
3583
+ new: targetVersion
3584
+ }));
3585
+ logger.table(tableData);
3586
+ }
3587
+ async function updateConfirmation(depsToUpdate, targetVersion) {
3588
+ printUpdateTable(depsToUpdate, targetVersion);
3589
+ let confirmMessage = "Would you like to apply those updates?";
3590
+ return await confirm({
3591
+ message: confirmMessage
3592
+ });
3593
+ }
3594
+ async function getPackageJson(absoluteProjectPath) {
3595
+ const packageJsonPath = join5(absoluteProjectPath, "package.json");
3596
+ const readonlyPackageJson = Object.freeze(await readJSONFile(packageJsonPath));
3597
+ const packageJson = structuredClone(readonlyPackageJson);
3598
+ return { packageJson, readonlyPackageJson, packageJsonPath };
3599
+ }
3600
+
3331
3601
  // src/commands/deploy.ts
3332
3602
  var DeployCommandOptions = CommonCommandOptions.extend({
3333
- skipTypecheck: z4.boolean().default(false),
3334
- skipDeploy: z4.boolean().default(false),
3335
- ignoreEnvVarCheck: z4.boolean().default(false),
3336
- env: z4.enum(["prod", "staging"]),
3337
- loadImage: z4.boolean().default(false),
3338
- buildPlatform: z4.enum(["linux/amd64", "linux/arm64"]).default("linux/amd64"),
3339
- selfHosted: z4.boolean().default(false),
3340
- registry: z4.string().optional(),
3341
- push: z4.boolean().default(false),
3342
- config: z4.string().optional(),
3343
- projectRef: z4.string().optional(),
3344
- outputMetafile: z4.string().optional(),
3345
- apiUrl: z4.string().optional(),
3346
- saveLogs: z4.boolean().default(false)
3603
+ skipTypecheck: z5.boolean().default(false),
3604
+ skipDeploy: z5.boolean().default(false),
3605
+ ignoreEnvVarCheck: z5.boolean().default(false),
3606
+ env: z5.enum(["prod", "staging"]),
3607
+ loadImage: z5.boolean().default(false),
3608
+ buildPlatform: z5.enum(["linux/amd64", "linux/arm64"]).default("linux/amd64"),
3609
+ selfHosted: z5.boolean().default(false),
3610
+ registry: z5.string().optional(),
3611
+ push: z5.boolean().default(false),
3612
+ config: z5.string().optional(),
3613
+ projectRef: z5.string().optional(),
3614
+ outputMetafile: z5.string().optional(),
3615
+ apiUrl: z5.string().optional(),
3616
+ saveLogs: z5.boolean().default(false),
3617
+ skipUpdateCheck: z5.boolean().default(false)
3347
3618
  });
3348
3619
  function configureDeployCommand(program2) {
3349
3620
  return commonOptions(
@@ -3351,7 +3622,7 @@ function configureDeployCommand(program2) {
3351
3622
  "-e, --env <env>",
3352
3623
  "Deploy to a specific environment (currently only prod and staging are supported)",
3353
3624
  "prod"
3354
- ).option("--skip-typecheck", "Whether to skip the pre-build typecheck").option(
3625
+ ).option("--skip-typecheck", "Whether to skip the pre-build typecheck").option("--skip-update-check", "Skip checking for @trigger.dev package updates").option(
3355
3626
  "--ignore-env-var-check",
3356
3627
  "Detected missing environment variables won't block deployment"
3357
3628
  ).option("-c, --config <config file>", "The name of the config file, found at [path]").option(
@@ -3409,7 +3680,10 @@ async function deployCommand(dir, options) {
3409
3680
  }
3410
3681
  async function _deployCommand(dir, options) {
3411
3682
  const span = trace2.getSpan(context.active());
3412
- intro3("Deploying project");
3683
+ intro4("Deploying project");
3684
+ if (!options.skipUpdateCheck) {
3685
+ await updateTriggerPackages(dir, { ...options }, true, true);
3686
+ }
3413
3687
  const authorization = await login({
3414
3688
  embedded: true,
3415
3689
  defaultApiUrl: options.apiUrl,
@@ -3452,7 +3726,7 @@ async function _deployCommand(dir, options) {
3452
3726
  throw new Error(deploymentEnv.error);
3453
3727
  }
3454
3728
  const environmentClient = new CliApiClient(authorization.auth.apiUrl, deploymentEnv.data.apiKey);
3455
- log3.step(
3729
+ log5.step(
3456
3730
  `Preparing to deploy "${deploymentEnv.data.name}" (${resolvedConfig.config.project}) to ${options.env}`
3457
3731
  );
3458
3732
  const compilation = await compileProject(
@@ -3555,7 +3829,7 @@ async function _deployCommand(dir, options) {
3555
3829
  printWarnings(warnings.warnings);
3556
3830
  if (options.saveLogs) {
3557
3831
  const logPath = await saveLogs(deploymentResponse.data.shortCode, image.logs);
3558
- log3.info(`Build logs have been saved to ${logPath}`);
3832
+ log5.info(`Build logs have been saved to ${logPath}`);
3559
3833
  }
3560
3834
  };
3561
3835
  const imageReference = options.selfHosted ? `${selfHostedRegistryHost ? `${selfHostedRegistryHost}/` : ""}${image.image}${image.digest ? `@${image.digest}` : ""}` : `${registryHost}/${image.image}${image.digest ? `@${image.digest}` : ""}`;
@@ -3612,11 +3886,11 @@ async function _deployCommand(dir, options) {
3612
3886
  await preExitTasks();
3613
3887
  const taskCount = finishedDeployment.worker?.tasks.length ?? 0;
3614
3888
  if (taskCount === 0) {
3615
- outro3(
3889
+ outro4(
3616
3890
  `Version ${version2} deployed with no detected tasks. Please make sure you are exporting tasks in your project. ${deploymentLink}`
3617
3891
  );
3618
3892
  } else {
3619
- outro3(
3893
+ outro4(
3620
3894
  `Version ${version2} deployed with ${taskCount} detected task${taskCount === 1 ? "" : "s"} ${deploymentLink}`
3621
3895
  );
3622
3896
  }
@@ -3672,12 +3946,12 @@ async function _deployCommand(dir, options) {
3672
3946
  }
3673
3947
  function printErrors(errors) {
3674
3948
  for (const error of errors ?? []) {
3675
- log3.error(`${chalkError("Error:")} ${error}`);
3949
+ log5.error(`${chalkError("Error:")} ${error}`);
3676
3950
  }
3677
3951
  }
3678
3952
  function printWarnings(warnings) {
3679
3953
  for (const warning of warnings ?? []) {
3680
- log3.warn(`${chalkWarning("Warning:")} ${warning}`);
3954
+ log5.warn(`${chalkWarning("Warning:")} ${warning}`);
3681
3955
  }
3682
3956
  }
3683
3957
  function checkLogsForWarnings(logs) {
@@ -3751,7 +4025,7 @@ If it's a binary: Please ${terminalLink2(
3751
4025
  continue;
3752
4026
  }
3753
4027
  const message = getMessageFromTemplate(error.message, matches.groups);
3754
- log3.error(`${chalkError("Error:")} ${message}`);
4028
+ log5.error(`${chalkError("Error:")} ${message}`);
3755
4029
  break;
3756
4030
  }
3757
4031
  }
@@ -3765,7 +4039,7 @@ function getMessageFromTemplate(template, replacer) {
3765
4039
  return message;
3766
4040
  }
3767
4041
  async function saveLogs(shortCode, logs) {
3768
- const logPath = join5(await createTempDir(), `build-${shortCode}.log`);
4042
+ const logPath = join6(await createTempDir(), `build-${shortCode}.log`);
3769
4043
  await writeFile2(logPath, logs);
3770
4044
  return logPath;
3771
4045
  }
@@ -3776,9 +4050,9 @@ async function failDeploy(shortCode, errorSummary, logs, deploymentSpinner, warn
3776
4050
  printWarnings(warnings);
3777
4051
  printErrors(errors);
3778
4052
  checkLogsForErrors(logs);
3779
- outro3(`${chalkError("Error:")} ${errorSummary}. Full build logs have been saved to ${logPath}`);
4053
+ outro4(`${chalkError("Error:")} ${errorSummary}. Full build logs have been saved to ${logPath}`);
3780
4054
  } else {
3781
- outro3(`${chalkError("Error:")} ${errorSummary}.`);
4055
+ outro4(`${chalkError("Error:")} ${errorSummary}.`);
3782
4056
  }
3783
4057
  }
3784
4058
  async function checkEnvVars(envVars, config, options, environmentClient, apiUrl) {
@@ -4099,10 +4373,10 @@ async function compileProject(config, options, configPath) {
4099
4373
  compileSpinner.start(`Building project in ${config.projectDir}`);
4100
4374
  const taskFiles = await gatherTaskFiles(config);
4101
4375
  const workerFacade = readFileSync2(
4102
- join5(cliRootPath(), "workers", "prod", "worker-facade.js"),
4376
+ join6(cliRootPath(), "workers", "prod", "worker-facade.js"),
4103
4377
  "utf-8"
4104
4378
  );
4105
- const workerSetupPath = join5(cliRootPath(), "workers", "prod", "worker-setup.js");
4379
+ const workerSetupPath = join6(cliRootPath(), "workers", "prod", "worker-setup.js");
4106
4380
  let workerContents = workerFacade.replace("__TASKS__", createTaskFileImports(taskFiles)).replace(
4107
4381
  "__WORKER_SETUP__",
4108
4382
  `import { tracingSDK } from "${escapeImportPath(workerSetupPath)}";`
@@ -4162,10 +4436,10 @@ async function compileProject(config, options, configPath) {
4162
4436
  throw new Error("Build failed, aborting deployment");
4163
4437
  }
4164
4438
  if (options.outputMetafile) {
4165
- await writeJSONFile(join5(options.outputMetafile, "worker.json"), result.metafile);
4439
+ await writeJSONFile(join6(options.outputMetafile, "worker.json"), result.metafile);
4166
4440
  }
4167
4441
  const entryPointContents = readFileSync2(
4168
- join5(cliRootPath(), "workers", "prod", "entry-point.js"),
4442
+ join6(cliRootPath(), "workers", "prod", "entry-point.js"),
4169
4443
  "utf-8"
4170
4444
  );
4171
4445
  const entryPointResult = await build2({
@@ -4208,7 +4482,7 @@ async function compileProject(config, options, configPath) {
4208
4482
  }
4209
4483
  if (options.outputMetafile) {
4210
4484
  await writeJSONFile(
4211
- join5(options.outputMetafile, "entry-point.json"),
4485
+ join6(options.outputMetafile, "entry-point.json"),
4212
4486
  entryPointResult.metafile
4213
4487
  );
4214
4488
  }
@@ -4219,24 +4493,24 @@ async function compileProject(config, options, configPath) {
4219
4493
  const entryPointMetaOutput = entryPointResult.metafile.outputs[posix.join("out", "stdin.js")];
4220
4494
  invariant(entryPointMetaOutput, "Meta output for the entryPoint build is missing");
4221
4495
  const workerOutputFile = result.outputFiles.find(
4222
- (file) => file.path === join5(config.projectDir, "out", "stdin.js")
4496
+ (file) => file.path === join6(config.projectDir, "out", "stdin.js")
4223
4497
  );
4224
4498
  invariant(workerOutputFile, "Output file for the result build is missing");
4225
4499
  const workerSourcemapFile = result.outputFiles.find(
4226
- (file) => file.path === join5(config.projectDir, "out", "stdin.js.map")
4500
+ (file) => file.path === join6(config.projectDir, "out", "stdin.js.map")
4227
4501
  );
4228
4502
  invariant(workerSourcemapFile, "Sourcemap file for the result build is missing");
4229
4503
  const entryPointOutputFile = entryPointResult.outputFiles.find(
4230
- (file) => file.path === join5(config.projectDir, "out", "stdin.js")
4504
+ (file) => file.path === join6(config.projectDir, "out", "stdin.js")
4231
4505
  );
4232
4506
  invariant(entryPointOutputFile, "Output file for the entryPoint build is missing");
4233
4507
  await writeFile2(
4234
- join5(tempDir, "worker.js"),
4508
+ join6(tempDir, "worker.js"),
4235
4509
  `${workerOutputFile.text}
4236
4510
  //# sourceMappingURL=worker.js.map`
4237
4511
  );
4238
- await writeFile2(join5(tempDir, "worker.js.map"), workerSourcemapFile.text);
4239
- await writeFile2(join5(tempDir, "index.js"), entryPointOutputFile.text);
4512
+ await writeFile2(join6(tempDir, "worker.js.map"), workerSourcemapFile.text);
4513
+ await writeFile2(join6(tempDir, "index.js"), entryPointOutputFile.text);
4240
4514
  logger.debug("Getting the imports for the worker and entryPoint builds", {
4241
4515
  workerImports: metaOutput.imports,
4242
4516
  entryPointImports: entryPointMetaOutput.imports
@@ -4253,11 +4527,11 @@ async function compileProject(config, options, configPath) {
4253
4527
  ...javascriptProject.scripts
4254
4528
  }
4255
4529
  };
4256
- await writeJSONFile(join5(tempDir, "package.json"), packageJsonContents);
4530
+ await writeJSONFile(join6(tempDir, "package.json"), packageJsonContents);
4257
4531
  const copyResult = await copyAdditionalFiles(config, tempDir);
4258
4532
  if (!copyResult.ok) {
4259
4533
  compileSpinner.stop("Project built with warnings");
4260
- log3.warn(
4534
+ log5.warn(
4261
4535
  `No additionalFiles matches for:
4262
4536
 
4263
4537
  ${copyResult.noMatches.map((glob) => `- "${glob}"`).join("\n")}
@@ -4279,8 +4553,8 @@ If this is unexpected you should check your ${terminalLink2(
4279
4553
  if (!resolvingDependenciesResult) {
4280
4554
  throw new SkipLoggingError("Failed to resolve dependencies");
4281
4555
  }
4282
- const containerFilePath = join5(cliRootPath(), "Containerfile.prod");
4283
- await copyFile(containerFilePath, join5(tempDir, "Containerfile"));
4556
+ const containerFilePath = join6(cliRootPath(), "Containerfile.prod");
4557
+ await copyFile(containerFilePath, join6(tempDir, "Containerfile"));
4284
4558
  const contentHasher = createHash("sha256");
4285
4559
  contentHasher.update(Buffer.from(entryPointOutputFile.text));
4286
4560
  contentHasher.update(Buffer.from(workerOutputFile.text));
@@ -4312,8 +4586,8 @@ async function resolveDependencies(projectDir, packageJsonContents, config, opti
4312
4586
  const hasher = createHash("sha256");
4313
4587
  hasher.update(JSON.stringify(packageJsonContents));
4314
4588
  const digest = hasher.digest("hex").slice(0, 16);
4315
- const cacheDir = join5(config.projectDir, ".trigger", "cache");
4316
- const cachePath = join5(cacheDir, `${digest}.json`);
4589
+ const cacheDir = join6(config.projectDir, ".trigger", "cache");
4590
+ const cachePath = join6(cacheDir, `${digest}.json`);
4317
4591
  span.setAttributes({
4318
4592
  "packageJson.digest": digest,
4319
4593
  "cache.path": cachePath,
@@ -4322,7 +4596,7 @@ async function resolveDependencies(projectDir, packageJsonContents, config, opti
4322
4596
  try {
4323
4597
  const cachedPackageLock = await readFile2(cachePath, "utf-8");
4324
4598
  logger.debug(`Using cached package-lock.json for ${digest}`);
4325
- await writeFile2(join5(projectDir, "package-lock.json"), cachedPackageLock);
4599
+ await writeFile2(join6(projectDir, "package-lock.json"), cachedPackageLock);
4326
4600
  span.setAttributes({
4327
4601
  "cache.hit": true
4328
4602
  });
@@ -4345,11 +4619,11 @@ async function resolveDependencies(projectDir, packageJsonContents, config, opti
4345
4619
  cwd: projectDir,
4346
4620
  stdio: logger.loggerLevel === "debug" ? "inherit" : "pipe"
4347
4621
  });
4348
- const packageLockContents = await readFile2(join5(projectDir, "package-lock.json"), "utf-8");
4622
+ const packageLockContents = await readFile2(join6(projectDir, "package-lock.json"), "utf-8");
4349
4623
  logger.debug(`Writing package-lock.json to cache for ${digest}`);
4350
4624
  await mkdir(cacheDir, { recursive: true });
4351
4625
  await writeFile2(cachePath, packageLockContents);
4352
- await writeFile2(join5(projectDir, "package-lock.json"), packageLockContents);
4626
+ await writeFile2(join6(projectDir, "package-lock.json"), packageLockContents);
4353
4627
  span.end();
4354
4628
  resolvingDepsSpinner.stop("Dependencies resolved");
4355
4629
  return true;
@@ -4401,8 +4675,8 @@ async function typecheckProject(config, options) {
4401
4675
  tscTypecheck.stdout?.on("data", (chunk) => stdouts.push(chunk.toString()));
4402
4676
  tscTypecheck.stderr?.on("data", (chunk) => stderrs.push(chunk.toString()));
4403
4677
  try {
4404
- await new Promise((resolve4, reject) => {
4405
- tscTypecheck.addListener("exit", (code) => code === 0 ? resolve4(code) : reject(code));
4678
+ await new Promise((resolve5, reject) => {
4679
+ tscTypecheck.addListener("exit", (code) => code === 0 ? resolve5(code) : reject(code));
4406
4680
  });
4407
4681
  } catch (error) {
4408
4682
  typecheckSpinner.stop(
@@ -4520,7 +4794,7 @@ async function copyAdditionalFiles(config, tempDir) {
4520
4794
  for await (const file of glob) {
4521
4795
  matches++;
4522
4796
  const pathInsideTempDir = relative3(config.projectDir, file.fullpath()).split(posix.sep).filter((p) => p !== "..").join(posix.sep);
4523
- const relativeDestinationPath = join5(tempDir, pathInsideTempDir);
4797
+ const relativeDestinationPath = join6(tempDir, pathInsideTempDir);
4524
4798
  logger.debug(`Copying file ${file.fullpath()} to ${relativeDestinationPath}`);
4525
4799
  await mkdir(dirname(relativeDestinationPath), { recursive: true });
4526
4800
  await copyFile(file.fullpath(), relativeDestinationPath);
@@ -4551,7 +4825,7 @@ async function copyAdditionalFiles(config, tempDir) {
4551
4825
  }
4552
4826
  async function ensureLoggedIntoDockerRegistry(registryHost, auth) {
4553
4827
  const tmpDir = await createTempDir();
4554
- const dockerConfigPath = join5(tmpDir, "config.json");
4828
+ const dockerConfigPath = join6(tmpDir, "config.json");
4555
4829
  await writeJSONFile(dockerConfigPath, {
4556
4830
  auths: {
4557
4831
  [registryHost]: {
@@ -4586,22 +4860,23 @@ function arrayToSentence(items) {
4586
4860
 
4587
4861
  // src/commands/dev.tsx
4588
4862
  import {
4863
+ ZodMessageHandler as ZodMessageHandler2,
4864
+ ZodMessageSender as ZodMessageSender2,
4589
4865
  clientWebsocketMessages,
4590
4866
  detectDependencyVersion as detectDependencyVersion2,
4591
4867
  serverWebsocketMessages
4592
4868
  } from "@trigger.dev/core/v3";
4593
- import { ZodMessageHandler as ZodMessageHandler2, ZodMessageSender as ZodMessageSender2 } from "@trigger.dev/core/v3/zodMessageHandler";
4594
4869
  import { watch } from "chokidar";
4595
4870
  import { context as context2 } from "esbuild";
4596
4871
  import { render, useInput } from "ink";
4597
4872
  import { createHash as createHash2 } from "node:crypto";
4598
4873
  import fs7, { readFileSync as readFileSync3 } from "node:fs";
4599
- import { basename, dirname as dirname3, join as join6, normalize } from "node:path";
4874
+ import { basename as basename2, dirname as dirname3, join as join7, normalize } from "node:path";
4600
4875
  import pDebounce from "p-debounce";
4601
4876
  import { WebSocket } from "partysocket";
4602
4877
  import React, { Suspense, useEffect } from "react";
4603
4878
  import { WebSocket as wsWebSocket } from "ws";
4604
- import { z as z5 } from "zod";
4879
+ import { z as z6 } from "zod";
4605
4880
 
4606
4881
  // src/workers/common/errors.ts
4607
4882
  var UncaughtExceptionError = class extends Error {
@@ -4625,16 +4900,17 @@ var TaskMetadataParseError = class extends Error {
4625
4900
  import {
4626
4901
  SemanticInternalAttributes,
4627
4902
  TaskRunErrorCodes,
4903
+ ZodMessageHandler,
4904
+ ZodMessageSender,
4628
4905
  childToWorkerMessages,
4629
4906
  correctErrorStackTrace,
4630
4907
  formatDurationMilliseconds,
4631
4908
  workerToChildMessages
4632
4909
  } from "@trigger.dev/core/v3";
4633
- import { ZodMessageHandler, ZodMessageSender } from "@trigger.dev/core/v3/zodMessageHandler";
4634
4910
  import dotenv from "dotenv";
4635
4911
  import { Evt } from "evt";
4636
4912
  import { fork } from "node:child_process";
4637
- import { dirname as dirname2, resolve as resolve2 } from "node:path";
4913
+ import { dirname as dirname2, resolve as resolve3 } from "node:path";
4638
4914
  import terminalLink3 from "terminal-link";
4639
4915
  var BackgroundWorkerCoordinator = class {
4640
4916
  constructor(baseURL) {
@@ -4834,7 +5110,7 @@ var BackgroundWorker = class {
4834
5110
  ...this.#readEnvVars()
4835
5111
  };
4836
5112
  logger.debug("Initializing worker", { path: this.path, cwd, fullEnv });
4837
- this.tasks = await new Promise((resolve4, reject) => {
5113
+ this.tasks = await new Promise((resolve5, reject) => {
4838
5114
  const child = fork(this.path, {
4839
5115
  stdio: [
4840
5116
  /*stdin*/
@@ -4861,7 +5137,7 @@ var BackgroundWorker = class {
4861
5137
  if (message.type === "TASKS_READY" && !resolved) {
4862
5138
  clearTimeout(timeout);
4863
5139
  resolved = true;
4864
- resolve4(message.payload.tasks);
5140
+ resolve5(message.payload.tasks);
4865
5141
  child.kill();
4866
5142
  } else if (message.type === "UNCAUGHT_EXCEPTION") {
4867
5143
  clearTimeout(timeout);
@@ -4996,7 +5272,7 @@ var BackgroundWorker = class {
4996
5272
  const result = {};
4997
5273
  dotenv.config({
4998
5274
  processEnv: result,
4999
- path: [".env", ".env.local", ".env.development.local"].map((p) => resolve2(process.cwd(), p))
5275
+ path: [".env", ".env.local", ".env.development.local"].map((p) => resolve3(process.cwd(), p))
5000
5276
  });
5001
5277
  process.env.TRIGGER_API_URL && (result.TRIGGER_API_URL = process.env.TRIGGER_API_URL);
5002
5278
  delete result.TRIGGER_API_URL;
@@ -5097,8 +5373,8 @@ var TaskRunProcess = class {
5097
5373
  async executeTaskRun(payload) {
5098
5374
  let resolver;
5099
5375
  let rejecter;
5100
- const promise = new Promise((resolve4, reject) => {
5101
- resolver = resolve4;
5376
+ const promise = new Promise((resolve5, reject) => {
5377
+ resolver = resolve5;
5102
5378
  rejecter = reject;
5103
5379
  });
5104
5380
  this._attemptStatuses.set(payload.execution.attempt.id, "PENDING");
@@ -5241,17 +5517,18 @@ function runtimeCheck(minimumMajor, minimumMinor) {
5241
5517
  import { findUp as findUp3, pathExists as pathExists2 } from "find-up";
5242
5518
  var apiClient;
5243
5519
  var DevCommandOptions = CommonCommandOptions.extend({
5244
- debugger: z5.boolean().default(false),
5245
- debugOtel: z5.boolean().default(false),
5246
- config: z5.string().optional(),
5247
- projectRef: z5.string().optional()
5520
+ debugger: z6.boolean().default(false),
5521
+ debugOtel: z6.boolean().default(false),
5522
+ config: z6.string().optional(),
5523
+ projectRef: z6.string().optional(),
5524
+ skipUpdateCheck: z6.boolean().default(false)
5248
5525
  });
5249
5526
  function configureDevCommand(program2) {
5250
5527
  return commonOptions(
5251
5528
  program2.command("dev").description("Run your Trigger.dev tasks locally").argument("[path]", "The path to the project", ".").option("-c, --config <config file>", "The name of the config file, found at [path].").option(
5252
5529
  "-p, --project-ref <project ref>",
5253
5530
  "The project ref. Required if there is no config file."
5254
- ).option("--debugger", "Enable the debugger").option("--debug-otel", "Enable OpenTelemetry debugging")
5531
+ ).option("--debugger", "Enable the debugger").option("--debug-otel", "Enable OpenTelemetry debugging").option("--skip-update-check", "Skip checking for @trigger.dev package updates")
5255
5532
  ).action(async (path7, options) => {
5256
5533
  wrapCommandAction("dev", DevCommandOptions, options, async (opts) => {
5257
5534
  await devCommand(path7, opts);
@@ -5293,7 +5570,11 @@ async function startDev(dir, options, authorization, dashboardUrl) {
5293
5570
  logger.loggerLevel = options.logLevel;
5294
5571
  }
5295
5572
  await printStandloneInitialBanner(true);
5296
- printDevBanner();
5573
+ if (!options.skipUpdateCheck) {
5574
+ console.log();
5575
+ await updateTriggerPackages(dir, { ...options }, false, true);
5576
+ }
5577
+ printDevBanner(!options.skipUpdateCheck);
5297
5578
  logger.debug("Starting dev session", { dir, options, authorization });
5298
5579
  let config = await readConfig(dir, {
5299
5580
  projectRef: options.projectRef,
@@ -5458,9 +5739,9 @@ function useDev({
5458
5739
  }
5459
5740
  let latestWorkerContentHash;
5460
5741
  const taskFiles = await gatherTaskFiles(config);
5461
- const workerFacadePath = join6(cliRootPath(), "workers", "dev", "worker-facade.js");
5742
+ const workerFacadePath = join7(cliRootPath(), "workers", "dev", "worker-facade.js");
5462
5743
  const workerFacade = readFileSync3(workerFacadePath, "utf-8");
5463
- const workerSetupPath = join6(cliRootPath(), "workers", "dev", "worker-setup.js");
5744
+ const workerSetupPath = join7(cliRootPath(), "workers", "dev", "worker-setup.js");
5464
5745
  let entryPointContents = workerFacade.replace("__TASKS__", createTaskFileImports(taskFiles)).replace(
5465
5746
  "__WORKER_SETUP__",
5466
5747
  `import { tracingSDK, sender } from "${escapeImportPath(workerSetupPath)}";`
@@ -5525,7 +5806,7 @@ function useDev({
5525
5806
  if (!firstBuild) {
5526
5807
  logger.log(chalkGrey("\u25CB Building background worker\u2026"));
5527
5808
  }
5528
- const metaOutputKey = join6("out", `stdin.js`).replace(/\\/g, "/");
5809
+ const metaOutputKey = join7("out", `stdin.js`).replace(/\\/g, "/");
5529
5810
  logger.debug("Metafile", {
5530
5811
  metafileOutputs: JSON.stringify(result.metafile?.outputs)
5531
5812
  });
@@ -5533,14 +5814,14 @@ function useDev({
5533
5814
  if (!metaOutput) {
5534
5815
  throw new Error(`Could not find metafile`);
5535
5816
  }
5536
- const outputFileKey = join6(config.projectDir, metaOutputKey);
5817
+ const outputFileKey = join7(config.projectDir, metaOutputKey);
5537
5818
  const outputFile = result.outputFiles.find((file) => file.path === outputFileKey);
5538
5819
  if (!outputFile) {
5539
5820
  throw new Error(
5540
5821
  `Could not find output file for entry point ${metaOutput.entryPoint}`
5541
5822
  );
5542
5823
  }
5543
- const sourceMapFileKey = join6(config.projectDir, `${metaOutputKey}.map`);
5824
+ const sourceMapFileKey = join7(config.projectDir, `${metaOutputKey}.map`);
5544
5825
  const sourceMapFile = result.outputFiles.find(
5545
5826
  (file) => file.path === sourceMapFileKey
5546
5827
  );
@@ -5551,10 +5832,10 @@ function useDev({
5551
5832
  logger.log(chalkGrey("\u25CB No changes detected, skipping build\u2026"));
5552
5833
  return;
5553
5834
  }
5554
- const fullPath = join6(config.projectDir, ".trigger", `${contentHash}.js`);
5835
+ const fullPath = join7(config.projectDir, ".trigger", `${contentHash}.js`);
5555
5836
  const sourceMapPath = `${fullPath}.map`;
5556
5837
  const outputFileWithSourceMap = `${outputFile.text}
5557
- //# sourceMappingURL=${basename(sourceMapPath)}`;
5838
+ //# sourceMappingURL=${basename2(sourceMapPath)}`;
5558
5839
  await fs7.promises.mkdir(dirname3(fullPath), { recursive: true });
5559
5840
  await fs7.promises.writeFile(fullPath, outputFileWithSourceMap);
5560
5841
  logger.debug(`Wrote background worker to ${fullPath}`);
@@ -5758,7 +6039,7 @@ async function gatherRequiredDependencies2(outputMeta, config) {
5758
6039
  }
5759
6040
  }
5760
6041
  if (config.additionalPackages) {
5761
- const projectPackageJson = await readJSONFile(join6(config.projectDir, "package.json"));
6042
+ const projectPackageJson = await readJSONFile(join7(config.projectDir, "package.json"));
5762
6043
  for (const packageName of config.additionalPackages) {
5763
6044
  if (dependencies2[packageName]) {
5764
6045
  continue;
@@ -5828,7 +6109,7 @@ async function amendNodePathWithPnpmNodeModules(nodePath) {
5828
6109
  async function findPnpmNodeModulesPath() {
5829
6110
  return await findUp3(
5830
6111
  async (directory) => {
5831
- const pnpmModules = join6(directory, "node_modules", ".pnpm", "node_modules");
6112
+ const pnpmModules = join7(directory, "node_modules", ".pnpm", "node_modules");
5832
6113
  const hasPnpmNodeModules = await pathExists2(pnpmModules);
5833
6114
  if (hasPnpmNodeModules) {
5834
6115
  return pnpmModules;
@@ -5839,17 +6120,19 @@ async function findPnpmNodeModulesPath() {
5839
6120
  }
5840
6121
 
5841
6122
  // src/commands/init.ts
5842
- import { intro as intro4, isCancel, log as log4, outro as outro4, select as select2, text } from "@clack/prompts";
6123
+ import { intro as intro5, isCancel as isCancel2, log as log6, outro as outro5, select as select2, text } from "@clack/prompts";
5843
6124
  import { context as context3, trace as trace3 } from "@opentelemetry/api";
5844
- import { flattenAttributes as flattenAttributes3 } from "@trigger.dev/core/v3";
5845
- import { recordSpanException as recordSpanException5 } from "@trigger.dev/core/v3/workers";
6125
+ import {
6126
+ flattenAttributes as flattenAttributes3,
6127
+ recordSpanException as recordSpanException5
6128
+ } from "@trigger.dev/core/v3";
5846
6129
  import chalk6 from "chalk";
5847
6130
  import { execa as execa3 } from "execa";
5848
6131
  import { applyEdits, modify } from "jsonc-parser";
5849
6132
  import { writeFile as writeFile3 } from "node:fs/promises";
5850
- import { join as join7, relative as relative4, resolve as resolve3 } from "node:path";
6133
+ import { join as join8, relative as relative4, resolve as resolve4 } from "node:path";
5851
6134
  import terminalLink4 from "terminal-link";
5852
- import { z as z6 } from "zod";
6135
+ import { z as z7 } from "zod";
5853
6136
 
5854
6137
  // src/utilities/createFileFromTemplate.ts
5855
6138
  import fs8 from "fs/promises";
@@ -5894,10 +6177,10 @@ function replaceAll(input, replacements) {
5894
6177
 
5895
6178
  // src/commands/init.ts
5896
6179
  var InitCommandOptions = CommonCommandOptions.extend({
5897
- projectRef: z6.string().optional(),
5898
- overrideConfig: z6.boolean().default(false),
5899
- tag: z6.string().default("beta"),
5900
- skipPackageInstall: z6.boolean().default(false)
6180
+ projectRef: z7.string().optional(),
6181
+ overrideConfig: z7.boolean().default(false),
6182
+ tag: z7.string().default("beta"),
6183
+ skipPackageInstall: z7.boolean().default(false)
5901
6184
  });
5902
6185
  function configureInitCommand(program2) {
5903
6186
  return commonOptions(
@@ -5923,7 +6206,7 @@ async function initCommand(dir, options) {
5923
6206
  }
5924
6207
  async function _initCommand(dir, options) {
5925
6208
  const span = trace3.getSpan(context3.active());
5926
- intro4("Initializing project");
6209
+ intro5("Initializing project");
5927
6210
  const authorization = await login({
5928
6211
  embedded: true,
5929
6212
  defaultApiUrl: options.apiUrl,
@@ -5947,7 +6230,7 @@ async function _initCommand(dir, options) {
5947
6230
  if (!options.overrideConfig) {
5948
6231
  try {
5949
6232
  const result = await readConfig(dir);
5950
- outro4(
6233
+ outro5(
5951
6234
  result.status === "file" ? `Project already initialized: Found config file at ${result.path}. Pass --override-config to override` : "Project already initialized"
5952
6235
  );
5953
6236
  return;
@@ -5964,11 +6247,11 @@ async function _initCommand(dir, options) {
5964
6247
  ...flattenAttributes3(selectedProject, "cli.project")
5965
6248
  });
5966
6249
  logger.debug("Selected project", selectedProject);
5967
- log4.step(`Configuring project "${selectedProject.name}" (${selectedProject.externalRef})`);
6250
+ log6.step(`Configuring project "${selectedProject.name}" (${selectedProject.externalRef})`);
5968
6251
  if (!options.skipPackageInstall) {
5969
6252
  await installPackages2(dir, options);
5970
6253
  } else {
5971
- log4.info("Skipping package installation");
6254
+ log6.info("Skipping package installation");
5972
6255
  }
5973
6256
  const triggerDir = await createTriggerDir(dir, options);
5974
6257
  await writeConfigFile(dir, selectedProject, options, triggerDir);
@@ -5978,41 +6261,41 @@ async function _initCommand(dir, options) {
5978
6261
  "project dashboard",
5979
6262
  `${authorization.dashboardUrl}/projects/v3/${selectedProject.externalRef}`
5980
6263
  );
5981
- log4.success("Successfully initialized project for Trigger.dev v3 \u{1FAE1}");
5982
- log4.info("Next steps:");
5983
- log4.info(
6264
+ log6.success("Successfully initialized project for Trigger.dev v3 \u{1FAE1}");
6265
+ log6.info("Next steps:");
6266
+ log6.info(
5984
6267
  ` 1. To start developing, run ${chalk6.green(
5985
6268
  `npx trigger.dev@${options.tag} dev`
5986
6269
  )} in your project directory`
5987
6270
  );
5988
- log4.info(` 2. Visit your ${projectDashboard} to view your newly created tasks.`);
5989
- log4.info(
6271
+ log6.info(` 2. Visit your ${projectDashboard} to view your newly created tasks.`);
6272
+ log6.info(
5990
6273
  ` 3. Head over to our ${terminalLink4(
5991
6274
  "v3 docs",
5992
6275
  "https://trigger.dev/docs/v3"
5993
6276
  )} to learn more.`
5994
6277
  );
5995
- log4.info(
6278
+ log6.info(
5996
6279
  ` 4. Need help? Join our ${terminalLink4(
5997
6280
  "Discord community",
5998
6281
  "https://trigger.dev/discord"
5999
6282
  )} or email us at ${chalk6.cyan("help@trigger.dev")}`
6000
6283
  );
6001
- outro4(`Project initialized successfully. Happy coding!`);
6284
+ outro5(`Project initialized successfully. Happy coding!`);
6002
6285
  }
6003
6286
  async function createTriggerDir(dir, options) {
6004
6287
  return await tracer.startActiveSpan("createTriggerDir", async (span) => {
6005
6288
  try {
6006
- const defaultValue = join7(dir, "src", "trigger");
6289
+ const defaultValue = join8(dir, "src", "trigger");
6007
6290
  const location = await text({
6008
6291
  message: "Where would you like to create the Trigger.dev directory?",
6009
6292
  defaultValue,
6010
6293
  placeholder: defaultValue
6011
6294
  });
6012
- if (isCancel(location)) {
6295
+ if (isCancel2(location)) {
6013
6296
  throw new OutroCommandError();
6014
6297
  }
6015
- const triggerDir = resolve3(process.cwd(), location);
6298
+ const triggerDir = resolve4(process.cwd(), location);
6016
6299
  logger.debug({ triggerDir });
6017
6300
  span.setAttributes({
6018
6301
  "cli.triggerDir": triggerDir
@@ -6031,7 +6314,7 @@ async function createTriggerDir(dir, options) {
6031
6314
  }
6032
6315
  ]
6033
6316
  });
6034
- if (isCancel(exampleSelection)) {
6317
+ if (isCancel2(exampleSelection)) {
6035
6318
  throw new OutroCommandError();
6036
6319
  }
6037
6320
  const example = exampleSelection;
@@ -6039,20 +6322,20 @@ async function createTriggerDir(dir, options) {
6039
6322
  "cli.example": example
6040
6323
  });
6041
6324
  if (example === "none") {
6042
- await createFile(join7(triggerDir, ".gitkeep"), "");
6043
- log4.step(`Created directory at ${location}`);
6325
+ await createFile(join8(triggerDir, ".gitkeep"), "");
6326
+ log6.step(`Created directory at ${location}`);
6044
6327
  span.end();
6045
6328
  return { location, isCustomValue: location !== defaultValue };
6046
6329
  }
6047
- const templatePath = join7(cliRootPath(), "templates", "examples", `${example}.ts.template`);
6048
- const outputPath = join7(triggerDir, "example.ts");
6330
+ const templatePath = join8(cliRootPath(), "templates", "examples", `${example}.ts.template`);
6331
+ const outputPath = join8(triggerDir, "example.ts");
6049
6332
  await createFileFromTemplate({
6050
6333
  templatePath,
6051
6334
  outputPath,
6052
6335
  replacements: {}
6053
6336
  });
6054
6337
  const relativeOutputPath = relative4(process.cwd(), outputPath);
6055
- log4.step(`Created example file at ${relativeOutputPath}`);
6338
+ log6.step(`Created example file at ${relativeOutputPath}`);
6056
6339
  span.end();
6057
6340
  return { location, isCustomValue: location !== defaultValue };
6058
6341
  } catch (e) {
@@ -6067,15 +6350,15 @@ async function createTriggerDir(dir, options) {
6067
6350
  async function gitIgnoreDotTriggerDir(dir, options) {
6068
6351
  return await tracer.startActiveSpan("gitIgnoreDotTriggerDir", async (span) => {
6069
6352
  try {
6070
- const projectDir = resolve3(process.cwd(), dir);
6071
- const gitIgnorePath = join7(projectDir, ".gitignore");
6353
+ const projectDir = resolve4(process.cwd(), dir);
6354
+ const gitIgnorePath = join8(projectDir, ".gitignore");
6072
6355
  span.setAttributes({
6073
6356
  "cli.projectDir": projectDir,
6074
6357
  "cli.gitIgnorePath": gitIgnorePath
6075
6358
  });
6076
6359
  if (!await pathExists(gitIgnorePath)) {
6077
6360
  await createFile(gitIgnorePath, ".trigger");
6078
- log4.step(`Added .trigger to .gitignore`);
6361
+ log6.step(`Added .trigger to .gitignore`);
6079
6362
  span.end();
6080
6363
  return;
6081
6364
  }
@@ -6087,7 +6370,7 @@ async function gitIgnoreDotTriggerDir(dir, options) {
6087
6370
  const newGitIgnoreContent = `${gitIgnoreContent}
6088
6371
  .trigger`;
6089
6372
  await writeFile3(gitIgnorePath, newGitIgnoreContent, "utf-8");
6090
- log4.step(`Added .trigger to .gitignore`);
6373
+ log6.step(`Added .trigger to .gitignore`);
6091
6374
  span.end();
6092
6375
  } catch (e) {
6093
6376
  if (!(e instanceof SkipCommandError)) {
@@ -6101,8 +6384,8 @@ async function gitIgnoreDotTriggerDir(dir, options) {
6101
6384
  async function addConfigFileToTsConfig(dir, options) {
6102
6385
  return await tracer.startActiveSpan("createTriggerDir", async (span) => {
6103
6386
  try {
6104
- const projectDir = resolve3(process.cwd(), dir);
6105
- const tsconfigPath = join7(projectDir, "tsconfig.json");
6387
+ const projectDir = resolve4(process.cwd(), dir);
6388
+ const tsconfigPath = join8(projectDir, "tsconfig.json");
6106
6389
  span.setAttributes({
6107
6390
  "cli.projectDir": projectDir,
6108
6391
  "cli.tsconfigPath": tsconfigPath
@@ -6120,7 +6403,7 @@ async function addConfigFileToTsConfig(dir, options) {
6120
6403
  const newTsconfigContent = applyEdits(tsconfigContent, edits);
6121
6404
  logger.debug("new tsconfig.json content", { newTsconfigContent });
6122
6405
  await writeFile3(tsconfigPath, newTsconfigContent, "utf-8");
6123
- log4.step(`Added trigger.config.ts to tsconfig.json`);
6406
+ log6.step(`Added trigger.config.ts to tsconfig.json`);
6124
6407
  span.end();
6125
6408
  } catch (e) {
6126
6409
  if (!(e instanceof SkipCommandError)) {
@@ -6135,7 +6418,7 @@ async function installPackages2(dir, options) {
6135
6418
  return await tracer.startActiveSpan("installPackages", async (span) => {
6136
6419
  const installSpinner = spinner();
6137
6420
  try {
6138
- const projectDir = resolve3(process.cwd(), dir);
6421
+ const projectDir = resolve4(process.cwd(), dir);
6139
6422
  const pkgManager = await getUserPackageManager(projectDir);
6140
6423
  span.setAttributes({
6141
6424
  "cli.projectDir": projectDir,
@@ -6187,9 +6470,9 @@ async function writeConfigFile(dir, project, options, triggerDir) {
6187
6470
  try {
6188
6471
  const spnnr = spinner();
6189
6472
  spnnr.start("Creating config file");
6190
- const projectDir = resolve3(process.cwd(), dir);
6191
- const templatePath = join7(cliRootPath(), "templates", "trigger.config.ts.template");
6192
- const outputPath = join7(projectDir, "trigger.config.ts");
6473
+ const projectDir = resolve4(process.cwd(), dir);
6474
+ const templatePath = join8(cliRootPath(), "templates", "trigger.config.ts.template");
6475
+ const outputPath = join8(projectDir, "trigger.config.ts");
6193
6476
  span.setAttributes({
6194
6477
  "cli.projectDir": projectDir,
6195
6478
  "cli.templatePath": templatePath,
@@ -6229,7 +6512,7 @@ async function selectProject(apiClient2, dashboardUrl, projectRef) {
6229
6512
  if (projectRef) {
6230
6513
  const projectResponse = await apiClient2.getProject(projectRef);
6231
6514
  if (!projectResponse.success) {
6232
- log4.error(
6515
+ log6.error(
6233
6516
  `--project-ref ${projectRef} is not a valid project ref. Request to fetch data resulted in: ${projectResponse.error}`
6234
6517
  );
6235
6518
  throw new SkipCommandError(projectResponse.error);
@@ -6249,7 +6532,7 @@ async function selectProject(apiClient2, dashboardUrl, projectRef) {
6249
6532
  "Create new project",
6250
6533
  `${dashboardUrl}/projects/new?version=v3`
6251
6534
  );
6252
- outro4(`You don't have any projects yet. ${newProjectLink}`);
6535
+ outro5(`You don't have any projects yet. ${newProjectLink}`);
6253
6536
  throw new SkipCommandError();
6254
6537
  }
6255
6538
  const selectedProject = await select2({
@@ -6260,7 +6543,7 @@ async function selectProject(apiClient2, dashboardUrl, projectRef) {
6260
6543
  hint: project.organization.title
6261
6544
  }))
6262
6545
  });
6263
- if (isCancel(selectedProject)) {
6546
+ if (isCancel2(selectedProject)) {
6264
6547
  throw new OutroCommandError();
6265
6548
  }
6266
6549
  const projectData = projectsResponse.data.find(
@@ -6312,7 +6595,7 @@ async function logout(options) {
6312
6595
  }
6313
6596
 
6314
6597
  // src/commands/list-profiles.ts
6315
- import { log as log5, outro as outro5 } from "@clack/prompts";
6598
+ import { log as log7, outro as outro6 } from "@clack/prompts";
6316
6599
  var ListProfilesOptions = CommonCommandOptions;
6317
6600
  function configureListProfilesCommand(program2) {
6318
6601
  return program2.command("list-profiles").description("List all of your CLI profiles").option(
@@ -6338,12 +6621,12 @@ async function listProfiles(options) {
6338
6621
  return;
6339
6622
  }
6340
6623
  const profiles = Object.keys(authConfig);
6341
- log5.message("Profiles:");
6624
+ log7.message("Profiles:");
6342
6625
  for (const profile of profiles) {
6343
6626
  const profileConfig = authConfig[profile];
6344
- log5.info(`${profile}${profileConfig?.apiUrl ? ` - ${chalkGrey(profileConfig.apiUrl)}` : ""}`);
6627
+ log7.info(`${profile}${profileConfig?.apiUrl ? ` - ${chalkGrey(profileConfig.apiUrl)}` : ""}`);
6345
6628
  }
6346
- outro5("Retrieve account info by running whoami --profile <profile>");
6629
+ outro6("Retrieve account info by running whoami --profile <profile>");
6347
6630
  }
6348
6631
 
6349
6632
  // src/cli/index.ts
@@ -6356,6 +6639,7 @@ configureDeployCommand(program);
6356
6639
  configureWhoamiCommand(program);
6357
6640
  configureLogoutCommand(program);
6358
6641
  configureListProfilesCommand(program);
6642
+ configureUpdateCommand(program);
6359
6643
 
6360
6644
  // src/index.ts
6361
6645
  var main = async () => {