1 | import { Blueprint, Predicates } from '@boost/common';
|
2 | import { Configuration, createPluginsPredicate, mergePlugins } from '@boost/config';
|
3 |
|
4 | import { ConfigExecuteStrategy, ConfigFile } from './types';
|
5 |
|
6 | export class Config extends Configuration<ConfigFile> {
|
7 | blueprint(predicates: Predicates, onConstruction: boolean): Blueprint<ConfigFile> {
|
8 | const { bool, number, object, shape, string } = predicates;
|
9 | const moduleSchema = string(process.env.BEEMO_CONFIG_MODULE);
|
10 |
|
11 | return {
|
12 | configure: shape({
|
13 | cleanup: bool(false),
|
14 | parallel: bool(true),
|
15 | }),
|
16 | debug: bool(),
|
17 | drivers: createPluginsPredicate(predicates),
|
18 | execute: shape({
|
19 | concurrency: number(3).gt(0),
|
20 | graph: bool(true),
|
21 |
|
22 | output: string<ConfigExecuteStrategy>() |
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | ,
|
29 | }),
|
30 | module: onConstruction ? moduleSchema : moduleSchema.required(),
|
31 | scripts: createPluginsPredicate(predicates),
|
32 | settings: object(),
|
33 | };
|
34 | }
|
35 |
|
36 | override bootstrap() {
|
37 | this.addProcessHandler('drivers', mergePlugins);
|
38 | this.addProcessHandler('scripts', mergePlugins);
|
39 | }
|
40 | }
|