Skip to content

Commit 288cfff

Browse files
author
Shaw
committed
ci: stage desktop runtime without root tsdown entry
1 parent 550ebeb commit 288cfff

1 file changed

Lines changed: 33 additions & 4 deletions

File tree

packages/app-core/scripts/desktop-build.mjs

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,13 +516,42 @@ function findLatestMacAppBundle() {
516516
return candidates[0].appBundlePath;
517517
}
518518

519+
function hasRootTsdownEntry() {
520+
return (
521+
fs.existsSync(path.join(ROOT, "tsdown.config.ts")) ||
522+
fs.existsSync(path.join(ROOT, "tsdown.config.mts")) ||
523+
fs.existsSync(path.join(ROOT, "tsdown.config.js")) ||
524+
fs.existsSync(path.join(ROOT, "src", "index.ts"))
525+
);
526+
}
527+
528+
function ensureRootRuntimeBundle() {
529+
if (hasRootTsdownEntry()) {
530+
runPackageBinary("tsdown", [], {
531+
cwd: ROOT,
532+
label: "Building core runtime bundle with tsdown",
533+
});
534+
return;
535+
}
536+
537+
const distDir = path.join(ROOT, "dist");
538+
const entrySource = [
539+
"// auto-generated by desktop-build.mjs",
540+
"// Standalone elizaOS checkouts do not have a root tsdown entry.",
541+
'export * from "../packages/app-core/src/entry.ts";',
542+
"",
543+
].join("\n");
544+
545+
fs.mkdirSync(distDir, { recursive: true });
546+
fs.writeFileSync(path.join(distDir, "entry.js"), entrySource);
547+
fs.writeFileSync(path.join(distDir, "index.js"), entrySource);
548+
fs.writeFileSync(path.join(distDir, "package.json"), '{"type":"module"}\n');
549+
}
550+
519551
function stageDesktopBuild() {
520552
ensureAppDirs();
521553

522-
runPackageBinary("tsdown", [], {
523-
cwd: ROOT,
524-
label: "Building core runtime bundle with tsdown",
525-
});
554+
ensureRootRuntimeBundle();
526555

527556
runNode(["--import", "tsx", "scripts/write-build-info.ts"], {
528557
cwd: ROOT,

0 commit comments

Comments
 (0)