trigger.dev 0.0.0-v3-prerelease-20240517090458 → 0.0.0-v3-prerelease-20240523152756

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
@@ -799,7 +799,7 @@ import invariant from "tiny-invariant";
799
799
  import { z as z4 } from "zod";
800
800
 
801
801
  // package.json
802
- var version = "0.0.0-v3-prerelease-20240517090458";
802
+ var version = "0.0.0-v3-prerelease-20240523152756";
803
803
  var dependencies = {
804
804
  "@anatine/esbuild-decorators": "^0.2.19",
805
805
  "@clack/prompts": "^0.7.0",
@@ -816,7 +816,7 @@ var dependencies = {
816
816
  "@opentelemetry/sdk-trace-base": "^1.22.0",
817
817
  "@opentelemetry/sdk-trace-node": "^1.22.0",
818
818
  "@opentelemetry/semantic-conventions": "^1.22.0",
819
- "@trigger.dev/core": "workspace:0.0.0-v3-prerelease-20240517090458",
819
+ "@trigger.dev/core": "workspace:0.0.0-v3-prerelease-20240523152756",
820
820
  "@types/degit": "^2.8.3",
821
821
  chalk: "^5.2.0",
822
822
  chokidar: "^3.5.3",
@@ -948,7 +948,8 @@ import {
948
948
  InitializeDeploymentResponseBody,
949
949
  GetDeploymentResponseBody,
950
950
  GetProjectsResponseBody,
951
- GetProjectResponseBody
951
+ GetProjectResponseBody,
952
+ EnvironmentVariableResponseBody
952
953
  } from "@trigger.dev/core/v3";
953
954
  var CliApiClient = class {
954
955
  constructor(apiURL, accessToken) {
@@ -1052,6 +1053,23 @@ var CliApiClient = class {
1052
1053
  }
1053
1054
  );
1054
1055
  }
1056
+ async importEnvVars(projectRef, slug, params) {
1057
+ if (!this.accessToken) {
1058
+ throw new Error("importEnvVars: No access token");
1059
+ }
1060
+ return zodfetch(
1061
+ EnvironmentVariableResponseBody,
1062
+ `${this.apiURL}/api/v1/projects/${projectRef}/envvars/${slug}/import`,
1063
+ {
1064
+ method: "POST",
1065
+ headers: {
1066
+ Authorization: `Bearer ${this.accessToken}`,
1067
+ "Content-Type": "application/json"
1068
+ },
1069
+ body: JSON.stringify(params)
1070
+ }
1071
+ );
1072
+ }
1055
1073
  async initializeDeployment(body) {
1056
1074
  if (!this.accessToken) {
1057
1075
  throw new Error("initializeDeployment: No access token");
@@ -1710,7 +1728,15 @@ async function readConfig(dir, options) {
1710
1728
  cwd: absoluteDir,
1711
1729
  tsx: false,
1712
1730
  force: false
1713
- })
1731
+ }),
1732
+ {
1733
+ name: "native-node-modules",
1734
+ setup(build3) {
1735
+ const opts = build3.initialOptions;
1736
+ opts.loader = opts.loader || {};
1737
+ opts.loader[".node"] = "copy";
1738
+ }
1739
+ }
1714
1740
  ]
1715
1741
  });
1716
1742
  try {
@@ -1723,7 +1749,8 @@ async function readConfig(dir, options) {
1723
1749
  return {
1724
1750
  status: "file",
1725
1751
  config: await resolveConfig(absoluteDir, config),
1726
- path: configPath
1752
+ path: configPath,
1753
+ module: userConfigModule
1727
1754
  };
1728
1755
  } catch (error) {
1729
1756
  return {
@@ -2302,14 +2329,14 @@ var baseOpen = async (options) => {
2302
2329
  }
2303
2330
  const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
2304
2331
  if (options.wait) {
2305
- return new Promise((resolve5, reject) => {
2332
+ return new Promise((resolve6, reject) => {
2306
2333
  subprocess.once("error", reject);
2307
2334
  subprocess.once("close", (exitCode) => {
2308
2335
  if (!options.allowNonzeroExitCode && exitCode > 0) {
2309
2336
  reject(new Error(`Exited with code ${exitCode}`));
2310
2337
  return;
2311
2338
  }
2312
- resolve5(subprocess);
2339
+ resolve6(subprocess);
2313
2340
  });
2314
2341
  });
2315
2342
  }
@@ -2426,7 +2453,7 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
2426
2453
  return error;
2427
2454
  };
2428
2455
  async function pRetry(input, options) {
2429
- return new Promise((resolve5, reject) => {
2456
+ return new Promise((resolve6, reject) => {
2430
2457
  options = {
2431
2458
  onFailedAttempt() {
2432
2459
  },
@@ -2449,7 +2476,7 @@ async function pRetry(input, options) {
2449
2476
  try {
2450
2477
  const result = await input(attemptNumber);
2451
2478
  cleanUp();
2452
- resolve5(result);
2479
+ resolve6(result);
2453
2480
  } catch (error) {
2454
2481
  try {
2455
2482
  if (!(error instanceof Error)) {
@@ -3832,6 +3859,46 @@ async function getPackageJson(absoluteProjectPath) {
3832
3859
  return { packageJson, readonlyPackageJson, packageJsonPath };
3833
3860
  }
3834
3861
 
3862
+ // src/utilities/resolveEnvVars.ts
3863
+ async function callResolveEnvVars(configModule, env, environment, projectRef) {
3864
+ if (configModule && configModule.resolveEnvVars && typeof configModule.resolveEnvVars === "function") {
3865
+ let resolvedEnvVars2 = {};
3866
+ try {
3867
+ let result = await configModule.resolveEnvVars({
3868
+ projectRef,
3869
+ environment,
3870
+ env
3871
+ });
3872
+ if (!result) {
3873
+ return;
3874
+ }
3875
+ result = await result;
3876
+ if (typeof result === "object" && result !== null && "variables" in result) {
3877
+ const variables = result.variables;
3878
+ if (Array.isArray(variables)) {
3879
+ for (const item of variables) {
3880
+ if (typeof item === "object" && item !== null && "name" in item && "value" in item && typeof item.name === "string" && typeof item.value === "string") {
3881
+ resolvedEnvVars2[item.name] = item.value;
3882
+ }
3883
+ }
3884
+ } else if (typeof variables === "object") {
3885
+ for (const [key, value] of Object.entries(variables)) {
3886
+ if (typeof key === "string" && typeof value === "string") {
3887
+ resolvedEnvVars2[key] = value;
3888
+ }
3889
+ }
3890
+ }
3891
+ }
3892
+ return {
3893
+ variables: resolvedEnvVars2,
3894
+ override: result.override
3895
+ };
3896
+ } catch (error) {
3897
+ logger.error(error);
3898
+ }
3899
+ }
3900
+ }
3901
+
3835
3902
  // src/commands/deploy.ts
3836
3903
  var DeployCommandOptions = CommonCommandOptions.extend({
3837
3904
  skipTypecheck: z4.boolean().default(false),
@@ -3981,6 +4048,7 @@ async function _deployCommand(dir, options) {
3981
4048
  resolvedConfig.status === "file" ? resolvedConfig.path : void 0
3982
4049
  );
3983
4050
  logger.debug("Compilation result", { compilation });
4051
+ await resolveEnvironmentVariables(resolvedConfig, environmentClient, options);
3984
4052
  const deploymentResponse = await environmentClient.initializeDeployment({
3985
4053
  contentHash: compilation.contentHash,
3986
4054
  userId: authorization.userId
@@ -4796,6 +4864,68 @@ If this is unexpected you should check your ${terminalLink2(
4796
4864
  }
4797
4865
  });
4798
4866
  }
4867
+ async function resolveEnvironmentVariables(config, apiClient2, options) {
4868
+ if (config.status !== "file") {
4869
+ return;
4870
+ }
4871
+ if (!config.module || typeof config.module.resolveEnvVars !== "function") {
4872
+ return;
4873
+ }
4874
+ const projectConfig = config.config;
4875
+ return await tracer.startActiveSpan("resolveEnvironmentVariables", async (span) => {
4876
+ try {
4877
+ const $spinner = spinner();
4878
+ $spinner.start("Resolving environment variables");
4879
+ let processEnv = {
4880
+ ...process.env
4881
+ };
4882
+ const environmentVariables = await apiClient2.getEnvironmentVariables(projectConfig.project);
4883
+ if (environmentVariables.success) {
4884
+ processEnv = {
4885
+ ...processEnv,
4886
+ ...environmentVariables.data.variables
4887
+ };
4888
+ }
4889
+ logger.debug("Existing environment variables", {
4890
+ keys: Object.keys(processEnv)
4891
+ });
4892
+ const resolvedEnvVars2 = await callResolveEnvVars(
4893
+ config.module,
4894
+ processEnv,
4895
+ options.env,
4896
+ projectConfig.project
4897
+ );
4898
+ if (resolvedEnvVars2) {
4899
+ const total = Object.keys(resolvedEnvVars2.variables).length;
4900
+ logger.debug("Resolved env vars", {
4901
+ keys: Object.keys(resolvedEnvVars2.variables)
4902
+ });
4903
+ if (total > 0) {
4904
+ $spinner.message(
4905
+ `Syncing ${total} environment variable${total > 1 ? "s" : ""} with the server`
4906
+ );
4907
+ const uploadResult = await apiClient2.importEnvVars(projectConfig.project, options.env, {
4908
+ variables: resolvedEnvVars2.variables,
4909
+ override: typeof resolvedEnvVars2.override === "boolean" ? resolvedEnvVars2.override : true
4910
+ });
4911
+ if (uploadResult.success) {
4912
+ $spinner.stop(`${total} environment variable${total > 1 ? "s" : ""} synced`);
4913
+ } else {
4914
+ $spinner.stop("Failed to sync environment variables");
4915
+ throw new Error(uploadResult.error);
4916
+ }
4917
+ } else {
4918
+ $spinner.stop("No environment variables to sync");
4919
+ }
4920
+ }
4921
+ } catch (e) {
4922
+ recordSpanException5(span, e);
4923
+ throw e;
4924
+ } finally {
4925
+ span.end();
4926
+ }
4927
+ });
4928
+ }
4799
4929
  async function resolveDependencies(projectDir, packageJsonContents, config, options) {
4800
4930
  return await tracer.startActiveSpan("resolveDependencies", async (span) => {
4801
4931
  const resolvingDepsSpinner = spinner();
@@ -4832,10 +4962,29 @@ async function resolveDependencies(projectDir, packageJsonContents, config, opti
4832
4962
  });
4833
4963
  logger.debug(`No cached package-lock.json found for ${digest}`);
4834
4964
  try {
4835
- await execa2("npm", ["install", "--package-lock-only", "--ignore-scripts", "--no-audit"], {
4836
- cwd: projectDir,
4837
- stdio: logger.loggerLevel === "debug" ? "inherit" : "pipe"
4838
- });
4965
+ if (logger.loggerLevel === "debug") {
4966
+ const childProcess2 = await execa2("npm", ["config", "list"], {
4967
+ cwd: projectDir,
4968
+ stdio: "inherit"
4969
+ });
4970
+ logger.debug("npm config list");
4971
+ console.log(childProcess2.stdout);
4972
+ }
4973
+ await execa2(
4974
+ "npm",
4975
+ [
4976
+ "install",
4977
+ "--package-lock-only",
4978
+ "--ignore-scripts",
4979
+ "--no-audit",
4980
+ "--legacy-peer-deps=false",
4981
+ "--strict-peer-deps=false"
4982
+ ],
4983
+ {
4984
+ cwd: projectDir,
4985
+ stdio: logger.loggerLevel === "debug" ? "inherit" : "pipe"
4986
+ }
4987
+ );
4839
4988
  const packageLockContents = await readFile2(join6(projectDir, "package-lock.json"), "utf-8");
4840
4989
  logger.debug(`Writing package-lock.json to cache for ${digest}`);
4841
4990
  await mkdir(cacheDir, { recursive: true });
@@ -4892,8 +5041,8 @@ async function typecheckProject(config, options) {
4892
5041
  tscTypecheck.stdout?.on("data", (chunk) => stdouts.push(chunk.toString()));
4893
5042
  tscTypecheck.stderr?.on("data", (chunk) => stderrs.push(chunk.toString()));
4894
5043
  try {
4895
- await new Promise((resolve5, reject) => {
4896
- tscTypecheck.addListener("exit", (code) => code === 0 ? resolve5(code) : reject(code));
5044
+ await new Promise((resolve6, reject) => {
5045
+ tscTypecheck.addListener("exit", (code) => code === 0 ? resolve6(code) : reject(code));
4897
5046
  });
4898
5047
  } catch (error) {
4899
5048
  typecheckSpinner.stop(
@@ -5139,7 +5288,7 @@ import { ZodMessageHandler, ZodMessageSender } from "@trigger.dev/core/v3/zodMes
5139
5288
  import dotenv from "dotenv";
5140
5289
  import { Evt } from "evt";
5141
5290
  import { fork } from "node:child_process";
5142
- import { dirname as dirname2, resolve as resolve3 } from "node:path";
5291
+ import { dirname as dirname2, resolve as resolve4 } from "node:path";
5143
5292
  import terminalLink3 from "terminal-link";
5144
5293
  var BackgroundWorkerCoordinator = class {
5145
5294
  constructor(baseURL) {
@@ -5312,6 +5461,7 @@ var BackgroundWorker = class {
5312
5461
  metadata;
5313
5462
  _taskRunProcesses = /* @__PURE__ */ new Map();
5314
5463
  _closed = false;
5464
+ _fullEnv = {};
5315
5465
  close() {
5316
5466
  if (this._closed) {
5317
5467
  return;
@@ -5334,13 +5484,24 @@ var BackgroundWorker = class {
5334
5484
  }
5335
5485
  let resolved = false;
5336
5486
  const cwd = dirname2(this.path);
5337
- const fullEnv = {
5487
+ this._fullEnv = {
5338
5488
  ...this.params.env,
5339
5489
  ...this.#readEnvVars(),
5340
5490
  ...this.params.debugOtel ? { OTEL_LOG_LEVEL: "debug" } : {}
5341
5491
  };
5342
- logger.debug("Initializing worker", { path: this.path, cwd, fullEnv });
5343
- this.tasks = await new Promise((resolve5, reject) => {
5492
+ let resolvedEnvVars2 = {};
5493
+ if (this.params.resolveEnvVariables) {
5494
+ const resolvedEnv = await this.params.resolveEnvVariables(this._fullEnv, this);
5495
+ if (resolvedEnv) {
5496
+ resolvedEnvVars2 = resolvedEnv;
5497
+ }
5498
+ }
5499
+ this._fullEnv = {
5500
+ ...this._fullEnv,
5501
+ ...resolvedEnvVars2
5502
+ };
5503
+ logger.debug("Initializing worker", { path: this.path, cwd, fullEnv: this._fullEnv });
5504
+ this.tasks = await new Promise((resolve6, reject) => {
5344
5505
  const child = fork(this.path, {
5345
5506
  stdio: [
5346
5507
  /*stdin*/
@@ -5352,7 +5513,7 @@ var BackgroundWorker = class {
5352
5513
  "ipc"
5353
5514
  ],
5354
5515
  cwd,
5355
- env: fullEnv
5516
+ env: this._fullEnv
5356
5517
  });
5357
5518
  const timeout = setTimeout(() => {
5358
5519
  if (resolved) {
@@ -5367,7 +5528,7 @@ var BackgroundWorker = class {
5367
5528
  if (message.type === "TASKS_READY" && !resolved) {
5368
5529
  clearTimeout(timeout);
5369
5530
  resolved = true;
5370
- resolve5(message.payload.tasks);
5531
+ resolve6(message.payload.tasks);
5371
5532
  child.kill();
5372
5533
  } else if (message.type === "UNCAUGHT_EXCEPTION") {
5373
5534
  clearTimeout(timeout);
@@ -5410,9 +5571,8 @@ var BackgroundWorker = class {
5410
5571
  payload.execution,
5411
5572
  this.path,
5412
5573
  {
5413
- ...this.params.env,
5414
- ...payload.environment ?? {},
5415
- ...this.#readEnvVars()
5574
+ ...this._fullEnv,
5575
+ ...payload.environment ?? {}
5416
5576
  },
5417
5577
  this.metadata,
5418
5578
  this.params
@@ -5502,7 +5662,7 @@ var BackgroundWorker = class {
5502
5662
  const result = {};
5503
5663
  dotenv.config({
5504
5664
  processEnv: result,
5505
- path: [".env", ".env.local", ".env.development.local"].map((p) => resolve3(process.cwd(), p))
5665
+ path: [".env", ".env.local", ".env.development.local"].map((p) => resolve4(process.cwd(), p))
5506
5666
  });
5507
5667
  process.env.TRIGGER_API_URL && (result.TRIGGER_API_URL = process.env.TRIGGER_API_URL);
5508
5668
  delete result.TRIGGER_API_URL;
@@ -5603,8 +5763,8 @@ var TaskRunProcess = class {
5603
5763
  async executeTaskRun(payload) {
5604
5764
  let resolver;
5605
5765
  let rejecter;
5606
- const promise = new Promise((resolve5, reject) => {
5607
- resolver = resolve5;
5766
+ const promise = new Promise((resolve6, reject) => {
5767
+ resolver = resolve6;
5608
5768
  rejecter = reject;
5609
5769
  });
5610
5770
  this._attemptStatuses.set(payload.execution.attempt.id, "PENDING");
@@ -5816,7 +5976,7 @@ async function startDev(dir, options, authorization, dashboardUrl) {
5816
5976
  logger.error("Failed to read config", config.error);
5817
5977
  process.exit(1);
5818
5978
  }
5819
- async function getDevReactElement(configParam, authorization2, configPath) {
5979
+ async function getDevReactElement(configParam, authorization2, configPath, configModule) {
5820
5980
  const accessToken = authorization2.accessToken;
5821
5981
  const apiUrl = authorization2.apiUrl;
5822
5982
  apiClient = new CliApiClient(apiUrl, accessToken);
@@ -5848,7 +6008,8 @@ async function startDev(dir, options, authorization, dashboardUrl) {
5848
6008
  projectName: devEnv.data.name,
5849
6009
  debuggerOn: options.debugger,
5850
6010
  debugOtel: options.debugOtel,
5851
- configPath
6011
+ configPath,
6012
+ configModule
5852
6013
  }
5853
6014
  );
5854
6015
  }
@@ -5856,7 +6017,8 @@ async function startDev(dir, options, authorization, dashboardUrl) {
5856
6017
  await getDevReactElement(
5857
6018
  config.config,
5858
6019
  authorization,
5859
- config.status === "file" ? config.path : void 0
6020
+ config.status === "file" ? config.path : void 0,
6021
+ config.status === "file" ? config.module : void 0
5860
6022
  )
5861
6023
  );
5862
6024
  rerender = devReactElement.rerender;
@@ -5879,7 +6041,8 @@ function useDev({
5879
6041
  projectName,
5880
6042
  debuggerOn,
5881
6043
  debugOtel,
5882
- configPath
6044
+ configPath,
6045
+ configModule
5883
6046
  }) {
5884
6047
  useEffect(() => {
5885
6048
  const websocketUrl = new URL(apiUrl);
@@ -5968,6 +6131,7 @@ function useDev({
5968
6131
  await messageHandler.handleMessage(data);
5969
6132
  });
5970
6133
  let ctx;
6134
+ let firstBuild = true;
5971
6135
  async function runBuild() {
5972
6136
  if (ctx) {
5973
6137
  await ctx.dispose();
@@ -5998,7 +6162,6 @@ function useDev({
5998
6162
  `const importedConfig = undefined; const handleError = undefined;`
5999
6163
  );
6000
6164
  }
6001
- let firstBuild = true;
6002
6165
  logger.log(chalkGrey("\u25CB Building background worker\u2026"));
6003
6166
  ctx = await context2({
6004
6167
  stdin: {
@@ -6099,7 +6262,8 @@ function useDev({
6099
6262
  ...environmentVariablesResponse.success ? environmentVariablesResponse.data.variables : {}
6100
6263
  },
6101
6264
  debuggerOn,
6102
- debugOtel
6265
+ debugOtel,
6266
+ resolveEnvVariables: createResolveEnvironmentVariablesFunction(configModule)
6103
6267
  });
6104
6268
  try {
6105
6269
  await backgroundWorker.initialize();
@@ -6371,6 +6535,26 @@ async function findPnpmNodeModulesPath() {
6371
6535
  { type: "directory" }
6372
6536
  );
6373
6537
  }
6538
+ var hasResolvedEnvVars = false;
6539
+ var resolvedEnvVars = {};
6540
+ function createResolveEnvironmentVariablesFunction(configModule) {
6541
+ return async (env, worker) => {
6542
+ if (hasResolvedEnvVars) {
6543
+ return resolvedEnvVars;
6544
+ }
6545
+ const $resolvedEnvVars = await callResolveEnvVars(
6546
+ configModule,
6547
+ env,
6548
+ "dev",
6549
+ worker.params.projectConfig.project
6550
+ );
6551
+ if ($resolvedEnvVars) {
6552
+ resolvedEnvVars = $resolvedEnvVars.variables;
6553
+ hasResolvedEnvVars = true;
6554
+ }
6555
+ return resolvedEnvVars;
6556
+ };
6557
+ }
6374
6558
 
6375
6559
  // src/commands/init.ts
6376
6560
  import { intro as intro5, isCancel as isCancel2, log as log6, outro as outro6, select as select2, text } from "@clack/prompts";
@@ -6379,9 +6563,9 @@ import { flattenAttributes as flattenAttributes4 } from "@trigger.dev/core/v3";
6379
6563
  import { recordSpanException as recordSpanException6 } from "@trigger.dev/core/v3/workers";
6380
6564
  import chalk5 from "chalk";
6381
6565
  import { execa as execa3 } from "execa";
6382
- import { applyEdits, modify } from "jsonc-parser";
6566
+ import { applyEdits, modify, findNodeAtLocation, parseTree, getNodeValue } from "jsonc-parser";
6383
6567
  import { writeFile as writeFile3 } from "node:fs/promises";
6384
- import { join as join8, relative as relative4, resolve as resolve4 } from "node:path";
6568
+ import { join as join8, relative as relative4, resolve as resolve5 } from "node:path";
6385
6569
  import terminalLink4 from "terminal-link";
6386
6570
  import { z as z6 } from "zod";
6387
6571
 
@@ -6546,7 +6730,7 @@ async function createTriggerDir(dir, options) {
6546
6730
  if (isCancel2(location)) {
6547
6731
  throw new OutroCommandError();
6548
6732
  }
6549
- const triggerDir = resolve4(process.cwd(), location);
6733
+ const triggerDir = resolve5(process.cwd(), location);
6550
6734
  logger.debug({ triggerDir });
6551
6735
  span.setAttributes({
6552
6736
  "cli.triggerDir": triggerDir
@@ -6601,7 +6785,7 @@ async function createTriggerDir(dir, options) {
6601
6785
  async function gitIgnoreDotTriggerDir(dir, options) {
6602
6786
  return await tracer.startActiveSpan("gitIgnoreDotTriggerDir", async (span) => {
6603
6787
  try {
6604
- const projectDir = resolve4(process.cwd(), dir);
6788
+ const projectDir = resolve5(process.cwd(), dir);
6605
6789
  const gitIgnorePath = join8(projectDir, ".gitignore");
6606
6790
  span.setAttributes({
6607
6791
  "cli.projectDir": projectDir,
@@ -6635,14 +6819,30 @@ async function gitIgnoreDotTriggerDir(dir, options) {
6635
6819
  async function addConfigFileToTsConfig(dir, options) {
6636
6820
  return await tracer.startActiveSpan("createTriggerDir", async (span) => {
6637
6821
  try {
6638
- const projectDir = resolve4(process.cwd(), dir);
6822
+ const projectDir = resolve5(process.cwd(), dir);
6639
6823
  const tsconfigPath = join8(projectDir, "tsconfig.json");
6640
6824
  span.setAttributes({
6641
6825
  "cli.projectDir": projectDir,
6642
6826
  "cli.tsconfigPath": tsconfigPath
6643
6827
  });
6644
6828
  const tsconfigContent = await readFile(tsconfigPath);
6645
- const edits = modify(tsconfigContent, ["include", -1], "trigger.config.ts", {
6829
+ const tsconfigContentTree = parseTree(tsconfigContent, void 0);
6830
+ if (!tsconfigContentTree) {
6831
+ span.end();
6832
+ return;
6833
+ }
6834
+ const tsconfigIncludeOption = findNodeAtLocation(tsconfigContentTree, ["include"]);
6835
+ if (!tsconfigIncludeOption) {
6836
+ span.end();
6837
+ return;
6838
+ }
6839
+ const tsConfigFileName = "trigger.config.ts";
6840
+ const tsconfigIncludeOptionValue = getNodeValue(tsconfigIncludeOption);
6841
+ if (tsconfigIncludeOptionValue.includes(tsConfigFileName)) {
6842
+ span.end();
6843
+ return;
6844
+ }
6845
+ const edits = modify(tsconfigContent, ["include", -1], tsConfigFileName, {
6646
6846
  isArrayInsertion: true,
6647
6847
  formattingOptions: {
6648
6848
  tabSize: 2,
@@ -6669,7 +6869,7 @@ async function installPackages2(dir, options) {
6669
6869
  return await tracer.startActiveSpan("installPackages", async (span) => {
6670
6870
  const installSpinner = spinner();
6671
6871
  try {
6672
- const projectDir = resolve4(process.cwd(), dir);
6872
+ const projectDir = resolve5(process.cwd(), dir);
6673
6873
  const pkgManager = await getUserPackageManager(projectDir);
6674
6874
  span.setAttributes({
6675
6875
  "cli.projectDir": projectDir,
@@ -6721,7 +6921,7 @@ async function writeConfigFile(dir, project, options, triggerDir) {
6721
6921
  try {
6722
6922
  const spnnr = spinner();
6723
6923
  spnnr.start("Creating config file");
6724
- const projectDir = resolve4(process.cwd(), dir);
6924
+ const projectDir = resolve5(process.cwd(), dir);
6725
6925
  const templatePath = join8(cliRootPath(), "templates", "trigger.config.ts.template");
6726
6926
  const outputPath = join8(projectDir, "trigger.config.ts");
6727
6927
  span.setAttributes({