trigger.dev 3.0.0-beta.10 → 3.0.0-beta.12

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
@@ -57,7 +57,7 @@ var require_XDGAppPaths = __commonJS({
57
57
  return typeof t;
58
58
  }
59
59
  function Adapt(adapter_) {
60
- var meta = adapter_.meta, path6 = adapter_.path, xdg = adapter_.xdg;
60
+ var meta = adapter_.meta, path7 = adapter_.path, xdg = adapter_.xdg;
61
61
  var XDGAppPaths_ = /* @__PURE__ */ function() {
62
62
  function XDGAppPaths_2(options_) {
63
63
  if (options_ === void 0) {
@@ -79,7 +79,7 @@ var require_XDGAppPaths = __commonJS({
79
79
  meta.mainFilename()
80
80
  ];
81
81
  var nameFallback = "$eval";
82
- var name = path6.parse(((_c = namePriorityList.find(function(e) {
82
+ var name = path7.parse(((_c = namePriorityList.find(function(e) {
83
83
  return isString(e);
84
84
  })) !== null && _c !== void 0 ? _c : nameFallback) + suffix).name;
85
85
  XDGAppPaths.$name = function $name() {
@@ -98,28 +98,28 @@ var require_XDGAppPaths = __commonJS({
98
98
  return isIsolated(dirOptions) ? name : "";
99
99
  }
100
100
  XDGAppPaths.cache = function cache(dirOptions) {
101
- return path6.join(xdg.cache(), finalPathSegment(dirOptions));
101
+ return path7.join(xdg.cache(), finalPathSegment(dirOptions));
102
102
  };
103
103
  XDGAppPaths.config = function config(dirOptions) {
104
- return path6.join(xdg.config(), finalPathSegment(dirOptions));
104
+ return path7.join(xdg.config(), finalPathSegment(dirOptions));
105
105
  };
106
106
  XDGAppPaths.data = function data(dirOptions) {
107
- return path6.join(xdg.data(), finalPathSegment(dirOptions));
107
+ return path7.join(xdg.data(), finalPathSegment(dirOptions));
108
108
  };
109
109
  XDGAppPaths.runtime = function runtime(dirOptions) {
110
- return xdg.runtime() ? path6.join(xdg.runtime(), finalPathSegment(dirOptions)) : void 0;
110
+ return xdg.runtime() ? path7.join(xdg.runtime(), finalPathSegment(dirOptions)) : void 0;
111
111
  };
112
112
  XDGAppPaths.state = function state(dirOptions) {
113
- return path6.join(xdg.state(), finalPathSegment(dirOptions));
113
+ return path7.join(xdg.state(), finalPathSegment(dirOptions));
114
114
  };
115
115
  XDGAppPaths.configDirs = function configDirs(dirOptions) {
116
116
  return xdg.configDirs().map(function(s) {
117
- return path6.join(s, finalPathSegment(dirOptions));
117
+ return path7.join(s, finalPathSegment(dirOptions));
118
118
  });
119
119
  };
120
120
  XDGAppPaths.dataDirs = function dataDirs(dirOptions) {
121
121
  return xdg.dataDirs().map(function(s) {
122
- return path6.join(s, finalPathSegment(dirOptions));
122
+ return path7.join(s, finalPathSegment(dirOptions));
123
123
  });
124
124
  };
125
125
  return XDGAppPaths;
@@ -144,14 +144,14 @@ var require_XDG = __commonJS({
144
144
  exports.__esModule = true;
145
145
  exports.Adapt = void 0;
146
146
  function Adapt(adapter_) {
147
- var env = adapter_.env, osPaths = adapter_.osPaths, path6 = adapter_.path;
147
+ var env = adapter_.env, osPaths = adapter_.osPaths, path7 = adapter_.path;
148
148
  var isMacOS = /^darwin$/i.test(adapter_.process.platform);
149
149
  var isWinOS = /^win/i.test(adapter_.process.platform);
150
150
  function baseDir() {
151
151
  return osPaths.home() || osPaths.temp();
152
152
  }
153
153
  function valOrPath(val, pathSegments) {
154
- return val || path6.join.apply(path6, pathSegments);
154
+ return val || path7.join.apply(path7, pathSegments);
155
155
  }
156
156
  var linux = function() {
157
157
  var cache = function() {
@@ -226,11 +226,11 @@ var require_XDG = __commonJS({
226
226
  XDG.state = extension.state;
227
227
  XDG.configDirs = function configDirs() {
228
228
  var pathList = env.get("XDG_CONFIG_DIRS");
229
- return __spreadArray([extension.config()], pathList ? pathList.split(path6.delimiter) : []);
229
+ return __spreadArray([extension.config()], pathList ? pathList.split(path7.delimiter) : []);
230
230
  };
231
231
  XDG.dataDirs = function dataDirs() {
232
232
  var pathList = env.get("XDG_DATA_DIRS");
233
- return __spreadArray([extension.data()], pathList ? pathList.split(path6.delimiter) : []);
233
+ return __spreadArray([extension.data()], pathList ? pathList.split(path7.delimiter) : []);
234
234
  };
235
235
  return XDG;
236
236
  }
@@ -257,13 +257,13 @@ var require_OSPaths = __commonJS({
257
257
  return !s;
258
258
  }
259
259
  function Adapt(adapter_) {
260
- var env = adapter_.env, os2 = adapter_.os, path6 = adapter_.path;
260
+ var env = adapter_.env, os2 = adapter_.os, path7 = adapter_.path;
261
261
  var isWinOS = /^win/i.test(adapter_.process.platform);
262
262
  function normalizePath(path_) {
263
263
  return path_ ? adapter_.path.normalize(adapter_.path.join(path_, ".")) : void 0;
264
264
  }
265
265
  function home() {
266
- var posix = function() {
266
+ var posix2 = function() {
267
267
  return normalizePath((typeof os2.homedir === "function" ? os2.homedir() : void 0) || env.get("HOME"));
268
268
  };
269
269
  var windows = function() {
@@ -271,19 +271,19 @@ var require_OSPaths = __commonJS({
271
271
  typeof os2.homedir === "function" ? os2.homedir() : void 0,
272
272
  env.get("USERPROFILE"),
273
273
  env.get("HOME"),
274
- env.get("HOMEDRIVE") || env.get("HOMEPATH") ? path6.join(env.get("HOMEDRIVE") || "", env.get("HOMEPATH") || "") : void 0
274
+ env.get("HOMEDRIVE") || env.get("HOMEPATH") ? path7.join(env.get("HOMEDRIVE") || "", env.get("HOMEPATH") || "") : void 0
275
275
  ];
276
276
  return normalizePath(priorityList.find(function(v) {
277
277
  return !isEmpty(v);
278
278
  }));
279
279
  };
280
- return isWinOS ? windows() : posix();
280
+ return isWinOS ? windows() : posix2();
281
281
  }
282
282
  function temp() {
283
283
  function joinPathToBase(base, segments) {
284
- return base ? path6.join.apply(path6, __spreadArray([base], segments)) : void 0;
284
+ return base ? path7.join.apply(path7, __spreadArray([base], segments)) : void 0;
285
285
  }
286
- function posix() {
286
+ function posix2() {
287
287
  var fallback = "/tmp";
288
288
  var priorityList = [
289
289
  typeof os2.tmpdir === "function" ? os2.tmpdir() : void 0,
@@ -331,7 +331,7 @@ var require_OSPaths = __commonJS({
331
331
  });
332
332
  return v && normalizePath(v()) || fallback;
333
333
  }
334
- return isWinOS ? windows() : posix();
334
+ return isWinOS ? windows() : posix2();
335
335
  }
336
336
  var OSPaths_ = /* @__PURE__ */ function() {
337
337
  function OSPaths_2() {
@@ -385,7 +385,7 @@ var require_node = __commonJS({
385
385
  exports.__esModule = true;
386
386
  exports.adapter = void 0;
387
387
  var os2 = __importStar(__require("os"));
388
- var path6 = __importStar(__require("path"));
388
+ var path7 = __importStar(__require("path"));
389
389
  exports.adapter = {
390
390
  atImportPermissions: { env: true },
391
391
  env: {
@@ -394,7 +394,7 @@ var require_node = __commonJS({
394
394
  }
395
395
  },
396
396
  os: os2,
397
- path: path6,
397
+ path: path7,
398
398
  process
399
399
  };
400
400
  }
@@ -447,7 +447,7 @@ var require_node2 = __commonJS({
447
447
  };
448
448
  exports.__esModule = true;
449
449
  exports.adapter = void 0;
450
- var path6 = __importStar(__require("path"));
450
+ var path7 = __importStar(__require("path"));
451
451
  var os_paths_1 = __importDefault(require_mod_cjs());
452
452
  exports.adapter = {
453
453
  atImportPermissions: { env: true },
@@ -457,7 +457,7 @@ var require_node2 = __commonJS({
457
457
  }
458
458
  },
459
459
  osPaths: os_paths_1["default"],
460
- path: path6,
460
+ path: path7,
461
461
  process
462
462
  };
463
463
  }
@@ -510,7 +510,7 @@ var require_node3 = __commonJS({
510
510
  };
511
511
  exports.__esModule = true;
512
512
  exports.adapter = void 0;
513
- var path6 = __importStar(__require("path"));
513
+ var path7 = __importStar(__require("path"));
514
514
  var xdg_portable_1 = __importDefault(require_mod_cjs2());
515
515
  exports.adapter = {
516
516
  atImportPermissions: { env: true, read: true },
@@ -525,7 +525,7 @@ var require_node3 = __commonJS({
525
525
  return process.pkg ? process.execPath : void 0;
526
526
  }
527
527
  },
528
- path: path6,
528
+ path: path7,
529
529
  process,
530
530
  xdg: xdg_portable_1["default"]
531
531
  };
@@ -777,7 +777,7 @@ 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 log2, outro as outro3, spinner as spinner4 } from "@clack/prompts";
780
+ import { intro as intro3, log as log3, outro as outro3 } from "@clack/prompts";
781
781
  import { depot } from "@depot/cli";
782
782
  import { context, trace as trace2 } from "@opentelemetry/api";
783
783
  import {
@@ -790,18 +790,17 @@ import chalk5 from "chalk";
790
790
  import { Option as CommandOption } from "commander";
791
791
  import { build as build2 } from "esbuild";
792
792
  import { execa as execa2 } from "execa";
793
- import { resolve as importResolve } from "import-meta-resolve";
794
793
  import { createHash } from "node:crypto";
795
794
  import { readFileSync as readFileSync2 } from "node:fs";
796
795
  import { copyFile, mkdir, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
797
- import { dirname, join as join5, relative as relative3 } from "node:path";
796
+ import { dirname, join as join5, relative as relative3, posix } from "node:path";
798
797
  import { setTimeout as setTimeout2 } from "node:timers/promises";
799
798
  import terminalLink from "terminal-link";
800
799
  import invariant from "tiny-invariant";
801
800
  import { z as z4 } from "zod";
802
801
 
803
802
  // package.json
804
- var version = "3.0.0-beta.10";
803
+ var version = "3.0.0-beta.12";
805
804
  var dependencies = {
806
805
  "@clack/prompts": "^0.7.0",
807
806
  "@depot/cli": "0.0.1-cli.2.55.0",
@@ -817,7 +816,7 @@ var dependencies = {
817
816
  "@opentelemetry/sdk-trace-base": "^1.22.0",
818
817
  "@opentelemetry/sdk-trace-node": "^1.22.0",
819
818
  "@opentelemetry/semantic-conventions": "^1.22.0",
820
- "@trigger.dev/core": "workspace:^3.0.0-beta.7",
819
+ "@trigger.dev/core": "workspace:^3.0.0-beta.12",
821
820
  "@types/degit": "^2.8.3",
822
821
  chalk: "^5.2.0",
823
822
  chokidar: "^3.5.3",
@@ -906,8 +905,8 @@ var package_default = {
906
905
  "@types/semver": "^7.3.13",
907
906
  "@types/ws": "^8.5.3",
908
907
  "cpy-cli": "^5.0.0",
908
+ nodemon: "^3.0.1",
909
909
  "npm-run-all": "^4.1.5",
910
- "npm-watch": "^0.11.0",
911
910
  open: "^10.0.3",
912
911
  "p-retry": "^6.1.0",
913
912
  rimraf: "^3.0.2",
@@ -917,9 +916,6 @@ var package_default = {
917
916
  vitest: "^0.34.4",
918
917
  "xdg-app-paths": "^8.3.0"
919
918
  },
920
- watch: {
921
- "build:prod-containerfile": "src/Containerfile.prod"
922
- },
923
919
  scripts: {
924
920
  typecheck: "tsc -p tsconfig.check.json",
925
921
  build: "npm run clean && run-p build:**",
@@ -929,7 +925,7 @@ var package_default = {
929
925
  dev: "npm run clean && run-p dev:**",
930
926
  "dev:main": "tsup --watch",
931
927
  "dev:workers": "tsup --config tsup.workers.config.ts --watch",
932
- "dev:prod-containerfile": "npm-watch",
928
+ "dev:test": "nodemon -w src/Containerfile.prod -x npm run build:prod-containerfile",
933
929
  clean: "rimraf dist",
934
930
  start: "node dist/index.js",
935
931
  test: "vitest"
@@ -1470,31 +1466,31 @@ import fsModule, { writeFile } from "fs/promises";
1470
1466
  import fs from "node:fs";
1471
1467
  import { tmpdir } from "node:os";
1472
1468
  import pathModule from "node:path";
1473
- async function createFile(path6, contents) {
1474
- await fsModule.mkdir(pathModule.dirname(path6), { recursive: true });
1475
- await fsModule.writeFile(path6, contents);
1476
- return path6;
1469
+ async function createFile(path7, contents) {
1470
+ await fsModule.mkdir(pathModule.dirname(path7), { recursive: true });
1471
+ await fsModule.writeFile(path7, contents);
1472
+ return path7;
1477
1473
  }
1478
- async function pathExists(path6) {
1479
- return fsSync.existsSync(path6);
1474
+ async function pathExists(path7) {
1475
+ return fsSync.existsSync(path7);
1480
1476
  }
1481
- async function readFile(path6) {
1482
- return await fsModule.readFile(path6, "utf8");
1477
+ async function readFile(path7) {
1478
+ return await fsModule.readFile(path7, "utf8");
1483
1479
  }
1484
- async function readJSONFile(path6) {
1485
- const fileContents = await fsModule.readFile(path6, "utf8");
1480
+ async function readJSONFile(path7) {
1481
+ const fileContents = await fsModule.readFile(path7, "utf8");
1486
1482
  return JSON.parse(fileContents);
1487
1483
  }
1488
- async function writeJSONFile(path6, json) {
1489
- await writeFile(path6, JSON.stringify(json), "utf8");
1484
+ async function writeJSONFile(path7, json) {
1485
+ await writeFile(path7, JSON.stringify(json), "utf8");
1490
1486
  }
1491
- function readJSONFileSync(path6) {
1492
- const fileContents = fsSync.readFileSync(path6, "utf8");
1487
+ function readJSONFileSync(path7) {
1488
+ const fileContents = fsSync.readFileSync(path7, "utf8");
1493
1489
  return JSON.parse(fileContents);
1494
1490
  }
1495
- function safeDeleteFileSync(path6) {
1491
+ function safeDeleteFileSync(path7) {
1496
1492
  try {
1497
- fs.unlinkSync(path6);
1493
+ fs.unlinkSync(path7);
1498
1494
  } catch (error) {
1499
1495
  }
1500
1496
  }
@@ -1521,12 +1517,13 @@ async function gatherTaskFiles(config) {
1521
1517
  for (const file of files) {
1522
1518
  if (!file.isFile())
1523
1519
  continue;
1524
- if (!file.name.endsWith(".js") && !file.name.endsWith(".ts"))
1520
+ if (!file.name.endsWith(".js") && !file.name.endsWith(".ts") && !file.name.endsWith(".jsx") && !file.name.endsWith(".tsx")) {
1525
1521
  continue;
1522
+ }
1526
1523
  const fullPath = join(triggerDir, file.name);
1527
1524
  const filePath = relative(config.projectDir, fullPath);
1528
- const importPath = filePath.replace(/\.(js|ts)$/, "");
1529
- const importName = importPath.replace(/\//g, "_").replace(/\./g, "_").replace(/-/g, "_");
1525
+ const importName = filePath.replace(/\..+$/, "").replace(/[^a-zA-Z0-9_$]/g, "_");
1526
+ const importPath = filePath.replace(/\\/g, "/");
1530
1527
  taskFiles.push({ triggerDir, importPath, importName, filePath });
1531
1528
  }
1532
1529
  }
@@ -1656,7 +1653,8 @@ async function readConfig(dir, options) {
1656
1653
  });
1657
1654
  const userConfigModule = await import(builtConfigFileHref);
1658
1655
  const rawConfig = await normalizeConfig(
1659
- userConfigModule ? userConfigModule.config : { project: options?.projectRef }
1656
+ userConfigModule?.config,
1657
+ options?.projectRef ? { project: options?.projectRef } : void 0
1660
1658
  );
1661
1659
  const config = Config.parse(rawConfig);
1662
1660
  return {
@@ -1665,31 +1663,32 @@ async function readConfig(dir, options) {
1665
1663
  path: configPath
1666
1664
  };
1667
1665
  }
1668
- async function resolveConfig(path6, config) {
1666
+ async function resolveConfig(path7, config) {
1669
1667
  if (!config.triggerDirectories) {
1670
- config.triggerDirectories = await findTriggerDirectories(path6);
1668
+ config.triggerDirectories = await findTriggerDirectories(path7);
1671
1669
  }
1672
1670
  config.triggerDirectories = resolveTriggerDirectories(config.triggerDirectories);
1673
1671
  if (!config.triggerUrl) {
1674
1672
  config.triggerUrl = CLOUD_API_URL;
1675
1673
  }
1676
1674
  if (!config.projectDir) {
1677
- config.projectDir = path6;
1675
+ config.projectDir = path7;
1678
1676
  }
1679
1677
  if (!config.tsconfigPath) {
1680
- config.tsconfigPath = await getConfigPath(path6, "tsconfig.json");
1678
+ config.tsconfigPath = await getConfigPath(path7, "tsconfig.json");
1681
1679
  }
1682
1680
  return config;
1683
1681
  }
1684
- async function normalizeConfig(config) {
1682
+ async function normalizeConfig(config, overrides) {
1683
+ let normalized = config;
1685
1684
  if (typeof config === "function") {
1686
- config = config();
1685
+ normalized = await config();
1687
1686
  }
1688
- return await config;
1687
+ normalized = { ...normalized, ...overrides };
1688
+ return normalized;
1689
1689
  }
1690
1690
 
1691
1691
  // src/utilities/initialBanner.ts
1692
- import { spinner } from "@clack/prompts";
1693
1692
  import chalk3 from "chalk";
1694
1693
  import checkForUpdate from "update-check";
1695
1694
 
@@ -1701,6 +1700,25 @@ function getVersion() {
1701
1700
  return packageJsonContent.version ?? "1.0.0";
1702
1701
  }
1703
1702
 
1703
+ // src/utilities/windows.ts
1704
+ import { log, spinner as clackSpinner } from "@clack/prompts";
1705
+ var isWindows = process.platform === "win32";
1706
+ function escapeImportPath(path7) {
1707
+ return isWindows ? path7.replaceAll("\\", "\\\\") : path7;
1708
+ }
1709
+ var ballmerSpinner = () => ({
1710
+ start: (msg) => {
1711
+ log.step(msg ?? "");
1712
+ },
1713
+ stop: (msg, code) => {
1714
+ log.message(msg ?? "");
1715
+ },
1716
+ message: (msg) => {
1717
+ log.message(msg ?? "");
1718
+ }
1719
+ });
1720
+ var spinner = () => isWindows ? ballmerSpinner() : clackSpinner();
1721
+
1704
1722
  // src/utilities/initialBanner.ts
1705
1723
  async function printInitialBanner(performUpdateCheck = true) {
1706
1724
  const packageVersion = getVersion();
@@ -1731,15 +1749,15 @@ After installation, run Trigger.dev with \`npx trigger.dev\`.`
1731
1749
  }
1732
1750
  async function printStandloneInitialBanner(performUpdateCheck = true) {
1733
1751
  const packageVersion = getVersion();
1734
- let text3 = `
1735
- ${logo()} ${chalkGrey("(v3 Developer Preview)")}`;
1752
+ logger.log(`
1753
+ ${logo()} ${chalkGrey("(v3 Developer Preview)")}`);
1736
1754
  if (performUpdateCheck) {
1737
1755
  const maybeNewVersion = await updateCheck();
1738
1756
  if (maybeNewVersion !== void 0) {
1739
- text3 = `${text3} (update available ${chalk3.green(maybeNewVersion)})`;
1757
+ logger.log(`Update available ${chalk3.green(maybeNewVersion)}`);
1740
1758
  }
1741
1759
  }
1742
- logger.log(text3 + "\n" + chalkGrey("-".repeat(54)));
1760
+ logger.log(`${chalkGrey("-".repeat(54))}`);
1743
1761
  }
1744
1762
  function printDevBanner() {
1745
1763
  logger.log(
@@ -1780,11 +1798,11 @@ async function installPackages(packages, options) {
1780
1798
  }
1781
1799
  );
1782
1800
  }
1783
- function detectPackageNameFromImportPath(path6) {
1784
- if (path6.startsWith("@")) {
1785
- return path6.split("/").slice(0, 2).join("/");
1801
+ function detectPackageNameFromImportPath(path7) {
1802
+ if (path7.startsWith("@")) {
1803
+ return path7.split("/").slice(0, 2).join("/");
1786
1804
  } else {
1787
- return path6.split("/")[0];
1805
+ return path7.split("/")[0];
1788
1806
  }
1789
1807
  }
1790
1808
  function stripWorkspaceFromVersion(version2) {
@@ -1800,16 +1818,16 @@ function parsePackageName(packageSpecifier) {
1800
1818
  }
1801
1819
  return { name: packageSpecifier };
1802
1820
  }
1803
- async function setPackageJsonDeps(path6, deps) {
1821
+ async function setPackageJsonDeps(path7, deps) {
1804
1822
  try {
1805
- const existingPackageJson = await readJSONFile(path6);
1823
+ const existingPackageJson = await readJSONFile(path7);
1806
1824
  const newPackageJson = {
1807
1825
  ...existingPackageJson,
1808
1826
  dependencies: {
1809
1827
  ...deps
1810
1828
  }
1811
1829
  };
1812
- await writeJSONFile(path6, newPackageJson);
1830
+ await writeJSONFile(path7, newPackageJson);
1813
1831
  } catch (error) {
1814
1832
  const defaultPackageJson = {
1815
1833
  name: "temp",
@@ -1817,12 +1835,12 @@ async function setPackageJsonDeps(path6, deps) {
1817
1835
  description: "",
1818
1836
  dependencies: deps
1819
1837
  };
1820
- await writeJSONFile(path6, defaultPackageJson);
1838
+ await writeJSONFile(path7, defaultPackageJson);
1821
1839
  }
1822
1840
  }
1823
1841
 
1824
1842
  // src/commands/login.ts
1825
- import { intro as intro2, log, outro as outro2, select, spinner as spinner3 } from "@clack/prompts";
1843
+ import { intro as intro2, log as log2, outro as outro2, select } from "@clack/prompts";
1826
1844
  import { recordSpanException as recordSpanException3 } from "@trigger.dev/core/v3";
1827
1845
 
1828
1846
  // ../../node_modules/.pnpm/open@10.0.3/node_modules/open/index.js
@@ -2370,7 +2388,7 @@ async function pRetry(input, options) {
2370
2388
  import { z as z3 } from "zod";
2371
2389
 
2372
2390
  // src/commands/whoami.ts
2373
- import { intro, note, spinner as spinner2 } from "@clack/prompts";
2391
+ import { intro, note } from "@clack/prompts";
2374
2392
 
2375
2393
  // src/utilities/session.ts
2376
2394
  import { recordSpanException as recordSpanException2 } from "@trigger.dev/core/v3";
@@ -2448,7 +2466,7 @@ async function whoAmI(options, embedded = false) {
2448
2466
  if (!embedded) {
2449
2467
  intro(`Displaying your account details [${options?.profile ?? "default"}]`);
2450
2468
  }
2451
- const loadingSpinner = spinner2();
2469
+ const loadingSpinner = spinner();
2452
2470
  loadingSpinner.start("Checking your account details");
2453
2471
  const authentication = await isLoggedIn(options?.profile);
2454
2472
  if (!authentication.ok) {
@@ -2615,16 +2633,16 @@ async function login(options) {
2615
2633
  }
2616
2634
  }
2617
2635
  if (opts.embedded) {
2618
- log.step("You must login to continue.");
2636
+ log2.step("You must login to continue.");
2619
2637
  }
2620
2638
  const apiClient2 = new CliApiClient(authConfig?.apiUrl ?? opts.defaultApiUrl);
2621
2639
  const authorizationCodeResult = await createAuthorizationCode(apiClient2);
2622
- log.step(
2640
+ log2.step(
2623
2641
  `Please visit the following URL to login:
2624
2642
  ${chalkLink(authorizationCodeResult.url)}`
2625
2643
  );
2626
2644
  await open_default(authorizationCodeResult.url);
2627
- const getPersonalAccessTokenSpinner = spinner3();
2645
+ const getPersonalAccessTokenSpinner = spinner();
2628
2646
  getPersonalAccessTokenSpinner.start("Waiting for you to login");
2629
2647
  try {
2630
2648
  const indexResult = await pRetry(
@@ -2653,7 +2671,7 @@ ${chalkLink(authorizationCodeResult.url)}`
2653
2671
  throw new Error(whoAmIResult.error);
2654
2672
  }
2655
2673
  if (opts.embedded) {
2656
- log.step("Logged in successfully");
2674
+ log2.step("Logged in successfully");
2657
2675
  } else {
2658
2676
  outro2("Logged in successfully");
2659
2677
  }
@@ -2672,7 +2690,7 @@ ${chalkLink(authorizationCodeResult.url)}`
2672
2690
  } catch (e) {
2673
2691
  getPersonalAccessTokenSpinner.stop(`Failed to get access token`);
2674
2692
  if (e instanceof AbortError) {
2675
- log.error(e.message);
2693
+ log2.error(e.message);
2676
2694
  }
2677
2695
  recordSpanException3(span, e);
2678
2696
  span.end();
@@ -2721,7 +2739,7 @@ async function getPersonalAccessToken(apiClient2, authorizationCode) {
2721
2739
  async function createAuthorizationCode(apiClient2) {
2722
2740
  return await tracer.startActiveSpan("createAuthorizationCode", async (span) => {
2723
2741
  try {
2724
- const createAuthCodeSpinner = spinner3();
2742
+ const createAuthCodeSpinner = spinner();
2725
2743
  createAuthCodeSpinner.start("Creating authorition code");
2726
2744
  const authorizationCodeResult = await apiClient2.createAuthorizationCode();
2727
2745
  if (!authorizationCodeResult.success) {
@@ -2795,7 +2813,9 @@ function workerSetupImportConfigPlugin(configPath) {
2795
2813
  let workerSetupContents = readFileSync(args.path, "utf-8");
2796
2814
  workerSetupContents = workerSetupContents.replace(
2797
2815
  "__SETUP_IMPORTED_PROJECT_CONFIG__",
2798
- `import * as setupImportedConfigExports from "${configPath}"; const setupImportedConfig = setupImportedConfigExports.config;`
2816
+ `import * as setupImportedConfigExports from "${escapeImportPath(
2817
+ configPath
2818
+ )}"; const setupImportedConfig = setupImportedConfigExports.config;`
2799
2819
  );
2800
2820
  logger.debug("Loading worker setup", {
2801
2821
  args,
@@ -3079,9 +3099,9 @@ import { join as join4 } from "node:path";
3079
3099
 
3080
3100
  // src/utilities/getUserPackageManager.ts
3081
3101
  import { findUp as findUp2 } from "find-up";
3082
- async function getUserPackageManager(path6) {
3102
+ async function getUserPackageManager(path7) {
3083
3103
  try {
3084
- return await detectPackageManagerFromArtifacts(path6);
3104
+ return await detectPackageManagerFromArtifacts(path7);
3085
3105
  } catch (error) {
3086
3106
  return detectPackageManagerFromCurrentCommand();
3087
3107
  }
@@ -3100,7 +3120,7 @@ function detectPackageManagerFromCurrentCommand() {
3100
3120
  return "npm";
3101
3121
  }
3102
3122
  }
3103
- async function detectPackageManagerFromArtifacts(path6) {
3123
+ async function detectPackageManagerFromArtifacts(path7) {
3104
3124
  const packageFiles = [
3105
3125
  { name: "yarn.lock", pm: "yarn" },
3106
3126
  { name: "pnpm-lock.yaml", pm: "pnpm" },
@@ -3108,7 +3128,7 @@ async function detectPackageManagerFromArtifacts(path6) {
3108
3128
  { name: "npm-shrinkwrap.json", pm: "npm" }
3109
3129
  ];
3110
3130
  for (const { name, pm } of packageFiles) {
3111
- const foundPath = await findUp2(name, { cwd: path6 });
3131
+ const foundPath = await findUp2(name, { cwd: path7 });
3112
3132
  if (typeof foundPath === "string") {
3113
3133
  return pm;
3114
3134
  }
@@ -3270,6 +3290,15 @@ var YarnCommands = class {
3270
3290
  }
3271
3291
  };
3272
3292
 
3293
+ // src/utilities/resolveInternalFilePath.ts
3294
+ import path5 from "path";
3295
+ import { fileURLToPath as fileURLToPath3 } from "url";
3296
+ function cliRootPath() {
3297
+ const __filename2 = fileURLToPath3(import.meta.url);
3298
+ const __dirname2 = path5.dirname(__filename2);
3299
+ return __dirname2;
3300
+ }
3301
+
3273
3302
  // src/commands/deploy.ts
3274
3303
  var DeployCommandOptions = CommonCommandOptions.extend({
3275
3304
  skipTypecheck: z4.boolean().default(false),
@@ -3297,7 +3326,7 @@ function configureDeployCommand(program2) {
3297
3326
  "Detected missing environment variables won't block deployment"
3298
3327
  ).option("-c, --config <config file>", "The name of the config file, found at [path]").option(
3299
3328
  "-p, --project-ref <project ref>",
3300
- "The project ref. Required if there is no config file."
3329
+ "The project ref. Required if there is no config file. This will override the project specified in the config file."
3301
3330
  )
3302
3331
  ).addOption(
3303
3332
  new CommandOption(
@@ -3331,10 +3360,10 @@ function configureDeployCommand(program2) {
3331
3360
  "--output-metafile <path>",
3332
3361
  "If provided, will save the esbuild metafile for the build to the specified path"
3333
3362
  ).hideHelp()
3334
- ).action(async (path6, options) => {
3363
+ ).action(async (path7, options) => {
3335
3364
  await handleTelemetry(async () => {
3336
3365
  await printStandloneInitialBanner(true);
3337
- await deployCommand(path6, options);
3366
+ await deployCommand(path7, options);
3338
3367
  });
3339
3368
  });
3340
3369
  }
@@ -3388,7 +3417,7 @@ async function _deployCommand(dir, options) {
3388
3417
  throw new Error(deploymentEnv.error);
3389
3418
  }
3390
3419
  const environmentClient = new CliApiClient(authorization.auth.apiUrl, deploymentEnv.data.apiKey);
3391
- log2.step(
3420
+ log3.step(
3392
3421
  `Preparing to deploy "${deploymentEnv.data.name}" (${resolvedConfig.config.project}) to ${options.env}`
3393
3422
  );
3394
3423
  const compilation = await compileProject(
@@ -3419,7 +3448,7 @@ async function _deployCommand(dir, options) {
3419
3448
  );
3420
3449
  }
3421
3450
  const version2 = deploymentResponse.data.version;
3422
- const deploymentSpinner = spinner4();
3451
+ const deploymentSpinner = spinner();
3423
3452
  deploymentSpinner.start(`Deploying version ${version2}`);
3424
3453
  const selfHostedRegistryHost = deploymentResponse.data.registryHost ?? options.registry;
3425
3454
  const registryHost = selfHostedRegistryHost ?? "registry.trigger.dev";
@@ -3580,7 +3609,7 @@ async function checkEnvVars(envVars, config, options, environmentClient, apiUrl)
3580
3609
  return await tracer.startActiveSpan("detectEnvVars", async (span) => {
3581
3610
  try {
3582
3611
  span.setAttribute("envVars.check", envVars);
3583
- const environmentVariablesSpinner = spinner4();
3612
+ const environmentVariablesSpinner = spinner();
3584
3613
  environmentVariablesSpinner.start("Checking environment variables");
3585
3614
  const environmentVariables = await environmentClient.getEnvironmentVariables(config.project);
3586
3615
  if (!environmentVariables.success) {
@@ -3713,7 +3742,8 @@ async function buildAndPushImage(options, updater) {
3713
3742
  const processCode = await new Promise((res, rej) => {
3714
3743
  childProcess2.stderr?.on("data", (data) => {
3715
3744
  const text3 = data.toString();
3716
- errors.push(text3);
3745
+ const lines = text3.split("\n").filter(Boolean);
3746
+ errors.push(...lines);
3717
3747
  logger.debug(text3);
3718
3748
  });
3719
3749
  childProcess2.on("error", (e) => rej(e));
@@ -3867,13 +3897,12 @@ async function buildAndPushSelfHostedImage(options) {
3867
3897
  });
3868
3898
  }
3869
3899
  function extractImageDigest(outputs) {
3870
- const imageDigestRegex = /sha256:[a-f0-9]{64}/;
3900
+ const imageDigestRegex = /pushing manifest for .+(?<digest>sha256:[a-f0-9]{64})/;
3871
3901
  for (const line of outputs) {
3872
- if (line.includes("pushing manifest")) {
3873
- const imageDigestMatch = line.match(imageDigestRegex);
3874
- if (imageDigestMatch) {
3875
- return imageDigestMatch[0];
3876
- }
3902
+ const imageDigestMatch = line.match(imageDigestRegex);
3903
+ const digest = imageDigestMatch?.groups?.digest;
3904
+ if (digest) {
3905
+ return digest;
3877
3906
  }
3878
3907
  }
3879
3908
  }
@@ -3890,25 +3919,25 @@ async function compileProject(config, options, configPath) {
3890
3919
  throw new Error("Typecheck failed, aborting deployment");
3891
3920
  }
3892
3921
  }
3893
- const compileSpinner = spinner4();
3922
+ const compileSpinner = spinner();
3894
3923
  compileSpinner.start(`Building project in ${config.projectDir}`);
3895
3924
  const taskFiles = await gatherTaskFiles(config);
3896
3925
  const workerFacade = readFileSync2(
3897
- new URL(importResolve("./workers/prod/worker-facade.js", import.meta.url)).href.replace(
3898
- "file://",
3899
- ""
3900
- ),
3926
+ join5(cliRootPath(), "workers", "prod", "worker-facade.js"),
3901
3927
  "utf-8"
3902
3928
  );
3903
- const workerSetupPath = new URL(
3904
- importResolve("./workers/prod/worker-setup.js", import.meta.url)
3905
- ).href.replace("file://", "");
3906
- let workerContents = workerFacade.replace("__TASKS__", createTaskFileImports(taskFiles)).replace("__WORKER_SETUP__", `import { tracingSDK } from "${workerSetupPath}";`);
3929
+ const workerSetupPath = join5(cliRootPath(), "workers", "dev", "worker-setup.js");
3930
+ let workerContents = workerFacade.replace("__TASKS__", createTaskFileImports(taskFiles)).replace(
3931
+ "__WORKER_SETUP__",
3932
+ `import { tracingSDK } from "${escapeImportPath(workerSetupPath)}";`
3933
+ );
3907
3934
  if (configPath) {
3908
3935
  logger.debug("Importing project config from", { configPath });
3909
3936
  workerContents = workerContents.replace(
3910
3937
  "__IMPORTED_PROJECT_CONFIG__",
3911
- `import * as importedConfigExports from "${configPath}"; const importedConfig = importedConfigExports.config; const handleError = importedConfigExports.handleError;`
3938
+ `import * as importedConfigExports from "${escapeImportPath(
3939
+ configPath
3940
+ )}"; const importedConfig = importedConfigExports.config; const handleError = importedConfigExports.handleError;`
3912
3941
  );
3913
3942
  } else {
3914
3943
  workerContents = workerContents.replace(
@@ -3960,10 +3989,7 @@ async function compileProject(config, options, configPath) {
3960
3989
  await writeJSONFile(join5(options.outputMetafile, "worker.json"), result.metafile);
3961
3990
  }
3962
3991
  const entryPointContents = readFileSync2(
3963
- new URL(importResolve("./workers/prod/entry-point.js", import.meta.url)).href.replace(
3964
- "file://",
3965
- ""
3966
- ),
3992
+ join5(cliRootPath(), "workers", "prod", "entry-point.js"),
3967
3993
  "utf-8"
3968
3994
  );
3969
3995
  const entryPointResult = await build2({
@@ -4012,9 +4038,9 @@ async function compileProject(config, options, configPath) {
4012
4038
  }
4013
4039
  const tempDir = await createTempDir();
4014
4040
  logger.debug(`Writing compiled files to ${tempDir}`);
4015
- const metaOutput = result.metafile.outputs[join5("out", "stdin.js")];
4041
+ const metaOutput = result.metafile.outputs[posix.join("out", "stdin.js")];
4016
4042
  invariant(metaOutput, "Meta output for the result build is missing");
4017
- const entryPointMetaOutput = entryPointResult.metafile.outputs[join5("out", "stdin.js")];
4043
+ const entryPointMetaOutput = entryPointResult.metafile.outputs[posix.join("out", "stdin.js")];
4018
4044
  invariant(entryPointMetaOutput, "Meta output for the entryPoint build is missing");
4019
4045
  const workerOutputFile = result.outputFiles.find(
4020
4046
  (file) => file.path === join5(config.projectDir, "out", "stdin.js")
@@ -4063,9 +4089,7 @@ async function compileProject(config, options, configPath) {
4063
4089
  if (!resolvingDependenciesResult) {
4064
4090
  throw new SkipLoggingError("Failed to resolve dependencies");
4065
4091
  }
4066
- const containerFilePath = new URL(
4067
- importResolve("./Containerfile.prod", import.meta.url)
4068
- ).href.replace("file://", "");
4092
+ const containerFilePath = join5(cliRootPath(), "Containerfile.prod");
4069
4093
  await copyFile(containerFilePath, join5(tempDir, "Containerfile"));
4070
4094
  const contentHasher = createHash("sha256");
4071
4095
  contentHasher.update(Buffer.from(entryPointOutputFile.text));
@@ -4093,7 +4117,7 @@ async function compileProject(config, options, configPath) {
4093
4117
  }
4094
4118
  async function resolveDependencies(projectDir, packageJsonContents, config, options) {
4095
4119
  return await tracer.startActiveSpan("resolveDependencies", async (span) => {
4096
- const resolvingDepsSpinner = spinner4();
4120
+ const resolvingDepsSpinner = spinner();
4097
4121
  resolvingDepsSpinner.start("Resolving dependencies");
4098
4122
  const hasher = createHash("sha256");
4099
4123
  hasher.update(JSON.stringify(packageJsonContents));
@@ -4177,7 +4201,7 @@ ${chalkError("X Error:")} The package ${chalkPurple(
4177
4201
  async function typecheckProject(config, options) {
4178
4202
  return await tracer.startActiveSpan("typecheckProject", async (span) => {
4179
4203
  try {
4180
- const typecheckSpinner = spinner4();
4204
+ const typecheckSpinner = spinner();
4181
4205
  typecheckSpinner.start("Typechecking project");
4182
4206
  const tscTypecheck = execa2("npm", ["exec", "tsc", "--", "--noEmit"], {
4183
4207
  cwd: config.projectDir
@@ -4346,11 +4370,10 @@ import {
4346
4370
  } from "@trigger.dev/core/v3";
4347
4371
  import { watch } from "chokidar";
4348
4372
  import { context as context2 } from "esbuild";
4349
- import { resolve as importResolve2 } from "import-meta-resolve";
4350
4373
  import { render, useInput } from "ink";
4351
4374
  import { createHash as createHash2 } from "node:crypto";
4352
4375
  import fs7, { readFileSync as readFileSync3 } from "node:fs";
4353
- import { basename, dirname as dirname3, join as join6 } from "node:path";
4376
+ import { basename, dirname as dirname3, join as join6, normalize } from "node:path";
4354
4377
  import pDebounce from "p-debounce";
4355
4378
  import { WebSocket } from "partysocket";
4356
4379
  import React, { Suspense, useEffect } from "react";
@@ -4548,8 +4571,8 @@ var CancelledProcessError = class extends Error {
4548
4571
  }
4549
4572
  };
4550
4573
  var BackgroundWorker = class {
4551
- constructor(path6, params) {
4552
- this.path = path6;
4574
+ constructor(path7, params) {
4575
+ this.path = path7;
4553
4576
  this.params = params;
4554
4577
  }
4555
4578
  _initialized = false;
@@ -4763,9 +4786,9 @@ var BackgroundWorker = class {
4763
4786
  }
4764
4787
  };
4765
4788
  var TaskRunProcess = class {
4766
- constructor(execution, path6, env, metadata, worker) {
4789
+ constructor(execution, path7, env, metadata, worker) {
4767
4790
  this.execution = execution;
4768
- this.path = path6;
4791
+ this.path = path7;
4769
4792
  this.env = env;
4770
4793
  this.metadata = metadata;
4771
4794
  this.worker = worker;
@@ -4989,9 +5012,9 @@ function configureDevCommand(program2) {
4989
5012
  "-p, --project-ref <project ref>",
4990
5013
  "The project ref. Required if there is no config file."
4991
5014
  ).option("--debugger", "Enable the debugger").option("--debug-otel", "Enable OpenTelemetry debugging")
4992
- ).action(async (path6, options) => {
5015
+ ).action(async (path7, options) => {
4993
5016
  wrapCommandAction("dev", DevCommandOptions, options, async (opts) => {
4994
- await devCommand(path6, opts);
5017
+ await devCommand(path7, opts);
4995
5018
  });
4996
5019
  });
4997
5020
  }
@@ -5195,22 +5218,21 @@ function useDev({
5195
5218
  }
5196
5219
  let latestWorkerContentHash;
5197
5220
  const taskFiles = await gatherTaskFiles(config);
5198
- const workerFacade = readFileSync3(
5199
- new URL(importResolve2("./workers/dev/worker-facade.js", import.meta.url)).href.replace(
5200
- "file://",
5201
- ""
5202
- ),
5203
- "utf-8"
5221
+ const workerFacadePath = join6(cliRootPath(), "workers", "dev", "worker-facade.js");
5222
+ const workerFacade = readFileSync3(workerFacadePath, "utf-8");
5223
+ const workerSetupPath = join6(cliRootPath(), "workers", "dev", "worker-setup.js");
5224
+ let entryPointContents = workerFacade.replace("__TASKS__", createTaskFileImports(taskFiles)).replace(
5225
+ "__WORKER_SETUP__",
5226
+ `import { tracingSDK, sender } from "${escapeImportPath(workerSetupPath)}";`
5204
5227
  );
5205
- const workerSetupPath = new URL(
5206
- importResolve2("./workers/dev/worker-setup.js", import.meta.url)
5207
- ).href.replace("file://", "");
5208
- let entryPointContents = workerFacade.replace("__TASKS__", createTaskFileImports(taskFiles)).replace("__WORKER_SETUP__", `import { tracingSDK, sender } from "${workerSetupPath}";`);
5209
5228
  if (configPath) {
5229
+ configPath = normalize(configPath);
5210
5230
  logger.debug("Importing project config from", { configPath });
5211
5231
  entryPointContents = entryPointContents.replace(
5212
5232
  "__IMPORTED_PROJECT_CONFIG__",
5213
- `import * as importedConfigExports from "${configPath}"; const importedConfig = importedConfigExports.config; const handleError = importedConfigExports.handleError;`
5233
+ `import * as importedConfigExports from "${escapeImportPath(
5234
+ configPath
5235
+ )}"; const importedConfig = importedConfigExports.config; const handleError = importedConfigExports.handleError;`
5214
5236
  );
5215
5237
  } else {
5216
5238
  entryPointContents = entryPointContents.replace(
@@ -5263,7 +5285,10 @@ function useDev({
5263
5285
  if (!firstBuild) {
5264
5286
  logger.log(chalkGrey("\u25CB Building background worker\u2026"));
5265
5287
  }
5266
- const metaOutputKey = join6("out", `stdin.js`);
5288
+ const metaOutputKey = join6("out", `stdin.js`).replace(/\\/g, "/");
5289
+ logger.debug("Metafile", {
5290
+ metafileOutputs: JSON.stringify(result.metafile?.outputs)
5291
+ });
5267
5292
  const metaOutput = result.metafile.outputs[metaOutputKey];
5268
5293
  if (!metaOutput) {
5269
5294
  throw new Error(`Could not find metafile`);
@@ -5428,12 +5453,12 @@ ${chalkError("X Error:")} The package ${chalkPurple(
5428
5453
  ignoreInitial: true
5429
5454
  }
5430
5455
  );
5431
- taskFileWatcher.on("add", async (path6) => {
5456
+ taskFileWatcher.on("add", async (path7) => {
5432
5457
  throttledRebuild().catch((error) => {
5433
5458
  logger.error(error);
5434
5459
  });
5435
5460
  });
5436
- taskFileWatcher.on("unlink", async (path6) => {
5461
+ taskFileWatcher.on("unlink", async (path7) => {
5437
5462
  throttledRebuild().catch((error) => {
5438
5463
  logger.error(error);
5439
5464
  });
@@ -5574,7 +5599,7 @@ async function findPnpmNodeModulesPath() {
5574
5599
  }
5575
5600
 
5576
5601
  // src/commands/init.ts
5577
- import { intro as intro4, isCancel, log as log3, outro as outro4, select as select2, spinner as spinner5, text } from "@clack/prompts";
5602
+ import { intro as intro4, isCancel, log as log4, outro as outro4, select as select2, text } from "@clack/prompts";
5578
5603
  import { context as context3, trace as trace3 } from "@opentelemetry/api";
5579
5604
  import {
5580
5605
  flattenAttributes as flattenAttributes3,
@@ -5590,7 +5615,7 @@ import { z as z6 } from "zod";
5590
5615
 
5591
5616
  // src/utilities/createFileFromTemplate.ts
5592
5617
  import fs8 from "fs/promises";
5593
- import path5 from "path";
5618
+ import path6 from "path";
5594
5619
  async function createFileFromTemplate(params) {
5595
5620
  let template = await readFile(params.templatePath);
5596
5621
  if (await pathExists(params.outputPath) && !params.override) {
@@ -5601,7 +5626,7 @@ async function createFileFromTemplate(params) {
5601
5626
  }
5602
5627
  try {
5603
5628
  const output = replaceAll(template, params.replacements);
5604
- const directoryName = path5.dirname(params.outputPath);
5629
+ const directoryName = path6.dirname(params.outputPath);
5605
5630
  await fs8.mkdir(directoryName, { recursive: true });
5606
5631
  await fs8.writeFile(params.outputPath, output);
5607
5632
  return {
@@ -5629,12 +5654,6 @@ function replaceAll(input, replacements) {
5629
5654
  return output;
5630
5655
  }
5631
5656
 
5632
- // src/utilities/resolveInternalFilePath.ts
5633
- import { resolve as importResolve3 } from "import-meta-resolve";
5634
- function resolveInternalFilePath(filePath) {
5635
- return new URL(importResolve3(filePath, import.meta.url)).href.replace("file://", "");
5636
- }
5637
-
5638
5657
  // src/commands/init.ts
5639
5658
  var InitCommandOptions = CommonCommandOptions.extend({
5640
5659
  projectRef: z6.string().optional(),
@@ -5652,10 +5671,10 @@ function configureInitCommand(program2) {
5652
5671
  "The version of the @trigger.dev/sdk package to install",
5653
5672
  "beta"
5654
5673
  ).option("--skip-package-install", "Skip installing the @trigger.dev/sdk package").option("--override-config", "Override the existing config file if it exists")
5655
- ).action(async (path6, options) => {
5674
+ ).action(async (path7, options) => {
5656
5675
  await handleTelemetry(async () => {
5657
5676
  await printStandloneInitialBanner(true);
5658
- await initCommand(path6, options);
5677
+ await initCommand(path7, options);
5659
5678
  });
5660
5679
  });
5661
5680
  }
@@ -5707,11 +5726,11 @@ async function _initCommand(dir, options) {
5707
5726
  ...flattenAttributes3(selectedProject, "cli.project")
5708
5727
  });
5709
5728
  logger.debug("Selected project", selectedProject);
5710
- log3.step(`Configuring project "${selectedProject.name}" (${selectedProject.externalRef})`);
5729
+ log4.step(`Configuring project "${selectedProject.name}" (${selectedProject.externalRef})`);
5711
5730
  if (!options.skipPackageInstall) {
5712
5731
  await installPackages2(dir, options);
5713
5732
  } else {
5714
- log3.info("Skipping package installation");
5733
+ log4.info("Skipping package installation");
5715
5734
  }
5716
5735
  const triggerDir = await createTriggerDir(dir, options);
5717
5736
  await writeConfigFile(dir, selectedProject, options, triggerDir);
@@ -5721,21 +5740,21 @@ async function _initCommand(dir, options) {
5721
5740
  "project dashboard",
5722
5741
  `${authorization.dashboardUrl}/projects/v3/${selectedProject.externalRef}`
5723
5742
  );
5724
- log3.success("Successfully initialized project for Trigger.dev v3 \u{1FAE1}");
5725
- log3.info("Next steps:");
5726
- log3.info(
5743
+ log4.success("Successfully initialized project for Trigger.dev v3 \u{1FAE1}");
5744
+ log4.info("Next steps:");
5745
+ log4.info(
5727
5746
  ` 1. To start developing, run ${chalk6.green(
5728
5747
  `npx trigger.dev@${options.tag} dev`
5729
5748
  )} in your project directory`
5730
5749
  );
5731
- log3.info(` 2. Visit your ${projectDashboard} to view your newly created tasks.`);
5732
- log3.info(
5750
+ log4.info(` 2. Visit your ${projectDashboard} to view your newly created tasks.`);
5751
+ log4.info(
5733
5752
  ` 3. Head over to our ${terminalLink3(
5734
5753
  "v3 docs",
5735
5754
  "https://trigger.dev/docs/v3"
5736
5755
  )} to learn more.`
5737
5756
  );
5738
- log3.info(
5757
+ log4.info(
5739
5758
  ` 4. Need help? Join our ${terminalLink3(
5740
5759
  "Discord community",
5741
5760
  "https://trigger.dev/discord"
@@ -5746,7 +5765,7 @@ async function _initCommand(dir, options) {
5746
5765
  async function createTriggerDir(dir, options) {
5747
5766
  return await tracer.startActiveSpan("createTriggerDir", async (span) => {
5748
5767
  try {
5749
- const defaultValue = `${dir}/src/trigger`;
5768
+ const defaultValue = join7(dir, "src", "trigger");
5750
5769
  const location = await text({
5751
5770
  message: "Where would you like to create the Trigger.dev directory?",
5752
5771
  defaultValue,
@@ -5756,6 +5775,7 @@ async function createTriggerDir(dir, options) {
5756
5775
  throw new OutroCommandError();
5757
5776
  }
5758
5777
  const triggerDir = resolve3(process.cwd(), location);
5778
+ logger.debug({ triggerDir });
5759
5779
  span.setAttributes({
5760
5780
  "cli.triggerDir": triggerDir
5761
5781
  });
@@ -5782,19 +5802,19 @@ async function createTriggerDir(dir, options) {
5782
5802
  });
5783
5803
  if (example === "none") {
5784
5804
  await createFile(join7(triggerDir, ".gitkeep"), "");
5785
- log3.step(`Created directory at ${location}`);
5805
+ log4.step(`Created directory at ${location}`);
5786
5806
  span.end();
5787
5807
  return { location, isCustomValue: location !== defaultValue };
5788
5808
  }
5789
- const exampleFile = resolveInternalFilePath(`./templates/examples/${example}.ts.template`);
5809
+ const templatePath = join7(cliRootPath(), "templates", "examples", `${example}.ts.template`);
5790
5810
  const outputPath = join7(triggerDir, "example.ts");
5791
5811
  await createFileFromTemplate({
5792
- templatePath: exampleFile,
5812
+ templatePath,
5793
5813
  outputPath,
5794
5814
  replacements: {}
5795
5815
  });
5796
5816
  const relativeOutputPath = relative4(process.cwd(), outputPath);
5797
- log3.step(`Created example file at ${relativeOutputPath}`);
5817
+ log4.step(`Created example file at ${relativeOutputPath}`);
5798
5818
  span.end();
5799
5819
  return { location, isCustomValue: location !== defaultValue };
5800
5820
  } catch (e) {
@@ -5817,7 +5837,7 @@ async function gitIgnoreDotTriggerDir(dir, options) {
5817
5837
  });
5818
5838
  if (!await pathExists(gitIgnorePath)) {
5819
5839
  await createFile(gitIgnorePath, ".trigger");
5820
- log3.step(`Added .trigger to .gitignore`);
5840
+ log4.step(`Added .trigger to .gitignore`);
5821
5841
  span.end();
5822
5842
  return;
5823
5843
  }
@@ -5829,7 +5849,7 @@ async function gitIgnoreDotTriggerDir(dir, options) {
5829
5849
  const newGitIgnoreContent = `${gitIgnoreContent}
5830
5850
  .trigger`;
5831
5851
  await writeFile3(gitIgnorePath, newGitIgnoreContent, "utf-8");
5832
- log3.step(`Added .trigger to .gitignore`);
5852
+ log4.step(`Added .trigger to .gitignore`);
5833
5853
  span.end();
5834
5854
  } catch (e) {
5835
5855
  if (!(e instanceof SkipCommandError)) {
@@ -5862,7 +5882,7 @@ async function addConfigFileToTsConfig(dir, options) {
5862
5882
  const newTsconfigContent = applyEdits(tsconfigContent, edits);
5863
5883
  logger.debug("new tsconfig.json content", { newTsconfigContent });
5864
5884
  await writeFile3(tsconfigPath, newTsconfigContent, "utf-8");
5865
- log3.step(`Added trigger.config.ts to tsconfig.json`);
5885
+ log4.step(`Added trigger.config.ts to tsconfig.json`);
5866
5886
  span.end();
5867
5887
  } catch (e) {
5868
5888
  if (!(e instanceof SkipCommandError)) {
@@ -5875,7 +5895,7 @@ async function addConfigFileToTsConfig(dir, options) {
5875
5895
  }
5876
5896
  async function installPackages2(dir, options) {
5877
5897
  return await tracer.startActiveSpan("installPackages", async (span) => {
5878
- const installSpinner = spinner5();
5898
+ const installSpinner = spinner();
5879
5899
  try {
5880
5900
  const projectDir = resolve3(process.cwd(), dir);
5881
5901
  const pkgManager = await getUserPackageManager(projectDir);
@@ -5927,10 +5947,10 @@ async function installPackages2(dir, options) {
5927
5947
  async function writeConfigFile(dir, project, options, triggerDir) {
5928
5948
  return await tracer.startActiveSpan("writeConfigFile", async (span) => {
5929
5949
  try {
5930
- const spnnr = spinner5();
5950
+ const spnnr = spinner();
5931
5951
  spnnr.start("Creating config file");
5932
5952
  const projectDir = resolve3(process.cwd(), dir);
5933
- const templatePath = resolveInternalFilePath("./templates/trigger.config.ts.template");
5953
+ const templatePath = join7(cliRootPath(), "templates", "trigger.config.ts.template");
5934
5954
  const outputPath = join7(projectDir, "trigger.config.ts");
5935
5955
  span.setAttributes({
5936
5956
  "cli.projectDir": projectDir,
@@ -5971,7 +5991,7 @@ async function selectProject(apiClient2, dashboardUrl, projectRef) {
5971
5991
  if (projectRef) {
5972
5992
  const projectResponse = await apiClient2.getProject(projectRef);
5973
5993
  if (!projectResponse.success) {
5974
- log3.error(
5994
+ log4.error(
5975
5995
  `--project-ref ${projectRef} is not a valid project ref. Request to fetch data resulted in: ${projectResponse.error}`
5976
5996
  );
5977
5997
  throw new SkipCommandError(projectResponse.error);
@@ -6054,7 +6074,7 @@ async function logout(options) {
6054
6074
  }
6055
6075
 
6056
6076
  // src/commands/list-profiles.ts
6057
- import { log as log4, outro as outro5 } from "@clack/prompts";
6077
+ import { log as log5, outro as outro5 } from "@clack/prompts";
6058
6078
  var ListProfilesOptions = CommonCommandOptions;
6059
6079
  function configureListProfilesCommand(program2) {
6060
6080
  return program2.command("list-profiles").description("List all of your CLI profiles").option(
@@ -6080,10 +6100,10 @@ async function listProfiles(options) {
6080
6100
  return;
6081
6101
  }
6082
6102
  const profiles = Object.keys(authConfig);
6083
- log4.message("Profiles:");
6103
+ log5.message("Profiles:");
6084
6104
  for (const profile of profiles) {
6085
6105
  const profileConfig = authConfig[profile];
6086
- log4.info(`${profile}${profileConfig?.apiUrl ? ` - ${chalkGrey(profileConfig.apiUrl)}` : ""}`);
6106
+ log5.info(`${profile}${profileConfig?.apiUrl ? ` - ${chalkGrey(profileConfig.apiUrl)}` : ""}`);
6087
6107
  }
6088
6108
  outro5("Retrieve account info by running whoami --profile <profile>");
6089
6109
  }