Skip to content

Commit

Permalink
feat(mkdist): fail build if mkdist errors in creating declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Dec 28, 2024
1 parent 4536320 commit e52c014
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/builders/mkdist/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { relative } from "pathe";
import { mkdist, type MkdistOptions } from "mkdist";
import { symlink, rmdir } from "../../utils";
import { symlink, rmdir, warn } from "../../utils";
import type { MkdistBuildEntry, BuildContext } from "../../types";
import consola from "consola";

Expand Down Expand Up @@ -34,6 +34,14 @@ export async function mkdistBuild(ctx: BuildContext): Promise<void> {
chunks: output.writtenFiles.map((p) => relative(ctx.options.outDir, p)),
});
await ctx.hooks.callHook("mkdist:entry:build", ctx, entry, output);
if (output.errors) {
for (const error of output.errors) {
warn(
ctx,
`mkdist build failed for \`${relative(ctx.options.rootDir, error.filename)}\`:\n${error.errors.map((e) => ` - ${e}`).join("\n")}`,
);
}
}
}
}
await ctx.hooks.callHook("mkdist:done", ctx);
Expand Down

0 comments on commit e52c014

Please sign in to comment.