mirror of
https://github.com/hanzoai/gui.git
synced 2026-10-25 02:31:41 +00:00
Babel and esbuild were never here for TypeScript. Babel carried the static optimizing compiler and one plugin that appended extensions to esbuild's emitted imports; source now names its own extensions and the compiler rewrites them on emit. A sixty-line runner replaces the tool: an ESM emit with declarations, a CommonJS emit where a manifest states a require entry, and a native emit where a .native sibling takes its sibling's name. The compiler packages keep Babel as their own substrate; nothing else runs over the code. Eighteen packages still carry type errors the previous tool never checked.
24 lines
809 B
TypeScript
24 lines
809 B
TypeScript
import { existsSync } from 'node:fs'
|
|
import { execSync } from 'node:child_process'
|
|
import { join } from 'node:path'
|
|
|
|
// check if critical packages are built by looking for dist folder
|
|
// using vite-plugin as it's commonly needed and fails loudly if missing
|
|
const criticalPackage = join(process.cwd(), 'pkgs/compiler/vite-plugin/dist')
|
|
|
|
if (!existsSync(criticalPackage)) {
|
|
console.info('\n📦 First time setup detected - building packages...\n')
|
|
console.info('This may take a few minutes on first run.\n')
|
|
|
|
try {
|
|
execSync('bun run build', {
|
|
stdio: 'inherit',
|
|
cwd: process.cwd(),
|
|
})
|
|
console.info('\n✅ Build complete! You can now run `bun run dev`\n')
|
|
} catch (error) {
|
|
console.error('\n❌ Build failed. Try running `bun run build` manually.\n')
|
|
process.exit(1)
|
|
}
|
|
}
|