chore: format code and improve readability in build.ts

This commit is contained in:
Jonas Perusquia Morales
2026-04-16 13:14:36 -06:00
parent 01e54fcbc9
commit 3f0e924f69
+12 -9
View File
@@ -18,8 +18,8 @@ const oldConsole = {
log: console.log, log: console.log,
warn: console.warn, warn: console.warn,
}; };
console.log = () => {}; console.log = () => { };
console.warn = () => {}; console.warn = () => { };
const define = { const define = {
__isDev: "0", __isDev: "0",
@@ -87,7 +87,7 @@ const neverBundle = [
* Building backend and general API * Building backend and general API
*/ */
async function buildApi() { async function buildApi() {
await build({ await build({
minify, minify,
sourcemap, sourcemap,
// don't use tsdown's broken watch, we'll handle it ourselves // don't use tsdown's broken watch, we'll handle it ourselves
@@ -97,12 +97,15 @@ async function buildApi() {
entry: [ entry: [
"src/index.ts", "src/index.ts",
"src/core/utils/index.ts", "src/core/utils/index.ts",
"src/plugins/index.ts",
"src/modes/index.ts", "src/modes/index.ts",
], ],
unbundle: false, unbundle: false,
outDir: "dist", outDir: "dist",
deps: { deps: {
neverBundle: [...neverBundle], neverBundle: [
...neverBundle
],
}, },
target: "esnext", target: "esnext",
@@ -156,11 +159,11 @@ async function buildUi() {
loader: { loader: {
".svg": "dataurl", ".svg": "dataurl",
}, },
logLevel: "silent", logLevel: "silent",
} satisfies UserConfig; } satisfies UserConfig;
await Promise.all([ await Promise.all([
build({ build({
@@ -197,7 +200,7 @@ async function buildUiElements() {
minify, minify,
sourcemap, sourcemap,
watch: false, watch: false,
dts: false, dts: false,
define, define,
entry: ["src/ui/elements/index.ts"], entry: ["src/ui/elements/index.ts"],
outDir: "dist/ui/elements", outDir: "dist/ui/elements",
@@ -390,7 +393,7 @@ if (types) {
await buildAll(); await buildAll();
async function buildAll() { async function buildAll() {
await Promise.all(buildPipeline.map(fn => fn())); await Promise.all(buildPipeline.map(fn => fn()));
} }
@@ -430,5 +433,5 @@ if (watch) {
}); });
// keep process alive // keep process alive
await new Promise(() => {}); await new Promise(() => { });
} }