trigger.dev 3.0.0-beta.11 → 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.11";
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.11",
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
  }
@@ -1666,19 +1663,19 @@ async function readConfig(dir, options) {
1666
1663
  path: configPath
1667
1664
  };
1668
1665
  }
1669
- async function resolveConfig(path6, config) {
1666
+ async function resolveConfig(path7, config) {
1670
1667
  if (!config.triggerDirectories) {
1671
- config.triggerDirectories = await findTriggerDirectories(path6);
1668
+ config.triggerDirectories = await findTriggerDirectories(path7);
1672
1669
  }
1673
1670
  config.triggerDirectories = resolveTriggerDirectories(config.triggerDirectories);
1674
1671
  if (!config.triggerUrl) {
1675
1672
  config.triggerUrl = CLOUD_API_URL;
1676
1673
  }
1677
1674
  if (!config.projectDir) {
1678
- config.projectDir = path6;
1675
+ config.projectDir = path7;
1679
1676
  }
1680
1677
  if (!config.tsconfigPath) {
1681
- config.tsconfigPath = await getConfigPath(path6, "tsconfig.json");
1678
+ config.tsconfigPath = await getConfigPath(path7, "tsconfig.json");
1682
1679
  }
1683
1680
  return config;
1684
1681
  }
@@ -1692,7 +1689,6 @@ async function normalizeConfig(config, overrides) {
1692
1689
  }
1693
1690
 
1694
1691
  // src/utilities/initialBanner.ts
1695
- import { spinner } from "@clack/prompts";
1696
1692
  import chalk3 from "chalk";
1697
1693
  import checkForUpdate from "update-check";
1698
1694
 
@@ -1704,6 +1700,25 @@ function getVersion() {
1704
1700
  return packageJsonContent.version ?? "1.0.0";
1705
1701
  }
1706
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
+
1707
1722
  // src/utilities/initialBanner.ts
1708
1723
  async function printInitialBanner(performUpdateCheck = true) {
1709
1724
  const packageVersion = getVersion();
@@ -1734,15 +1749,15 @@ After installation, run Trigger.dev with \`npx trigger.dev\`.`
1734
1749
  }
1735
1750
  async function printStandloneInitialBanner(performUpdateCheck = true) {
1736
1751
  const packageVersion = getVersion();
1737
- let text3 = `
1738
- ${logo()} ${chalkGrey("(v3 Developer Preview)")}`;
1752
+ logger.log(`
1753
+ ${logo()} ${chalkGrey("(v3 Developer Preview)")}`);
1739
1754
  if (performUpdateCheck) {
1740
1755
  const maybeNewVersion = await updateCheck();
1741
1756
  if (maybeNewVersion !== void 0) {
1742
- text3 = `${text3} (update available ${chalk3.green(maybeNewVersion)})`;
1757
+ logger.log(`Update available ${chalk3.green(maybeNewVersion)}`);
1743
1758
  }
1744
1759
  }
1745
- logger.log(text3 + "\n" + chalkGrey("-".repeat(54)));
1760
+ logger.log(`${chalkGrey("-".repeat(54))}`);
1746
1761
  }
1747
1762
  function printDevBanner() {
1748
1763
  logger.log(
@@ -1783,11 +1798,11 @@ async function installPackages(packages, options) {
1783
1798
  }
1784
1799
  );
1785
1800
  }
1786
- function detectPackageNameFromImportPath(path6) {
1787
- if (path6.startsWith("@")) {
1788
- return path6.split("/").slice(0, 2).join("/");
1801
+ function detectPackageNameFromImportPath(path7) {
1802
+ if (path7.startsWith("@")) {
1803
+ return path7.split("/").slice(0, 2).join("/");
1789
1804
  } else {
1790
- return path6.split("/")[0];
1805
+ return path7.split("/")[0];
1791
1806
  }
1792
1807
  }
1793
1808
  function stripWorkspaceFromVersion(version2) {
@@ -1803,16 +1818,16 @@ function parsePackageName(packageSpecifier) {
1803
1818
  }
1804
1819
  return { name: packageSpecifier };
1805
1820
  }
1806
- async function setPackageJsonDeps(path6, deps) {
1821
+ async function setPackageJsonDeps(path7, deps) {
1807
1822
  try {
1808
- const existingPackageJson = await readJSONFile(path6);
1823
+ const existingPackageJson = await readJSONFile(path7);
1809
1824
  const newPackageJson = {
1810
1825
  ...existingPackageJson,
1811
1826
  dependencies: {
1812
1827
  ...deps
1813
1828
  }
1814
1829
  };
1815
- await writeJSONFile(path6, newPackageJson);
1830
+ await writeJSONFile(path7, newPackageJson);
1816
1831
  } catch (error) {
1817
1832
  const defaultPackageJson = {
1818
1833
  name: "temp",
@@ -1820,12 +1835,12 @@ async function setPackageJsonDeps(path6, deps) {
1820
1835
  description: "",
1821
1836
  dependencies: deps
1822
1837
  };
1823
- await writeJSONFile(path6, defaultPackageJson);
1838
+ await writeJSONFile(path7, defaultPackageJson);
1824
1839
  }
1825
1840
  }
1826
1841
 
1827
1842
  // src/commands/login.ts
1828
- 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";
1829
1844
  import { recordSpanException as recordSpanException3 } from "@trigger.dev/core/v3";
1830
1845
 
1831
1846
  // ../../node_modules/.pnpm/open@10.0.3/node_modules/open/index.js
@@ -2373,7 +2388,7 @@ async function pRetry(input, options) {
2373
2388
  import { z as z3 } from "zod";
2374
2389
 
2375
2390
  // src/commands/whoami.ts
2376
- import { intro, note, spinner as spinner2 } from "@clack/prompts";
2391
+ import { intro, note } from "@clack/prompts";
2377
2392
 
2378
2393
  // src/utilities/session.ts
2379
2394
  import { recordSpanException as recordSpanException2 } from "@trigger.dev/core/v3";
@@ -2451,7 +2466,7 @@ async function whoAmI(options, embedded = false) {
2451
2466
  if (!embedded) {
2452
2467
  intro(`Displaying your account details [${options?.profile ?? "default"}]`);
2453
2468
  }
2454
- const loadingSpinner = spinner2();
2469
+ const loadingSpinner = spinner();
2455
2470
  loadingSpinner.start("Checking your account details");
2456
2471
  const authentication = await isLoggedIn(options?.profile);
2457
2472
  if (!authentication.ok) {
@@ -2618,16 +2633,16 @@ async function login(options) {
2618
2633
  }
2619
2634
  }
2620
2635
  if (opts.embedded) {
2621
- log.step("You must login to continue.");
2636
+ log2.step("You must login to continue.");
2622
2637
  }
2623
2638
  const apiClient2 = new CliApiClient(authConfig?.apiUrl ?? opts.defaultApiUrl);
2624
2639
  const authorizationCodeResult = await createAuthorizationCode(apiClient2);
2625
- log.step(
2640
+ log2.step(
2626
2641
  `Please visit the following URL to login:
2627
2642
  ${chalkLink(authorizationCodeResult.url)}`
2628
2643
  );
2629
2644
  await open_default(authorizationCodeResult.url);
2630
- const getPersonalAccessTokenSpinner = spinner3();
2645
+ const getPersonalAccessTokenSpinner = spinner();
2631
2646
  getPersonalAccessTokenSpinner.start("Waiting for you to login");
2632
2647
  try {
2633
2648
  const indexResult = await pRetry(
@@ -2656,7 +2671,7 @@ ${chalkLink(authorizationCodeResult.url)}`
2656
2671
  throw new Error(whoAmIResult.error);
2657
2672
  }
2658
2673
  if (opts.embedded) {
2659
- log.step("Logged in successfully");
2674
+ log2.step("Logged in successfully");
2660
2675
  } else {
2661
2676
  outro2("Logged in successfully");
2662
2677
  }
@@ -2675,7 +2690,7 @@ ${chalkLink(authorizationCodeResult.url)}`
2675
2690
  } catch (e) {
2676
2691
  getPersonalAccessTokenSpinner.stop(`Failed to get access token`);
2677
2692
  if (e instanceof AbortError) {
2678
- log.error(e.message);
2693
+ log2.error(e.message);
2679
2694
  }
2680
2695
  recordSpanException3(span, e);
2681
2696
  span.end();
@@ -2724,7 +2739,7 @@ async function getPersonalAccessToken(apiClient2, authorizationCode) {
2724
2739
  async function createAuthorizationCode(apiClient2) {
2725
2740
  return await tracer.startActiveSpan("createAuthorizationCode", async (span) => {
2726
2741
  try {
2727
- const createAuthCodeSpinner = spinner3();
2742
+ const createAuthCodeSpinner = spinner();
2728
2743
  createAuthCodeSpinner.start("Creating authorition code");
2729
2744
  const authorizationCodeResult = await apiClient2.createAuthorizationCode();
2730
2745
  if (!authorizationCodeResult.success) {
@@ -2798,7 +2813,9 @@ function workerSetupImportConfigPlugin(configPath) {
2798
2813
  let workerSetupContents = readFileSync(args.path, "utf-8");
2799
2814
  workerSetupContents = workerSetupContents.replace(
2800
2815
  "__SETUP_IMPORTED_PROJECT_CONFIG__",
2801
- `import * as setupImportedConfigExports from "${configPath}"; const setupImportedConfig = setupImportedConfigExports.config;`
2816
+ `import * as setupImportedConfigExports from "${escapeImportPath(
2817
+ configPath
2818
+ )}"; const setupImportedConfig = setupImportedConfigExports.config;`
2802
2819
  );
2803
2820
  logger.debug("Loading worker setup", {
2804
2821
  args,
@@ -3082,9 +3099,9 @@ import { join as join4 } from "node:path";
3082
3099
 
3083
3100
  // src/utilities/getUserPackageManager.ts
3084
3101
  import { findUp as findUp2 } from "find-up";
3085
- async function getUserPackageManager(path6) {
3102
+ async function getUserPackageManager(path7) {
3086
3103
  try {
3087
- return await detectPackageManagerFromArtifacts(path6);
3104
+ return await detectPackageManagerFromArtifacts(path7);
3088
3105
  } catch (error) {
3089
3106
  return detectPackageManagerFromCurrentCommand();
3090
3107
  }
@@ -3103,7 +3120,7 @@ function detectPackageManagerFromCurrentCommand() {
3103
3120
  return "npm";
3104
3121
  }
3105
3122
  }
3106
- async function detectPackageManagerFromArtifacts(path6) {
3123
+ async function detectPackageManagerFromArtifacts(path7) {
3107
3124
  const packageFiles = [
3108
3125
  { name: "yarn.lock", pm: "yarn" },
3109
3126
  { name: "pnpm-lock.yaml", pm: "pnpm" },
@@ -3111,7 +3128,7 @@ async function detectPackageManagerFromArtifacts(path6) {
3111
3128
  { name: "npm-shrinkwrap.json", pm: "npm" }
3112
3129
  ];
3113
3130
  for (const { name, pm } of packageFiles) {
3114
- const foundPath = await findUp2(name, { cwd: path6 });
3131
+ const foundPath = await findUp2(name, { cwd: path7 });
3115
3132
  if (typeof foundPath === "string") {
3116
3133
  return pm;
3117
3134
  }
@@ -3273,6 +3290,15 @@ var YarnCommands = class {
3273
3290
  }
3274
3291
  };
3275
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
+
3276
3302
  // src/commands/deploy.ts
3277
3303
  var DeployCommandOptions = CommonCommandOptions.extend({
3278
3304
  skipTypecheck: z4.boolean().default(false),
@@ -3334,10 +3360,10 @@ function configureDeployCommand(program2) {
3334
3360
  "--output-metafile <path>",
3335
3361
  "If provided, will save the esbuild metafile for the build to the specified path"
3336
3362
  ).hideHelp()
3337
- ).action(async (path6, options) => {
3363
+ ).action(async (path7, options) => {
3338
3364
  await handleTelemetry(async () => {
3339
3365
  await printStandloneInitialBanner(true);
3340
- await deployCommand(path6, options);
3366
+ await deployCommand(path7, options);
3341
3367
  });
3342
3368
  });
3343
3369
  }
@@ -3391,7 +3417,7 @@ async function _deployCommand(dir, options) {
3391
3417
  throw new Error(deploymentEnv.error);
3392
3418
  }
3393
3419
  const environmentClient = new CliApiClient(authorization.auth.apiUrl, deploymentEnv.data.apiKey);
3394
- log2.step(
3420
+ log3.step(
3395
3421
  `Preparing to deploy "${deploymentEnv.data.name}" (${resolvedConfig.config.project}) to ${options.env}`
3396
3422
  );
3397
3423
  const compilation = await compileProject(
@@ -3422,7 +3448,7 @@ async function _deployCommand(dir, options) {
3422
3448
  );
3423
3449
  }
3424
3450
  const version2 = deploymentResponse.data.version;
3425
- const deploymentSpinner = spinner4();
3451
+ const deploymentSpinner = spinner();
3426
3452
  deploymentSpinner.start(`Deploying version ${version2}`);
3427
3453
  const selfHostedRegistryHost = deploymentResponse.data.registryHost ?? options.registry;
3428
3454
  const registryHost = selfHostedRegistryHost ?? "registry.trigger.dev";
@@ -3583,7 +3609,7 @@ async function checkEnvVars(envVars, config, options, environmentClient, apiUrl)
3583
3609
  return await tracer.startActiveSpan("detectEnvVars", async (span) => {
3584
3610
  try {
3585
3611
  span.setAttribute("envVars.check", envVars);
3586
- const environmentVariablesSpinner = spinner4();
3612
+ const environmentVariablesSpinner = spinner();
3587
3613
  environmentVariablesSpinner.start("Checking environment variables");
3588
3614
  const environmentVariables = await environmentClient.getEnvironmentVariables(config.project);
3589
3615
  if (!environmentVariables.success) {
@@ -3893,25 +3919,25 @@ async function compileProject(config, options, configPath) {
3893
3919
  throw new Error("Typecheck failed, aborting deployment");
3894
3920
  }
3895
3921
  }
3896
- const compileSpinner = spinner4();
3922
+ const compileSpinner = spinner();
3897
3923
  compileSpinner.start(`Building project in ${config.projectDir}`);
3898
3924
  const taskFiles = await gatherTaskFiles(config);
3899
3925
  const workerFacade = readFileSync2(
3900
- new URL(importResolve("./workers/prod/worker-facade.js", import.meta.url)).href.replace(
3901
- "file://",
3902
- ""
3903
- ),
3926
+ join5(cliRootPath(), "workers", "prod", "worker-facade.js"),
3904
3927
  "utf-8"
3905
3928
  );
3906
- const workerSetupPath = new URL(
3907
- importResolve("./workers/prod/worker-setup.js", import.meta.url)
3908
- ).href.replace("file://", "");
3909
- 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
+ );
3910
3934
  if (configPath) {
3911
3935
  logger.debug("Importing project config from", { configPath });
3912
3936
  workerContents = workerContents.replace(
3913
3937
  "__IMPORTED_PROJECT_CONFIG__",
3914
- `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;`
3915
3941
  );
3916
3942
  } else {
3917
3943
  workerContents = workerContents.replace(
@@ -3963,10 +3989,7 @@ async function compileProject(config, options, configPath) {
3963
3989
  await writeJSONFile(join5(options.outputMetafile, "worker.json"), result.metafile);
3964
3990
  }
3965
3991
  const entryPointContents = readFileSync2(
3966
- new URL(importResolve("./workers/prod/entry-point.js", import.meta.url)).href.replace(
3967
- "file://",
3968
- ""
3969
- ),
3992
+ join5(cliRootPath(), "workers", "prod", "entry-point.js"),
3970
3993
  "utf-8"
3971
3994
  );
3972
3995
  const entryPointResult = await build2({
@@ -4015,9 +4038,9 @@ async function compileProject(config, options, configPath) {
4015
4038
  }
4016
4039
  const tempDir = await createTempDir();
4017
4040
  logger.debug(`Writing compiled files to ${tempDir}`);
4018
- const metaOutput = result.metafile.outputs[join5("out", "stdin.js")];
4041
+ const metaOutput = result.metafile.outputs[posix.join("out", "stdin.js")];
4019
4042
  invariant(metaOutput, "Meta output for the result build is missing");
4020
- const entryPointMetaOutput = entryPointResult.metafile.outputs[join5("out", "stdin.js")];
4043
+ const entryPointMetaOutput = entryPointResult.metafile.outputs[posix.join("out", "stdin.js")];
4021
4044
  invariant(entryPointMetaOutput, "Meta output for the entryPoint build is missing");
4022
4045
  const workerOutputFile = result.outputFiles.find(
4023
4046
  (file) => file.path === join5(config.projectDir, "out", "stdin.js")
@@ -4066,9 +4089,7 @@ async function compileProject(config, options, configPath) {
4066
4089
  if (!resolvingDependenciesResult) {
4067
4090
  throw new SkipLoggingError("Failed to resolve dependencies");
4068
4091
  }
4069
- const containerFilePath = new URL(
4070
- importResolve("./Containerfile.prod", import.meta.url)
4071
- ).href.replace("file://", "");
4092
+ const containerFilePath = join5(cliRootPath(), "Containerfile.prod");
4072
4093
  await copyFile(containerFilePath, join5(tempDir, "Containerfile"));
4073
4094
  const contentHasher = createHash("sha256");
4074
4095
  contentHasher.update(Buffer.from(entryPointOutputFile.text));
@@ -4096,7 +4117,7 @@ async function compileProject(config, options, configPath) {
4096
4117
  }
4097
4118
  async function resolveDependencies(projectDir, packageJsonContents, config, options) {
4098
4119
  return await tracer.startActiveSpan("resolveDependencies", async (span) => {
4099
- const resolvingDepsSpinner = spinner4();
4120
+ const resolvingDepsSpinner = spinner();
4100
4121
  resolvingDepsSpinner.start("Resolving dependencies");
4101
4122
  const hasher = createHash("sha256");
4102
4123
  hasher.update(JSON.stringify(packageJsonContents));
@@ -4180,7 +4201,7 @@ ${chalkError("X Error:")} The package ${chalkPurple(
4180
4201
  async function typecheckProject(config, options) {
4181
4202
  return await tracer.startActiveSpan("typecheckProject", async (span) => {
4182
4203
  try {
4183
- const typecheckSpinner = spinner4();
4204
+ const typecheckSpinner = spinner();
4184
4205
  typecheckSpinner.start("Typechecking project");
4185
4206
  const tscTypecheck = execa2("npm", ["exec", "tsc", "--", "--noEmit"], {
4186
4207
  cwd: config.projectDir
@@ -4349,11 +4370,10 @@ import {
4349
4370
  } from "@trigger.dev/core/v3";
4350
4371
  import { watch } from "chokidar";
4351
4372
  import { context as context2 } from "esbuild";
4352
- import { resolve as importResolve2 } from "import-meta-resolve";
4353
4373
  import { render, useInput } from "ink";
4354
4374
  import { createHash as createHash2 } from "node:crypto";
4355
4375
  import fs7, { readFileSync as readFileSync3 } from "node:fs";
4356
- import { basename, dirname as dirname3, join as join6 } from "node:path";
4376
+ import { basename, dirname as dirname3, join as join6, normalize } from "node:path";
4357
4377
  import pDebounce from "p-debounce";
4358
4378
  import { WebSocket } from "partysocket";
4359
4379
  import React, { Suspense, useEffect } from "react";
@@ -4551,8 +4571,8 @@ var CancelledProcessError = class extends Error {
4551
4571
  }
4552
4572
  };
4553
4573
  var BackgroundWorker = class {
4554
- constructor(path6, params) {
4555
- this.path = path6;
4574
+ constructor(path7, params) {
4575
+ this.path = path7;
4556
4576
  this.params = params;
4557
4577
  }
4558
4578
  _initialized = false;
@@ -4766,9 +4786,9 @@ var BackgroundWorker = class {
4766
4786
  }
4767
4787
  };
4768
4788
  var TaskRunProcess = class {
4769
- constructor(execution, path6, env, metadata, worker) {
4789
+ constructor(execution, path7, env, metadata, worker) {
4770
4790
  this.execution = execution;
4771
- this.path = path6;
4791
+ this.path = path7;
4772
4792
  this.env = env;
4773
4793
  this.metadata = metadata;
4774
4794
  this.worker = worker;
@@ -4992,9 +5012,9 @@ function configureDevCommand(program2) {
4992
5012
  "-p, --project-ref <project ref>",
4993
5013
  "The project ref. Required if there is no config file."
4994
5014
  ).option("--debugger", "Enable the debugger").option("--debug-otel", "Enable OpenTelemetry debugging")
4995
- ).action(async (path6, options) => {
5015
+ ).action(async (path7, options) => {
4996
5016
  wrapCommandAction("dev", DevCommandOptions, options, async (opts) => {
4997
- await devCommand(path6, opts);
5017
+ await devCommand(path7, opts);
4998
5018
  });
4999
5019
  });
5000
5020
  }
@@ -5198,22 +5218,21 @@ function useDev({
5198
5218
  }
5199
5219
  let latestWorkerContentHash;
5200
5220
  const taskFiles = await gatherTaskFiles(config);
5201
- const workerFacade = readFileSync3(
5202
- new URL(importResolve2("./workers/dev/worker-facade.js", import.meta.url)).href.replace(
5203
- "file://",
5204
- ""
5205
- ),
5206
- "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)}";`
5207
5227
  );
5208
- const workerSetupPath = new URL(
5209
- importResolve2("./workers/dev/worker-setup.js", import.meta.url)
5210
- ).href.replace("file://", "");
5211
- let entryPointContents = workerFacade.replace("__TASKS__", createTaskFileImports(taskFiles)).replace("__WORKER_SETUP__", `import { tracingSDK, sender } from "${workerSetupPath}";`);
5212
5228
  if (configPath) {
5229
+ configPath = normalize(configPath);
5213
5230
  logger.debug("Importing project config from", { configPath });
5214
5231
  entryPointContents = entryPointContents.replace(
5215
5232
  "__IMPORTED_PROJECT_CONFIG__",
5216
- `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;`
5217
5236
  );
5218
5237
  } else {
5219
5238
  entryPointContents = entryPointContents.replace(
@@ -5266,7 +5285,10 @@ function useDev({
5266
5285
  if (!firstBuild) {
5267
5286
  logger.log(chalkGrey("\u25CB Building background worker\u2026"));
5268
5287
  }
5269
- 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
+ });
5270
5292
  const metaOutput = result.metafile.outputs[metaOutputKey];
5271
5293
  if (!metaOutput) {
5272
5294
  throw new Error(`Could not find metafile`);
@@ -5431,12 +5453,12 @@ ${chalkError("X Error:")} The package ${chalkPurple(
5431
5453
  ignoreInitial: true
5432
5454
  }
5433
5455
  );
5434
- taskFileWatcher.on("add", async (path6) => {
5456
+ taskFileWatcher.on("add", async (path7) => {
5435
5457
  throttledRebuild().catch((error) => {
5436
5458
  logger.error(error);
5437
5459
  });
5438
5460
  });
5439
- taskFileWatcher.on("unlink", async (path6) => {
5461
+ taskFileWatcher.on("unlink", async (path7) => {
5440
5462
  throttledRebuild().catch((error) => {
5441
5463
  logger.error(error);
5442
5464
  });
@@ -5577,7 +5599,7 @@ async function findPnpmNodeModulesPath() {
5577
5599
  }
5578
5600
 
5579
5601
  // src/commands/init.ts
5580
- 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";
5581
5603
  import { context as context3, trace as trace3 } from "@opentelemetry/api";
5582
5604
  import {
5583
5605
  flattenAttributes as flattenAttributes3,
@@ -5593,7 +5615,7 @@ import { z as z6 } from "zod";
5593
5615
 
5594
5616
  // src/utilities/createFileFromTemplate.ts
5595
5617
  import fs8 from "fs/promises";
5596
- import path5 from "path";
5618
+ import path6 from "path";
5597
5619
  async function createFileFromTemplate(params) {
5598
5620
  let template = await readFile(params.templatePath);
5599
5621
  if (await pathExists(params.outputPath) && !params.override) {
@@ -5604,7 +5626,7 @@ async function createFileFromTemplate(params) {
5604
5626
  }
5605
5627
  try {
5606
5628
  const output = replaceAll(template, params.replacements);
5607
- const directoryName = path5.dirname(params.outputPath);
5629
+ const directoryName = path6.dirname(params.outputPath);
5608
5630
  await fs8.mkdir(directoryName, { recursive: true });
5609
5631
  await fs8.writeFile(params.outputPath, output);
5610
5632
  return {
@@ -5632,12 +5654,6 @@ function replaceAll(input, replacements) {
5632
5654
  return output;
5633
5655
  }
5634
5656
 
5635
- // src/utilities/resolveInternalFilePath.ts
5636
- import { resolve as importResolve3 } from "import-meta-resolve";
5637
- function resolveInternalFilePath(filePath) {
5638
- return new URL(importResolve3(filePath, import.meta.url)).href.replace("file://", "");
5639
- }
5640
-
5641
5657
  // src/commands/init.ts
5642
5658
  var InitCommandOptions = CommonCommandOptions.extend({
5643
5659
  projectRef: z6.string().optional(),
@@ -5655,10 +5671,10 @@ function configureInitCommand(program2) {
5655
5671
  "The version of the @trigger.dev/sdk package to install",
5656
5672
  "beta"
5657
5673
  ).option("--skip-package-install", "Skip installing the @trigger.dev/sdk package").option("--override-config", "Override the existing config file if it exists")
5658
- ).action(async (path6, options) => {
5674
+ ).action(async (path7, options) => {
5659
5675
  await handleTelemetry(async () => {
5660
5676
  await printStandloneInitialBanner(true);
5661
- await initCommand(path6, options);
5677
+ await initCommand(path7, options);
5662
5678
  });
5663
5679
  });
5664
5680
  }
@@ -5710,11 +5726,11 @@ async function _initCommand(dir, options) {
5710
5726
  ...flattenAttributes3(selectedProject, "cli.project")
5711
5727
  });
5712
5728
  logger.debug("Selected project", selectedProject);
5713
- log3.step(`Configuring project "${selectedProject.name}" (${selectedProject.externalRef})`);
5729
+ log4.step(`Configuring project "${selectedProject.name}" (${selectedProject.externalRef})`);
5714
5730
  if (!options.skipPackageInstall) {
5715
5731
  await installPackages2(dir, options);
5716
5732
  } else {
5717
- log3.info("Skipping package installation");
5733
+ log4.info("Skipping package installation");
5718
5734
  }
5719
5735
  const triggerDir = await createTriggerDir(dir, options);
5720
5736
  await writeConfigFile(dir, selectedProject, options, triggerDir);
@@ -5724,21 +5740,21 @@ async function _initCommand(dir, options) {
5724
5740
  "project dashboard",
5725
5741
  `${authorization.dashboardUrl}/projects/v3/${selectedProject.externalRef}`
5726
5742
  );
5727
- log3.success("Successfully initialized project for Trigger.dev v3 \u{1FAE1}");
5728
- log3.info("Next steps:");
5729
- log3.info(
5743
+ log4.success("Successfully initialized project for Trigger.dev v3 \u{1FAE1}");
5744
+ log4.info("Next steps:");
5745
+ log4.info(
5730
5746
  ` 1. To start developing, run ${chalk6.green(
5731
5747
  `npx trigger.dev@${options.tag} dev`
5732
5748
  )} in your project directory`
5733
5749
  );
5734
- log3.info(` 2. Visit your ${projectDashboard} to view your newly created tasks.`);
5735
- log3.info(
5750
+ log4.info(` 2. Visit your ${projectDashboard} to view your newly created tasks.`);
5751
+ log4.info(
5736
5752
  ` 3. Head over to our ${terminalLink3(
5737
5753
  "v3 docs",
5738
5754
  "https://trigger.dev/docs/v3"
5739
5755
  )} to learn more.`
5740
5756
  );
5741
- log3.info(
5757
+ log4.info(
5742
5758
  ` 4. Need help? Join our ${terminalLink3(
5743
5759
  "Discord community",
5744
5760
  "https://trigger.dev/discord"
@@ -5749,7 +5765,7 @@ async function _initCommand(dir, options) {
5749
5765
  async function createTriggerDir(dir, options) {
5750
5766
  return await tracer.startActiveSpan("createTriggerDir", async (span) => {
5751
5767
  try {
5752
- const defaultValue = `${dir}/src/trigger`;
5768
+ const defaultValue = join7(dir, "src", "trigger");
5753
5769
  const location = await text({
5754
5770
  message: "Where would you like to create the Trigger.dev directory?",
5755
5771
  defaultValue,
@@ -5759,6 +5775,7 @@ async function createTriggerDir(dir, options) {
5759
5775
  throw new OutroCommandError();
5760
5776
  }
5761
5777
  const triggerDir = resolve3(process.cwd(), location);
5778
+ logger.debug({ triggerDir });
5762
5779
  span.setAttributes({
5763
5780
  "cli.triggerDir": triggerDir
5764
5781
  });
@@ -5785,19 +5802,19 @@ async function createTriggerDir(dir, options) {
5785
5802
  });
5786
5803
  if (example === "none") {
5787
5804
  await createFile(join7(triggerDir, ".gitkeep"), "");
5788
- log3.step(`Created directory at ${location}`);
5805
+ log4.step(`Created directory at ${location}`);
5789
5806
  span.end();
5790
5807
  return { location, isCustomValue: location !== defaultValue };
5791
5808
  }
5792
- const exampleFile = resolveInternalFilePath(`./templates/examples/${example}.ts.template`);
5809
+ const templatePath = join7(cliRootPath(), "templates", "examples", `${example}.ts.template`);
5793
5810
  const outputPath = join7(triggerDir, "example.ts");
5794
5811
  await createFileFromTemplate({
5795
- templatePath: exampleFile,
5812
+ templatePath,
5796
5813
  outputPath,
5797
5814
  replacements: {}
5798
5815
  });
5799
5816
  const relativeOutputPath = relative4(process.cwd(), outputPath);
5800
- log3.step(`Created example file at ${relativeOutputPath}`);
5817
+ log4.step(`Created example file at ${relativeOutputPath}`);
5801
5818
  span.end();
5802
5819
  return { location, isCustomValue: location !== defaultValue };
5803
5820
  } catch (e) {
@@ -5820,7 +5837,7 @@ async function gitIgnoreDotTriggerDir(dir, options) {
5820
5837
  });
5821
5838
  if (!await pathExists(gitIgnorePath)) {
5822
5839
  await createFile(gitIgnorePath, ".trigger");
5823
- log3.step(`Added .trigger to .gitignore`);
5840
+ log4.step(`Added .trigger to .gitignore`);
5824
5841
  span.end();
5825
5842
  return;
5826
5843
  }
@@ -5832,7 +5849,7 @@ async function gitIgnoreDotTriggerDir(dir, options) {
5832
5849
  const newGitIgnoreContent = `${gitIgnoreContent}
5833
5850
  .trigger`;
5834
5851
  await writeFile3(gitIgnorePath, newGitIgnoreContent, "utf-8");
5835
- log3.step(`Added .trigger to .gitignore`);
5852
+ log4.step(`Added .trigger to .gitignore`);
5836
5853
  span.end();
5837
5854
  } catch (e) {
5838
5855
  if (!(e instanceof SkipCommandError)) {
@@ -5865,7 +5882,7 @@ async function addConfigFileToTsConfig(dir, options) {
5865
5882
  const newTsconfigContent = applyEdits(tsconfigContent, edits);
5866
5883
  logger.debug("new tsconfig.json content", { newTsconfigContent });
5867
5884
  await writeFile3(tsconfigPath, newTsconfigContent, "utf-8");
5868
- log3.step(`Added trigger.config.ts to tsconfig.json`);
5885
+ log4.step(`Added trigger.config.ts to tsconfig.json`);
5869
5886
  span.end();
5870
5887
  } catch (e) {
5871
5888
  if (!(e instanceof SkipCommandError)) {
@@ -5878,7 +5895,7 @@ async function addConfigFileToTsConfig(dir, options) {
5878
5895
  }
5879
5896
  async function installPackages2(dir, options) {
5880
5897
  return await tracer.startActiveSpan("installPackages", async (span) => {
5881
- const installSpinner = spinner5();
5898
+ const installSpinner = spinner();
5882
5899
  try {
5883
5900
  const projectDir = resolve3(process.cwd(), dir);
5884
5901
  const pkgManager = await getUserPackageManager(projectDir);
@@ -5930,10 +5947,10 @@ async function installPackages2(dir, options) {
5930
5947
  async function writeConfigFile(dir, project, options, triggerDir) {
5931
5948
  return await tracer.startActiveSpan("writeConfigFile", async (span) => {
5932
5949
  try {
5933
- const spnnr = spinner5();
5950
+ const spnnr = spinner();
5934
5951
  spnnr.start("Creating config file");
5935
5952
  const projectDir = resolve3(process.cwd(), dir);
5936
- const templatePath = resolveInternalFilePath("./templates/trigger.config.ts.template");
5953
+ const templatePath = join7(cliRootPath(), "templates", "trigger.config.ts.template");
5937
5954
  const outputPath = join7(projectDir, "trigger.config.ts");
5938
5955
  span.setAttributes({
5939
5956
  "cli.projectDir": projectDir,
@@ -5974,7 +5991,7 @@ async function selectProject(apiClient2, dashboardUrl, projectRef) {
5974
5991
  if (projectRef) {
5975
5992
  const projectResponse = await apiClient2.getProject(projectRef);
5976
5993
  if (!projectResponse.success) {
5977
- log3.error(
5994
+ log4.error(
5978
5995
  `--project-ref ${projectRef} is not a valid project ref. Request to fetch data resulted in: ${projectResponse.error}`
5979
5996
  );
5980
5997
  throw new SkipCommandError(projectResponse.error);
@@ -6057,7 +6074,7 @@ async function logout(options) {
6057
6074
  }
6058
6075
 
6059
6076
  // src/commands/list-profiles.ts
6060
- import { log as log4, outro as outro5 } from "@clack/prompts";
6077
+ import { log as log5, outro as outro5 } from "@clack/prompts";
6061
6078
  var ListProfilesOptions = CommonCommandOptions;
6062
6079
  function configureListProfilesCommand(program2) {
6063
6080
  return program2.command("list-profiles").description("List all of your CLI profiles").option(
@@ -6083,10 +6100,10 @@ async function listProfiles(options) {
6083
6100
  return;
6084
6101
  }
6085
6102
  const profiles = Object.keys(authConfig);
6086
- log4.message("Profiles:");
6103
+ log5.message("Profiles:");
6087
6104
  for (const profile of profiles) {
6088
6105
  const profileConfig = authConfig[profile];
6089
- log4.info(`${profile}${profileConfig?.apiUrl ? ` - ${chalkGrey(profileConfig.apiUrl)}` : ""}`);
6106
+ log5.info(`${profile}${profileConfig?.apiUrl ? ` - ${chalkGrey(profileConfig.apiUrl)}` : ""}`);
6090
6107
  }
6091
6108
  outro5("Retrieve account info by running whoami --profile <profile>");
6092
6109
  }