diff --git a/index.ts b/index.ts index dd17b66..29960f9 100644 --- a/index.ts +++ b/index.ts @@ -77,4 +77,7 @@ async function main() { await renderer.renderStats(totalUsage); } -await main(); +main().catch((err) => { + console.error(err); + process.exit(1); +}); diff --git a/package.json b/package.json index 458c538..63eb70c 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,19 @@ { "name": "lmc", "module": "index.ts", - "type": "module", + "main": "dist/index.js", + "type": "commonjs", "private": true, "bin": { - "lmc": "dist/index.js", - "ttsc": "dist/tts.js" + "lmc": "dist/index.js" }, "scripts": { "dev": "tsx index.ts", "prod": "node dist/index.js", "check": "biome check --write && pnpm run tc", - "build": "pnpm run check && pnpm run bundle", - "bundle": "esbuild index.ts --bundle --outdir=dist --platform=node --target=node18 --format=esm --packages=external", + "build": "pnpm run check && pnpm run bundle && pnpm run bin", + "bundle": "esbuild index.ts --bundle --outdir=dist --platform=node --target=node22", + "bin": "node --build-sea sea-config.json", "tc": "tsc --noEmit --incremental" }, "devDependencies": { diff --git a/sea-config.json b/sea-config.json new file mode 100644 index 0000000..4beec69 --- /dev/null +++ b/sea-config.json @@ -0,0 +1,6 @@ +{ + "main": "dist/index.js", + "output": "dist/lmc", + "useCodeCache": true, + "disableExperimentalSEAWarning": true +}