-
Notifications
You must be signed in to change notification settings - Fork 225
Expand file tree
/
Copy pathcommonjs.ts
More file actions
45 lines (41 loc) · 777 Bytes
/
commonjs.ts
File metadata and controls
45 lines (41 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import path from 'path';
import kleur from 'kleur';
import del from 'del';
import compile from '../utils/compile';
import type { Input } from '../types';
type Options = Input & {
options?: {
esm?: boolean;
babelrc?: boolean | null;
configFile?: string | false | null;
sourceMaps?: boolean;
copyFlow?: boolean;
};
clean: boolean;
exclude: string;
};
export default async function build({
clean,
root,
source,
output,
exclude,
options,
report,
}: Options) {
if (clean) {
report.info(
`Cleaning up previous build at ${kleur.blue(path.relative(root, output))}`
);
await del([output]);
}
await compile({
...options,
root,
source,
output,
exclude,
modules: 'commonjs',
report,
});
}