trigger.dev 0.0.0-v3-canary-20240322141522 → 0.0.0-v3-canary-20240322145829

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
@@ -793,14 +793,14 @@ import { resolve as importResolve } from "import-meta-resolve";
793
793
  import { createHash } from "node:crypto";
794
794
  import { readFileSync } from "node:fs";
795
795
  import { copyFile, mkdir, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
796
- import { join as join4 } from "node:path";
796
+ import { dirname, join as join4, relative as relative2 } from "node:path";
797
797
  import { setTimeout as setTimeout2 } from "node:timers/promises";
798
798
  import terminalLink from "terminal-link";
799
799
  import invariant from "tiny-invariant";
800
800
  import { z as z4 } from "zod";
801
801
 
802
802
  // package.json
803
- var version = "0.0.0-v3-canary-20240322141522";
803
+ var version = "0.0.0-v3-canary-20240322145829";
804
804
  var dependencies = {
805
805
  "@baselime/node-opentelemetry": "^0.4.6",
806
806
  "@clack/prompts": "^0.7.0",
@@ -821,7 +821,7 @@ var dependencies = {
821
821
  "@opentelemetry/sdk-trace-node": "^1.21.0",
822
822
  "@opentelemetry/semantic-conventions": "^1.21.0",
823
823
  "@traceloop/instrumentation-openai": "^0.3.9",
824
- "@trigger.dev/core": "workspace:0.0.0-v3-canary-20240322141522",
824
+ "@trigger.dev/core": "workspace:0.0.0-v3-canary-20240322145829",
825
825
  "@types/degit": "^2.8.3",
826
826
  chalk: "^5.2.0",
827
827
  chokidar: "^3.5.3",
@@ -833,6 +833,7 @@ var dependencies = {
833
833
  evt: "^2.4.13",
834
834
  execa: "^8.0.0",
835
835
  "find-up": "^7.0.0",
836
+ glob: "^10.3.10",
836
837
  "gradient-string": "^2.0.2",
837
838
  "import-meta-resolve": "^4.0.0",
838
839
  ink: "^4.4.1",
@@ -2766,6 +2767,7 @@ function getLoaderForFile(file) {
2766
2767
  }
2767
2768
 
2768
2769
  // src/commands/deploy.ts
2770
+ import { Glob } from "glob";
2769
2771
  var DeployCommandOptions = CommonCommandOptions.extend({
2770
2772
  skipTypecheck: z4.boolean().default(false),
2771
2773
  skipDeploy: z4.boolean().default(false),
@@ -3429,6 +3431,7 @@ async function compileProject(config, options, configPath) {
3429
3431
  }
3430
3432
  };
3431
3433
  await writeJSONFile(join4(tempDir, "package.json"), packageJsonContents);
3434
+ await copyAdditionalFiles(config, tempDir);
3432
3435
  compileSpinner.stop("Project built successfully");
3433
3436
  const resolvingDependenciesResult = await resolveDependencies(
3434
3437
  tempDir,
@@ -3612,6 +3615,47 @@ async function gatherRequiredDependencies(imports, config, projectPackageJson) {
3612
3615
  }
3613
3616
  return Object.fromEntries(Object.entries(dependencies2).sort(([a], [b]) => a.localeCompare(b)));
3614
3617
  }
3618
+ async function copyAdditionalFiles(config, tempDir) {
3619
+ const additionalFiles = config.additionalFiles ?? [];
3620
+ if (additionalFiles.length === 0) {
3621
+ return;
3622
+ }
3623
+ return await tracer.startActiveSpan(
3624
+ "copyAdditionalFiles",
3625
+ {
3626
+ attributes: {
3627
+ "config.additionalFiles": additionalFiles
3628
+ }
3629
+ },
3630
+ async (span) => {
3631
+ try {
3632
+ logger.debug(`Copying files to ${tempDir}`, {
3633
+ additionalFiles
3634
+ });
3635
+ const glob = new Glob(additionalFiles, {
3636
+ withFileTypes: true,
3637
+ ignore: ["node_modules"],
3638
+ cwd: config.projectDir,
3639
+ nodir: true
3640
+ });
3641
+ for await (const file of glob) {
3642
+ const relativeDestinationPath = join4(
3643
+ tempDir,
3644
+ relative2(config.projectDir, file.fullpath())
3645
+ );
3646
+ logger.debug(`Copying file ${file.fullpath()} to ${relativeDestinationPath}`);
3647
+ await mkdir(dirname(relativeDestinationPath), { recursive: true });
3648
+ await copyFile(file.fullpath(), relativeDestinationPath);
3649
+ }
3650
+ span.end();
3651
+ } catch (error) {
3652
+ recordSpanException4(span, error);
3653
+ span.end();
3654
+ throw error;
3655
+ }
3656
+ }
3657
+ );
3658
+ }
3615
3659
  async function ensureLoggedIntoDockerRegistry(registryHost, auth) {
3616
3660
  const tmpDir = await createTempDir();
3617
3661
  const dockerConfigPath = join4(tmpDir, "config.json");
@@ -3660,7 +3704,7 @@ import { resolve as importResolve2 } from "import-meta-resolve";
3660
3704
  import { Box, Text, render, useApp, useInput } from "ink";
3661
3705
  import { createHash as createHash2 } from "node:crypto";
3662
3706
  import fs7, { readFileSync as readFileSync2 } from "node:fs";
3663
- import { basename, dirname as dirname2, join as join5 } from "node:path";
3707
+ import { basename, dirname as dirname3, join as join5 } from "node:path";
3664
3708
  import pThrottle from "p-throttle";
3665
3709
  import { WebSocket } from "partysocket";
3666
3710
  import React, { Suspense, useEffect } from "react";
@@ -3691,7 +3735,7 @@ import chalk5 from "chalk";
3691
3735
  import dotenv from "dotenv";
3692
3736
  import { Evt } from "evt";
3693
3737
  import { fork } from "node:child_process";
3694
- import { dirname, resolve as resolve2 } from "node:path";
3738
+ import { dirname as dirname2, resolve as resolve2 } from "node:path";
3695
3739
  import terminalLink2 from "terminal-link";
3696
3740
  var BackgroundWorkerCoordinator = class {
3697
3741
  constructor(baseURL) {
@@ -3873,7 +3917,7 @@ var BackgroundWorker = class {
3873
3917
  throw new Error("Worker already initialized");
3874
3918
  }
3875
3919
  if (this.params.dependencies) {
3876
- await installPackages(this.params.dependencies, { cwd: dirname(this.path) });
3920
+ await installPackages(this.params.dependencies, { cwd: dirname2(this.path) });
3877
3921
  }
3878
3922
  let resolved = false;
3879
3923
  this.tasks = await new Promise((resolve4, reject) => {
@@ -4093,7 +4137,7 @@ var TaskRunProcess = class {
4093
4137
  "pipe",
4094
4138
  "ipc"
4095
4139
  ],
4096
- cwd: dirname(this.path),
4140
+ cwd: dirname2(this.path),
4097
4141
  env: {
4098
4142
  ...this.env,
4099
4143
  OTEL_RESOURCE_ATTRIBUTES: JSON.stringify({
@@ -4518,7 +4562,7 @@ function useDev({
4518
4562
  const sourceMapPath = `${fullPath}.map`;
4519
4563
  const outputFileWithSourceMap = `${outputFile.text}
4520
4564
  //# sourceMappingURL=${basename(sourceMapPath)}`;
4521
- await fs7.promises.mkdir(dirname2(fullPath), { recursive: true });
4565
+ await fs7.promises.mkdir(dirname3(fullPath), { recursive: true });
4522
4566
  await fs7.promises.writeFile(fullPath, outputFileWithSourceMap);
4523
4567
  logger.debug(`Wrote background worker to ${fullPath}`);
4524
4568
  const dependencies2 = await gatherRequiredDependencies2(metaOutput, config);
@@ -4759,7 +4803,7 @@ import chalk7 from "chalk";
4759
4803
  import { execa as execa3 } from "execa";
4760
4804
  import { applyEdits, modify } from "jsonc-parser";
4761
4805
  import { writeFile as writeFile3 } from "node:fs/promises";
4762
- import { join as join6, relative as relative2, resolve as resolve3 } from "node:path";
4806
+ import { join as join6, relative as relative3, resolve as resolve3 } from "node:path";
4763
4807
  import terminalLink3 from "terminal-link";
4764
4808
  import { z as z6 } from "zod";
4765
4809
 
@@ -5009,7 +5053,7 @@ async function createTriggerDir(dir, options) {
5009
5053
  outputPath,
5010
5054
  replacements: {}
5011
5055
  });
5012
- const relativeOutputPath = relative2(process.cwd(), outputPath);
5056
+ const relativeOutputPath = relative3(process.cwd(), outputPath);
5013
5057
  log3.step(`Created example file at ${relativeOutputPath}`);
5014
5058
  span.end();
5015
5059
  } catch (e) {
@@ -5160,7 +5204,7 @@ async function writeConfigFile(dir, project, options) {
5160
5204
  outputPath,
5161
5205
  override: options.overrideConfig
5162
5206
  });
5163
- const relativePathToOutput = relative2(process.cwd(), outputPath);
5207
+ const relativePathToOutput = relative3(process.cwd(), outputPath);
5164
5208
  spnnr.stop(
5165
5209
  result.success ? `Config file created at ${relativePathToOutput}` : `Failed to create config file: ${result.error}`
5166
5210
  );