trigger.dev 0.0.0-v3-canary-20240321171119 → 0.0.0-v3-canary-20240321210113
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
|
|
796
|
+
import { join as join4 } 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-
|
|
803
|
+
var version = "0.0.0-v3-canary-20240321210113";
|
|
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-
|
|
824
|
+
"@trigger.dev/core": "workspace:0.0.0-v3-canary-20240321210113",
|
|
825
825
|
"@types/degit": "^2.8.3",
|
|
826
826
|
chalk: "^5.2.0",
|
|
827
827
|
chokidar: "^3.5.3",
|
|
@@ -856,6 +856,7 @@ var dependencies = {
|
|
|
856
856
|
"supports-color": "^9.4.0",
|
|
857
857
|
"terminal-link": "^3.0.0",
|
|
858
858
|
"tiny-invariant": "^1.2.0",
|
|
859
|
+
"tsconfig-paths": "^4.2.0",
|
|
859
860
|
"update-check": "^1.5.4",
|
|
860
861
|
url: "^0.11.1",
|
|
861
862
|
ws: "^8.12.0",
|
|
@@ -1588,6 +1589,9 @@ async function resolveConfig(path6, config) {
|
|
|
1588
1589
|
if (!config.projectDir) {
|
|
1589
1590
|
config.projectDir = path6;
|
|
1590
1591
|
}
|
|
1592
|
+
if (!config.tsconfigPath) {
|
|
1593
|
+
config.tsconfigPath = await getConfigPath(path6, "tsconfig.json");
|
|
1594
|
+
}
|
|
1591
1595
|
return config;
|
|
1592
1596
|
}
|
|
1593
1597
|
async function normalizeConfig(config) {
|
|
@@ -2626,55 +2630,139 @@ ${authorizationCodeResult.error}`
|
|
|
2626
2630
|
}
|
|
2627
2631
|
|
|
2628
2632
|
// src/utilities/build.ts
|
|
2629
|
-
import {
|
|
2630
|
-
import
|
|
2633
|
+
import { extname, isAbsolute } from "node:path";
|
|
2634
|
+
import tsConfigPaths from "tsconfig-paths";
|
|
2631
2635
|
function bundleDependenciesPlugin(config) {
|
|
2636
|
+
const matchPath = config.tsconfigPath ? createMatchPath(config.tsconfigPath) : void 0;
|
|
2637
|
+
function resolvePath(id) {
|
|
2638
|
+
if (!matchPath) {
|
|
2639
|
+
return id;
|
|
2640
|
+
}
|
|
2641
|
+
return matchPath(id, void 0, void 0, [".ts", ".tsx", ".js", ".jsx"]) || id;
|
|
2642
|
+
}
|
|
2632
2643
|
return {
|
|
2633
2644
|
name: "bundle-dependencies",
|
|
2634
2645
|
setup(build3) {
|
|
2635
2646
|
build3.onResolve({ filter: /.*/ }, (args) => {
|
|
2636
|
-
|
|
2647
|
+
const resolvedPath = resolvePath(args.path);
|
|
2648
|
+
logger.debug(`Checking if ${args.path} should be bundled or external`, {
|
|
2649
|
+
...args,
|
|
2650
|
+
resolvedPath
|
|
2651
|
+
});
|
|
2652
|
+
if (!isBareModuleId(resolvedPath)) {
|
|
2653
|
+
logger.debug(`Bundling ${args.path} because its not a bareModuleId`, {
|
|
2654
|
+
...args
|
|
2655
|
+
});
|
|
2656
|
+
return void 0;
|
|
2657
|
+
}
|
|
2658
|
+
if (args.path.startsWith("@trigger.dev/")) {
|
|
2659
|
+
logger.debug(`Bundling ${args.path} because its a trigger.dev package`, {
|
|
2660
|
+
...args
|
|
2661
|
+
});
|
|
2662
|
+
return void 0;
|
|
2663
|
+
}
|
|
2664
|
+
let loader;
|
|
2665
|
+
try {
|
|
2666
|
+
loader = getLoaderForFile(args.path);
|
|
2667
|
+
} catch (e) {
|
|
2668
|
+
if (!(e instanceof Error && e.message.startsWith("Cannot get loader for file"))) {
|
|
2669
|
+
throw e;
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
if (loader === "file") {
|
|
2637
2673
|
return void 0;
|
|
2638
2674
|
}
|
|
2639
2675
|
for (let pattern of config.dependenciesToBundle ?? []) {
|
|
2640
2676
|
if (typeof pattern === "string" ? args.path === pattern : pattern.test(args.path)) {
|
|
2641
|
-
|
|
2642
|
-
const resolvedPath = resolvePath(args.path, config);
|
|
2643
|
-
logger.debug(`Bundling ${args.path} as ${resolvedPath}`);
|
|
2644
|
-
return {
|
|
2645
|
-
path: resolvedPath,
|
|
2646
|
-
external: false
|
|
2647
|
-
};
|
|
2648
|
-
} catch (error) {
|
|
2649
|
-
logger.error(`Failed to resolve path ${args.path}`, error);
|
|
2650
|
-
return void 0;
|
|
2651
|
-
}
|
|
2677
|
+
return void 0;
|
|
2652
2678
|
}
|
|
2653
2679
|
}
|
|
2654
|
-
|
|
2680
|
+
logger.debug(`Externalizing ${args.path}`, {
|
|
2681
|
+
...args
|
|
2682
|
+
});
|
|
2683
|
+
return {
|
|
2684
|
+
path: args.path,
|
|
2685
|
+
external: true
|
|
2686
|
+
};
|
|
2655
2687
|
});
|
|
2656
2688
|
}
|
|
2657
2689
|
};
|
|
2658
2690
|
}
|
|
2659
|
-
function
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
requireUrl
|
|
2666
|
-
});
|
|
2667
|
-
return tmpRequire.resolve(path6);
|
|
2668
|
-
} catch (e) {
|
|
2669
|
-
logger.debug(
|
|
2670
|
-
"[bundle-dependencies] Attempting to resolve path using ESM import.meta.url resolver",
|
|
2671
|
-
{
|
|
2672
|
-
path: path6,
|
|
2673
|
-
importMetaUrl: import.meta.url
|
|
2674
|
-
}
|
|
2675
|
-
);
|
|
2676
|
-
return __require.resolve(path6);
|
|
2691
|
+
function isBareModuleId(id) {
|
|
2692
|
+
return !id.startsWith("node:") && !id.startsWith(".") && !isAbsolute(id);
|
|
2693
|
+
}
|
|
2694
|
+
function createMatchPath(tsconfigPath) {
|
|
2695
|
+
if (!tsconfigPath) {
|
|
2696
|
+
return void 0;
|
|
2677
2697
|
}
|
|
2698
|
+
let configLoaderResult = tsConfigPaths.loadConfig(tsconfigPath);
|
|
2699
|
+
if (configLoaderResult.resultType === "failed") {
|
|
2700
|
+
if (configLoaderResult.message === "Missing baseUrl in compilerOptions") {
|
|
2701
|
+
throw new Error(
|
|
2702
|
+
`\u{1F6A8} Oops! No baseUrl found, please set compilerOptions.baseUrl in your tsconfig or jsconfig`
|
|
2703
|
+
);
|
|
2704
|
+
}
|
|
2705
|
+
return void 0;
|
|
2706
|
+
}
|
|
2707
|
+
return tsConfigPaths.createMatchPath(
|
|
2708
|
+
configLoaderResult.absoluteBaseUrl,
|
|
2709
|
+
configLoaderResult.paths,
|
|
2710
|
+
configLoaderResult.mainFields,
|
|
2711
|
+
configLoaderResult.addMatchAll
|
|
2712
|
+
);
|
|
2713
|
+
}
|
|
2714
|
+
var loaders = {
|
|
2715
|
+
".aac": "file",
|
|
2716
|
+
".avif": "file",
|
|
2717
|
+
".css": "file",
|
|
2718
|
+
".csv": "file",
|
|
2719
|
+
".eot": "file",
|
|
2720
|
+
".fbx": "file",
|
|
2721
|
+
".flac": "file",
|
|
2722
|
+
".gif": "file",
|
|
2723
|
+
".glb": "file",
|
|
2724
|
+
".gltf": "file",
|
|
2725
|
+
".gql": "text",
|
|
2726
|
+
".graphql": "text",
|
|
2727
|
+
".hdr": "file",
|
|
2728
|
+
".ico": "file",
|
|
2729
|
+
".jpeg": "file",
|
|
2730
|
+
".jpg": "file",
|
|
2731
|
+
".js": "jsx",
|
|
2732
|
+
".jsx": "jsx",
|
|
2733
|
+
".json": "json",
|
|
2734
|
+
// We preprocess md and mdx files using @mdx-js/mdx and send through
|
|
2735
|
+
// the JSX for esbuild to handle
|
|
2736
|
+
".md": "jsx",
|
|
2737
|
+
".mdx": "jsx",
|
|
2738
|
+
".mov": "file",
|
|
2739
|
+
".mp3": "file",
|
|
2740
|
+
".mp4": "file",
|
|
2741
|
+
".node": "copy",
|
|
2742
|
+
".ogg": "file",
|
|
2743
|
+
".otf": "file",
|
|
2744
|
+
".png": "file",
|
|
2745
|
+
".psd": "file",
|
|
2746
|
+
".sql": "text",
|
|
2747
|
+
".svg": "file",
|
|
2748
|
+
".ts": "ts",
|
|
2749
|
+
".tsx": "tsx",
|
|
2750
|
+
".ttf": "file",
|
|
2751
|
+
".wasm": "file",
|
|
2752
|
+
".wav": "file",
|
|
2753
|
+
".webm": "file",
|
|
2754
|
+
".webmanifest": "file",
|
|
2755
|
+
".webp": "file",
|
|
2756
|
+
".woff": "file",
|
|
2757
|
+
".woff2": "file",
|
|
2758
|
+
".zip": "file"
|
|
2759
|
+
};
|
|
2760
|
+
function getLoaderForFile(file) {
|
|
2761
|
+
const ext = extname(file);
|
|
2762
|
+
const loader = loaders[ext];
|
|
2763
|
+
if (loader)
|
|
2764
|
+
return loader;
|
|
2765
|
+
throw new Error(`Cannot get loader for file ${file}`);
|
|
2678
2766
|
}
|
|
2679
2767
|
|
|
2680
2768
|
// src/commands/deploy.ts
|
|
@@ -3230,8 +3318,6 @@ async function compileProject(config, options, configPath) {
|
|
|
3230
3318
|
minify: false,
|
|
3231
3319
|
sourcemap: "external",
|
|
3232
3320
|
// does not set the //# sourceMappingURL= comment in the file, we handle it ourselves
|
|
3233
|
-
packages: "external",
|
|
3234
|
-
// https://esbuild.github.io/api/#packages
|
|
3235
3321
|
logLevel: "error",
|
|
3236
3322
|
platform: "node",
|
|
3237
3323
|
format: "cjs",
|
|
@@ -3254,7 +3340,7 @@ async function compileProject(config, options, configPath) {
|
|
|
3254
3340
|
throw new Error("Build failed, aborting deployment");
|
|
3255
3341
|
}
|
|
3256
3342
|
if (options.outputMetafile) {
|
|
3257
|
-
await writeJSONFile(
|
|
3343
|
+
await writeJSONFile(join4(options.outputMetafile, "worker.json"), result.metafile);
|
|
3258
3344
|
}
|
|
3259
3345
|
const entryPointContents = readFileSync(
|
|
3260
3346
|
new URL(importResolve("./workers/prod/entry-point.js", import.meta.url)).href.replace(
|
|
@@ -3297,35 +3383,35 @@ async function compileProject(config, options, configPath) {
|
|
|
3297
3383
|
}
|
|
3298
3384
|
if (options.outputMetafile) {
|
|
3299
3385
|
await writeJSONFile(
|
|
3300
|
-
|
|
3386
|
+
join4(options.outputMetafile, "entry-point.json"),
|
|
3301
3387
|
entryPointResult.metafile
|
|
3302
3388
|
);
|
|
3303
3389
|
}
|
|
3304
3390
|
const tempDir = await createTempDir();
|
|
3305
3391
|
logger.debug(`Writing compiled files to ${tempDir}`);
|
|
3306
|
-
const metaOutput = result.metafile.outputs[
|
|
3392
|
+
const metaOutput = result.metafile.outputs[join4("out", "stdin.js")];
|
|
3307
3393
|
invariant(metaOutput, "Meta output for the result build is missing");
|
|
3308
|
-
const entryPointMetaOutput = entryPointResult.metafile.outputs[
|
|
3394
|
+
const entryPointMetaOutput = entryPointResult.metafile.outputs[join4("out", "stdin.js")];
|
|
3309
3395
|
invariant(entryPointMetaOutput, "Meta output for the entryPoint build is missing");
|
|
3310
3396
|
const workerOutputFile = result.outputFiles.find(
|
|
3311
|
-
(file) => file.path ===
|
|
3397
|
+
(file) => file.path === join4(config.projectDir, "out", "stdin.js")
|
|
3312
3398
|
);
|
|
3313
3399
|
invariant(workerOutputFile, "Output file for the result build is missing");
|
|
3314
3400
|
const workerSourcemapFile = result.outputFiles.find(
|
|
3315
|
-
(file) => file.path ===
|
|
3401
|
+
(file) => file.path === join4(config.projectDir, "out", "stdin.js.map")
|
|
3316
3402
|
);
|
|
3317
3403
|
invariant(workerSourcemapFile, "Sourcemap file for the result build is missing");
|
|
3318
3404
|
const entryPointOutputFile = entryPointResult.outputFiles.find(
|
|
3319
|
-
(file) => file.path ===
|
|
3405
|
+
(file) => file.path === join4(config.projectDir, "out", "stdin.js")
|
|
3320
3406
|
);
|
|
3321
3407
|
invariant(entryPointOutputFile, "Output file for the entryPoint build is missing");
|
|
3322
3408
|
await writeFile2(
|
|
3323
|
-
|
|
3409
|
+
join4(tempDir, "worker.js"),
|
|
3324
3410
|
`${workerOutputFile.text}
|
|
3325
3411
|
//# sourceMappingURL=worker.js.map`
|
|
3326
3412
|
);
|
|
3327
|
-
await writeFile2(
|
|
3328
|
-
await writeFile2(
|
|
3413
|
+
await writeFile2(join4(tempDir, "worker.js.map"), workerSourcemapFile.text);
|
|
3414
|
+
await writeFile2(join4(tempDir, "index.js"), entryPointOutputFile.text);
|
|
3329
3415
|
const allImports = [...metaOutput.imports, ...entryPointMetaOutput.imports];
|
|
3330
3416
|
const dependencies2 = await gatherRequiredDependencies(allImports, config);
|
|
3331
3417
|
const packageJsonContents = {
|
|
@@ -3334,7 +3420,7 @@ async function compileProject(config, options, configPath) {
|
|
|
3334
3420
|
description: "",
|
|
3335
3421
|
dependencies: dependencies2
|
|
3336
3422
|
};
|
|
3337
|
-
await writeJSONFile(
|
|
3423
|
+
await writeJSONFile(join4(tempDir, "package.json"), packageJsonContents);
|
|
3338
3424
|
compileSpinner.stop("Project built successfully");
|
|
3339
3425
|
const resolvingDependenciesResult = await resolveDependencies(
|
|
3340
3426
|
tempDir,
|
|
@@ -3348,7 +3434,7 @@ async function compileProject(config, options, configPath) {
|
|
|
3348
3434
|
const containerFilePath = new URL(
|
|
3349
3435
|
importResolve("./Containerfile.prod", import.meta.url)
|
|
3350
3436
|
).href.replace("file://", "");
|
|
3351
|
-
await copyFile(containerFilePath,
|
|
3437
|
+
await copyFile(containerFilePath, join4(tempDir, "Containerfile"));
|
|
3352
3438
|
const contentHasher = createHash("sha256");
|
|
3353
3439
|
contentHasher.update(Buffer.from(entryPointOutputFile.text));
|
|
3354
3440
|
contentHasher.update(Buffer.from(workerOutputFile.text));
|
|
@@ -3380,8 +3466,8 @@ async function resolveDependencies(projectDir, packageJsonContents, config, opti
|
|
|
3380
3466
|
const hasher = createHash("sha256");
|
|
3381
3467
|
hasher.update(JSON.stringify(packageJsonContents));
|
|
3382
3468
|
const digest = hasher.digest("hex").slice(0, 16);
|
|
3383
|
-
const cacheDir =
|
|
3384
|
-
const cachePath =
|
|
3469
|
+
const cacheDir = join4(config.projectDir, ".trigger", "cache");
|
|
3470
|
+
const cachePath = join4(cacheDir, `${digest}.json`);
|
|
3385
3471
|
span.setAttributes({
|
|
3386
3472
|
"packageJson.digest": digest,
|
|
3387
3473
|
"cache.path": cachePath,
|
|
@@ -3390,7 +3476,7 @@ async function resolveDependencies(projectDir, packageJsonContents, config, opti
|
|
|
3390
3476
|
try {
|
|
3391
3477
|
const cachedPackageLock = await readFile2(cachePath, "utf-8");
|
|
3392
3478
|
logger.debug(`Using cached package-lock.json for ${digest}`);
|
|
3393
|
-
await writeFile2(
|
|
3479
|
+
await writeFile2(join4(projectDir, "package-lock.json"), cachedPackageLock);
|
|
3394
3480
|
span.setAttributes({
|
|
3395
3481
|
"cache.hit": true
|
|
3396
3482
|
});
|
|
@@ -3413,11 +3499,11 @@ async function resolveDependencies(projectDir, packageJsonContents, config, opti
|
|
|
3413
3499
|
cwd: projectDir,
|
|
3414
3500
|
stdio: logger.loggerLevel === "debug" ? "inherit" : "pipe"
|
|
3415
3501
|
});
|
|
3416
|
-
const packageLockContents = await readFile2(
|
|
3502
|
+
const packageLockContents = await readFile2(join4(projectDir, "package-lock.json"), "utf-8");
|
|
3417
3503
|
logger.debug(`Writing package-lock.json to cache for ${digest}`);
|
|
3418
3504
|
await mkdir(cacheDir, { recursive: true });
|
|
3419
3505
|
await writeFile2(cachePath, packageLockContents);
|
|
3420
|
-
await writeFile2(
|
|
3506
|
+
await writeFile2(join4(projectDir, "package-lock.json"), packageLockContents);
|
|
3421
3507
|
span.end();
|
|
3422
3508
|
resolvingDepsSpinner.stop("Dependencies resolved");
|
|
3423
3509
|
return true;
|
|
@@ -3472,7 +3558,7 @@ async function typecheckProject(config, options) {
|
|
|
3472
3558
|
});
|
|
3473
3559
|
}
|
|
3474
3560
|
async function gatherRequiredDependencies(imports, config) {
|
|
3475
|
-
const externalPackageJson = await readJSONFile(
|
|
3561
|
+
const externalPackageJson = await readJSONFile(join4(config.projectDir, "package.json"));
|
|
3476
3562
|
const dependencies2 = {};
|
|
3477
3563
|
for (const file of imports) {
|
|
3478
3564
|
if (file.kind !== "require-call" || !file.external) {
|
|
@@ -3521,7 +3607,7 @@ async function gatherRequiredDependencies(imports, config) {
|
|
|
3521
3607
|
}
|
|
3522
3608
|
async function ensureLoggedIntoDockerRegistry(registryHost, auth) {
|
|
3523
3609
|
const tmpDir = await createTempDir();
|
|
3524
|
-
const dockerConfigPath =
|
|
3610
|
+
const dockerConfigPath = join4(tmpDir, "config.json");
|
|
3525
3611
|
await writeJSONFile(dockerConfigPath, {
|
|
3526
3612
|
auths: {
|
|
3527
3613
|
[registryHost]: {
|
|
@@ -3567,7 +3653,7 @@ import { resolve as importResolve2 } from "import-meta-resolve";
|
|
|
3567
3653
|
import { Box, Text, render, useApp, useInput } from "ink";
|
|
3568
3654
|
import { createHash as createHash2 } from "node:crypto";
|
|
3569
3655
|
import fs7, { readFileSync as readFileSync2 } from "node:fs";
|
|
3570
|
-
import { basename, dirname as dirname2, join as
|
|
3656
|
+
import { basename, dirname as dirname2, join as join5 } from "node:path";
|
|
3571
3657
|
import pThrottle from "p-throttle";
|
|
3572
3658
|
import { WebSocket } from "partysocket";
|
|
3573
3659
|
import React, { Suspense, useEffect } from "react";
|
|
@@ -4365,8 +4451,6 @@ function useDev({
|
|
|
4365
4451
|
minify: false,
|
|
4366
4452
|
sourcemap: "external",
|
|
4367
4453
|
// does not set the //# sourceMappingURL= comment in the file, we handle it ourselves
|
|
4368
|
-
packages: "external",
|
|
4369
|
-
// https://esbuild.github.io/api/#packages
|
|
4370
4454
|
logLevel: "error",
|
|
4371
4455
|
platform: "node",
|
|
4372
4456
|
format: "cjs",
|
|
@@ -4392,19 +4476,19 @@ function useDev({
|
|
|
4392
4476
|
if (!firstBuild) {
|
|
4393
4477
|
logger.log(chalk6.dim("\u2394 Rebuilding background worker..."));
|
|
4394
4478
|
}
|
|
4395
|
-
const metaOutputKey =
|
|
4479
|
+
const metaOutputKey = join5("out", `stdin.js`);
|
|
4396
4480
|
const metaOutput = result.metafile.outputs[metaOutputKey];
|
|
4397
4481
|
if (!metaOutput) {
|
|
4398
4482
|
throw new Error(`Could not find metafile`);
|
|
4399
4483
|
}
|
|
4400
|
-
const outputFileKey =
|
|
4484
|
+
const outputFileKey = join5(config.projectDir, metaOutputKey);
|
|
4401
4485
|
const outputFile = result.outputFiles.find((file) => file.path === outputFileKey);
|
|
4402
4486
|
if (!outputFile) {
|
|
4403
4487
|
throw new Error(
|
|
4404
4488
|
`Could not find output file for entry point ${metaOutput.entryPoint}`
|
|
4405
4489
|
);
|
|
4406
4490
|
}
|
|
4407
|
-
const sourceMapFileKey =
|
|
4491
|
+
const sourceMapFileKey = join5(config.projectDir, `${metaOutputKey}.map`);
|
|
4408
4492
|
const sourceMapFile = result.outputFiles.find(
|
|
4409
4493
|
(file) => file.path === sourceMapFileKey
|
|
4410
4494
|
);
|
|
@@ -4416,7 +4500,7 @@ function useDev({
|
|
|
4416
4500
|
logger.debug(`No changes detected, skipping build`);
|
|
4417
4501
|
return;
|
|
4418
4502
|
}
|
|
4419
|
-
const fullPath =
|
|
4503
|
+
const fullPath = join5(config.projectDir, ".trigger", `${contentHash}.js`);
|
|
4420
4504
|
const sourceMapPath = `${fullPath}.map`;
|
|
4421
4505
|
const outputFileWithSourceMap = `${outputFile.text}
|
|
4422
4506
|
//# sourceMappingURL=${basename(sourceMapPath)}`;
|
|
@@ -4605,7 +4689,7 @@ async function gatherRequiredDependencies2(outputMeta, config) {
|
|
|
4605
4689
|
}
|
|
4606
4690
|
}
|
|
4607
4691
|
if (config.additionalPackages) {
|
|
4608
|
-
const projectPackageJson = await readJSONFile(
|
|
4692
|
+
const projectPackageJson = await readJSONFile(join5(config.projectDir, "package.json"));
|
|
4609
4693
|
for (const packageName of config.additionalPackages) {
|
|
4610
4694
|
if (dependencies2[packageName]) {
|
|
4611
4695
|
continue;
|
|
@@ -4661,7 +4745,7 @@ import chalk7 from "chalk";
|
|
|
4661
4745
|
import { execa as execa3 } from "execa";
|
|
4662
4746
|
import { applyEdits, modify } from "jsonc-parser";
|
|
4663
4747
|
import { writeFile as writeFile3 } from "node:fs/promises";
|
|
4664
|
-
import { join as
|
|
4748
|
+
import { join as join6, relative as relative2, resolve as resolve3 } from "node:path";
|
|
4665
4749
|
import terminalLink3 from "terminal-link";
|
|
4666
4750
|
import { z as z6 } from "zod";
|
|
4667
4751
|
|
|
@@ -4899,13 +4983,13 @@ async function createTriggerDir(dir, options) {
|
|
|
4899
4983
|
"cli.example": example
|
|
4900
4984
|
});
|
|
4901
4985
|
if (example === "none") {
|
|
4902
|
-
await createFile(
|
|
4986
|
+
await createFile(join6(triggerDir, ".gitkeep"), "");
|
|
4903
4987
|
log3.step(`Created directory at ${location}`);
|
|
4904
4988
|
span.end();
|
|
4905
4989
|
return;
|
|
4906
4990
|
}
|
|
4907
4991
|
const exampleFile = resolveInternalFilePath(`./templates/examples/${example}.ts.template`);
|
|
4908
|
-
const outputPath =
|
|
4992
|
+
const outputPath = join6(triggerDir, "example.ts");
|
|
4909
4993
|
await createFileFromTemplate({
|
|
4910
4994
|
templatePath: exampleFile,
|
|
4911
4995
|
outputPath,
|
|
@@ -4927,7 +5011,7 @@ async function gitIgnoreDotTriggerDir(dir, options) {
|
|
|
4927
5011
|
return await tracer.startActiveSpan("gitIgnoreDotTriggerDir", async (span) => {
|
|
4928
5012
|
try {
|
|
4929
5013
|
const projectDir = resolve3(process.cwd(), dir);
|
|
4930
|
-
const gitIgnorePath =
|
|
5014
|
+
const gitIgnorePath = join6(projectDir, ".gitignore");
|
|
4931
5015
|
span.setAttributes({
|
|
4932
5016
|
"cli.projectDir": projectDir,
|
|
4933
5017
|
"cli.gitIgnorePath": gitIgnorePath
|
|
@@ -4961,7 +5045,7 @@ async function addConfigFileToTsConfig(dir, options) {
|
|
|
4961
5045
|
return await tracer.startActiveSpan("createTriggerDir", async (span) => {
|
|
4962
5046
|
try {
|
|
4963
5047
|
const projectDir = resolve3(process.cwd(), dir);
|
|
4964
|
-
const tsconfigPath =
|
|
5048
|
+
const tsconfigPath = join6(projectDir, "tsconfig.json");
|
|
4965
5049
|
span.setAttributes({
|
|
4966
5050
|
"cli.projectDir": projectDir,
|
|
4967
5051
|
"cli.tsconfigPath": tsconfigPath
|
|
@@ -5048,7 +5132,7 @@ async function writeConfigFile(dir, project, options) {
|
|
|
5048
5132
|
spnnr.start("Creating config file");
|
|
5049
5133
|
const projectDir = resolve3(process.cwd(), dir);
|
|
5050
5134
|
const templatePath = resolveInternalFilePath("./templates/trigger.config.ts.template");
|
|
5051
|
-
const outputPath =
|
|
5135
|
+
const outputPath = join6(projectDir, "trigger.config.ts");
|
|
5052
5136
|
span.setAttributes({
|
|
5053
5137
|
"cli.projectDir": projectDir,
|
|
5054
5138
|
"cli.templatePath": templatePath,
|