diff --git a/scripts/build.ts b/scripts/build.ts index ae3f026c..0755779c 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -1,15 +1,12 @@ import path from "node:path"; import url from "node:url"; -import fs from "node:fs/promises"; import { globbyStream } from "globby"; -import { build as esbuild } from "esbuild" +import { build as esbuild } from "esbuild"; const srcPath = path.join(process.cwd(), "src"); const buildPath = path.join(process.cwd(), "build"); -async function buildFile( - filePath: string, -) { +async function buildFile(filePath: string) { return esbuild({ platform: "node", target: "node18", @@ -23,20 +20,18 @@ async function buildFile( } async function build() { - await fs.rm(buildPath, { recursive: true }); - - const filesStream = globbyStream('**/*.ts', { + const filesStream = globbyStream("**/*.ts", { cwd: srcPath, onlyFiles: true, - ignore: ["__tests__"] + ignore: ["__tests__"], }); for await (const filePath of filesStream) { if (typeof filePath !== "string") { throw new TypeError("Unexpected file type"); } - - await buildFile(filePath) + + await buildFile(filePath); } } @@ -45,4 +40,3 @@ if (import.meta.url.startsWith("file:")) { await build(); } } -