Skip to content

Commit bb8b34b

Browse files
committed
Fix an issue where a missing tsconfig.json file would throw an error on dev/deploy
1 parent b5ecd06 commit bb8b34b

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

.changeset/clever-buses-watch.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"trigger.dev": patch
3+
"@trigger.dev/core": patch
4+
---
5+
6+
Fix an issue where a missing tsconfig.json file would throw an error on dev/deploy

packages/cli-v3/src/config.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ async function resolveConfig(
138138
warn = true
139139
): Promise<ResolvedConfig> {
140140
const packageJsonPath = await resolvePackageJSON(cwd);
141-
const tsconfigPath = await resolveTSConfig(cwd);
141+
const tsconfigPath = await safeResolveTsConfig(cwd);
142142
const lockfilePath = await resolveLockfile(cwd);
143143
const workspaceDir = await findWorkspaceDir(cwd);
144144

@@ -179,7 +179,7 @@ async function resolveConfig(
179179
conditions: [],
180180
},
181181
}
182-
);
182+
) as ResolvedConfig; // TODO: For some reason, without this, there is a weird type error complaining about tsconfigPath being string | nullish, which can't be assigned to string | undefined
183183

184184
return {
185185
...mergedConfig,
@@ -188,6 +188,14 @@ async function resolveConfig(
188188
};
189189
}
190190

191+
async function safeResolveTsConfig(cwd: string) {
192+
try {
193+
return await resolveTSConfig(cwd);
194+
} catch {
195+
return undefined;
196+
}
197+
}
198+
191199
const IGNORED_DIRS = ["node_modules", ".git", "dist", "out", "build"];
192200

193201
async function autoDetectDirs(workingDir: string): Promise<string[]> {

packages/cli-v3/src/utilities/sourceFiles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export async function resolveFileSources(
3131
}
3232

3333
await resolveConfigSource(sources, resolvedConfig.workingDir, resolvedConfig.configFile);
34-
await resolveConfigSource(sources, resolvedConfig.workingDir, resolvedConfig.tsconfig);
34+
await resolveConfigSource(sources, resolvedConfig.workingDir, resolvedConfig.tsconfigPath);
3535
await resolveConfigSource(sources, resolvedConfig.workingDir, resolvedConfig.packageJsonPath);
3636

3737
return sources;

packages/core/src/v3/build/resolvedConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export type ResolvedConfig = Prettify<
2424
packageJsonPath: string;
2525
lockfilePath: string;
2626
configFile?: string;
27+
tsconfigPath?: string;
2728
resolveEnvVars?: ResolveEnvironmentVariablesFunction;
2829
instrumentedPackageNames?: string[];
2930
}

0 commit comments

Comments
 (0)