/
utils.ts
38 lines (33 loc) · 981 Bytes
/
utils.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
import deprecate from 'util-deprecate';
import dedent from 'ts-dedent';
export function parseList(str: string): string[] {
return str
.split(',')
.map((item) => item.trim())
.filter((item) => item.length > 0);
}
export function getEnvConfig(program: Record<string, any>, configEnv: Record<string, any>): void {
Object.keys(configEnv).forEach((fieldName) => {
const envVarName = configEnv[fieldName];
const envVarValue = process.env[envVarName];
if (envVarValue) {
program[fieldName] = envVarValue; // eslint-disable-line
}
});
}
const warnDLLsDeprecated = deprecate(
() => {},
dedent`
DLL-related CLI flags are deprecated, see:
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-dll-flags
`
);
export function checkDeprecatedFlags(options: {
dll?: boolean;
uiDll?: boolean;
docsDll?: boolean;
}) {
if (!options.dll || options.uiDll || options.docsDll) {
warnDLLsDeprecated();
}
}