-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathconfig.ts
60 lines (57 loc) · 1.75 KB
/
config.ts
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import zod from 'zod';
const BobConfigModel = zod.optional(
zod.union(
[
zod.literal(false),
zod.object({
commonjs: zod
.boolean({
description:
'Enable CommonJS output creating a dual output ESM+CJS. If set to `false`, will generate only ESM output.',
})
.optional()
.default(true),
build: zod.union(
[
zod.literal(false),
zod.optional(
zod.object({
copy: zod.optional(zod.array(zod.string()), {
description:
'Specify a list of files that should be copied the the output directory.',
}),
}),
),
],
{
description:
'Build configuration. Set to false for skipping the build of this package.',
},
),
check: zod.optional(
zod.union([
zod.literal(false),
zod.object({
skip: zod.optional(zod.array(zod.string()), {
description:
'Skip certain files from being checked. E.g. modules with side-effects.',
}),
}),
]),
{
description:
'Check whether the built packages comply with the standards. (ESM & CJS compatible and loadable and Node.js engines specified)',
},
),
}),
],
{
description:
'Bob configuration. Set this value to false in order to disable running bob on this package.',
},
),
);
export type BobConfig = zod.TypeOf<typeof BobConfigModel>;
export function getBobConfig(packageJson: Record<string, unknown>) {
return BobConfigModel.parse(packageJson.bob ?? {});
}