Skip to content

Commit

Permalink
fix(build): restore .d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
gjuchault committed Jul 23, 2023
1 parent 87404f3 commit fa7dd4b
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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);
}
}

Expand All @@ -45,4 +40,3 @@ if (import.meta.url.startsWith("file:")) {
await build();
}
}

0 comments on commit fa7dd4b

Please sign in to comment.