From cbbc86ea760602856f595fe75505c204e11e407c Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 07:01:07 +0000 Subject: [PATCH] feat: use TypeScript directly for Deno runtime, skip bundling Since Deno supports TypeScript natively, copy deno-runtime/main.ts as-is instead of bundling it to JS. This removes an unnecessary build step and simplifies the pipeline. - Replace Bun bundle step in infra/build.ts with fs.copyFileSync - Update getDenoWrapperPath() to reference main.ts instead of main.js - Update build-binaries.ts prerequisite check accordingly Co-authored-by: Netanel Gilad --- infra/build-binaries.ts | 2 +- infra/build.ts | 41 ++++++++++++++++++++++++----------------- src/core/assets.ts | 2 +- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/infra/build-binaries.ts b/infra/build-binaries.ts index eda24eb6..2cf59100 100644 --- a/infra/build-binaries.ts +++ b/infra/build-binaries.ts @@ -58,7 +58,7 @@ const WINDOWS_ICON = join(ROOT, "infra", "base44.ico"); for (const required of [ "dist/cli/index.js", "dist/assets/templates/templates.json", - "dist/assets/deno-runtime/main.js", + "dist/assets/deno-runtime/main.ts", ]) { if (!existsSync(join(ROOT, required))) { console.error( diff --git a/infra/build.ts b/infra/build.ts index ec167022..a276b97c 100644 --- a/infra/build.ts +++ b/infra/build.ts @@ -1,4 +1,4 @@ -import { watch } from "node:fs"; +import { watch, copyFileSync, mkdirSync } from "node:fs"; import type { BuildConfig } from "bun"; import chalk from "chalk"; @@ -25,18 +25,22 @@ const runBuild = async (config: BuildConfig) => { return result; }; +const copyDenoRuntime = () => { + const outDir = "./dist/assets/deno-runtime"; + mkdirSync(outDir, { recursive: true }); + copyFileSync("./deno-runtime/main.ts", `${outDir}/main.ts`); + return `${outDir}/main.ts`; +}; + const runAllBuilds = async () => { const cli = await runBuild({ entrypoints: ["./src/cli/index.ts"], outdir: "./dist/cli", }); - const denoRuntime = await runBuild({ - entrypoints: ["./deno-runtime/main.ts"], - outdir: "./dist/assets/deno-runtime", - }); + const denoRuntimePath = copyDenoRuntime(); return { cli, - denoRuntime, + denoRuntimePath, }; }; @@ -54,16 +58,19 @@ if (process.argv.includes("--watch")) { const time = new Date().toLocaleTimeString(); console.log(chalk.dim(`[${time}]`), chalk.gray(`${filename} ${event}d`)); - const { cli, denoRuntime } = await runAllBuilds(); - for (const result of [cli, denoRuntime]) { - if (result.success && result.outputs.length > 0) { - console.log( - chalk.green(` ✓ Rebuilt`), - chalk.dim(`→`), - formatOutput(result.outputs), - ); - } + const { cli, denoRuntimePath } = await runAllBuilds(); + if (cli.success && cli.outputs.length > 0) { + console.log( + chalk.green(` ✓ Rebuilt`), + chalk.dim(`→`), + formatOutput(cli.outputs), + ); } + console.log( + chalk.green(` ✓ Copied`), + chalk.dim(`→`), + chalk.cyan(denoRuntimePath), + ); }; await runAllBuilds(); @@ -75,9 +82,9 @@ if (process.argv.includes("--watch")) { // Keep process alive await new Promise(() => {}); } else { - const { cli, denoRuntime } = await runAllBuilds(); + const { cli, denoRuntimePath } = await runAllBuilds(); console.log(chalk.green.bold(`\n✓ Build complete\n`)); console.log(chalk.dim(" Output:")); console.log(` ${formatOutput(cli.outputs)}`); - console.log(` ${formatOutput(denoRuntime.outputs)}`); + console.log(` ${chalk.cyan(denoRuntimePath)}`); } diff --git a/src/core/assets.ts b/src/core/assets.ts index 40c0e160..246bb23b 100644 --- a/src/core/assets.ts +++ b/src/core/assets.ts @@ -14,7 +14,7 @@ export function getTemplatesIndexPath(): string { } export function getDenoWrapperPath(): string { - return join(ASSETS_DIR, "deno-runtime", "main.js"); + return join(ASSETS_DIR, "deno-runtime", "main.ts"); } /**