diff --git a/cli/script.ts b/cli/script.ts index 9148fb4d97..b8d2647268 100644 --- a/cli/script.ts +++ b/cli/script.ts @@ -139,9 +139,13 @@ export async function handleFile( .substring(0, path.indexOf(".")) .replaceAll("\\", "/"); - const codebase = findCodebase(path, codebases); + const language = inferContentTypeFromFilePath(path, opts?.defaultTs); + + const codebase = + language == "bun" ? findCodebase(path, codebases) : undefined; let bundleContent: string | undefined = undefined; + if (codebase) { const esbuild = await import("npm:esbuild"); log.info(`Starting building the bundle for ${path}`); @@ -168,7 +172,6 @@ export async function handleFile( globalDeps ) )?.payload; - const language = inferContentTypeFromFilePath(path, opts?.defaultTs); const workspaceId = workspace.workspaceId; diff --git a/cli/sync.ts b/cli/sync.ts index 3ab3d3531b..3255723a3f 100644 --- a/cli/sync.ts +++ b/cli/sync.ts @@ -89,13 +89,26 @@ export function findCodebase( } } } -function addCodebaseDigestIfRelevant( +async function addCodebaseDigestIfRelevant( path: string, content: string, codebases: SyncCodebase[] -): string { +): Promise { const isScript = path.endsWith(".script.yaml"); - if (isScript) { + if (!isScript) { + return content; + } + let isTs = true; + try { + await Deno.stat(path.replace(".script.yaml", ".ts")); + } catch { + isTs = false; + } + if (!isTs) { + return content; + } + log.info(`isScript: ${isScript}, isTs: ${isTs}; ${path}`); + if (isTs) { const c = findCodebase(path, codebases); if (c) { const parsed: any = yamlParse(content); @@ -144,7 +157,7 @@ export async function FSFSElement( async getContentText(): Promise { const content = await Deno.readTextFile(localP); - return addCodebaseDigestIfRelevant(localP, content, codebases); + return await addCodebaseDigestIfRelevant(localP, content, codebases); }, }; }