UNPKG

1.37 kBPlain TextView Raw
1import { Blueprint, Predicates } from '@boost/common';
2import { Configuration, createPluginsPredicate, mergePlugins } from '@boost/config';
3// import { STRATEGY_BUFFER, STRATEGY_NONE, STRATEGY_PIPE, STRATEGY_STREAM } from './constants';
4import { ConfigExecuteStrategy, ConfigFile } from './types';
5
6export 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 // Optimal requires a fix upstream. Does not support empty strings!
22 output: string<ConfigExecuteStrategy>() /* .oneOf<ConfigExecuteStrategy>([
23 '',
24 STRATEGY_BUFFER,
25 STRATEGY_PIPE,
26 STRATEGY_STREAM,
27 STRATEGY_NONE,
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}