mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-06 16:02:23 +00:00
fix(cli): narrow codebases to bun
This commit is contained in:
+5
-2
@@ -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;
|
||||
|
||||
|
||||
+17
-4
@@ -89,13 +89,26 @@ export function findCodebase(
|
||||
}
|
||||
}
|
||||
}
|
||||
function addCodebaseDigestIfRelevant(
|
||||
async function addCodebaseDigestIfRelevant(
|
||||
path: string,
|
||||
content: string,
|
||||
codebases: SyncCodebase[]
|
||||
): string {
|
||||
): Promise<string> {
|
||||
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<string> {
|
||||
const content = await Deno.readTextFile(localP);
|
||||
|
||||
return addCodebaseDigestIfRelevant(localP, content, codebases);
|
||||
return await addCodebaseDigestIfRelevant(localP, content, codebases);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user