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

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