Skip to content

Commit

Permalink
Multiple entry points
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Mar 30, 2024
1 parent 31d077e commit f6b9e1a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions dnt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ await emptyDir("./npm");

const denoJson = join(import.meta.dirname!, "deno.json");
const metadata = JSON.parse(await Deno.readTextFile(denoJson));
const exports = [];
const testExports = [];
for (const exportName in metadata.exports) {
const match = exportName.match(/^\.\/([^/]+)/);
if (match) exports.push(match[1]);
if (match && match[1] != "x") testExports.push(match[1]);
}

await build({
Expand All @@ -28,7 +28,8 @@ await build({
},
},
outDir: "./npm",
entryPoints: ["./mod.ts"],
entryPoints: Object.entries(metadata.exports as Record<string, string>)
.map(([name, path]) => ({ name, path })),
importMap: denoJson,
scriptModule: false,
shims: {
Expand Down Expand Up @@ -69,7 +70,7 @@ await build({
// etc... more checks here
return true;
},
testPattern: `{${exports.join(",")}}/**/*.test.ts`,
testPattern: `{${testExports.join(",")}}/**/*.test.ts`,
async postBuild() {
await copy(
"testing/fixtures",
Expand Down

0 comments on commit f6b9e1a

Please sign in to comment.