forked from stenciljs/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.ts
More file actions
21 lines (18 loc) · 764 Bytes
/
config.ts
File metadata and controls
21 lines (18 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { createNodeLogger } from '@sys-api-node';
import { createConfigFlags } from '../../cli/config-flags';
import type * as d from '../../declarations';
import { validateConfig } from '../config/validate-config';
/**
* Given a user-supplied config, get a validated config which can be used to
* start building a Stencil project.
*
* @param userConfig a configuration object
* @returns a validated config object with stricter typing
*/
export const getConfig = (userConfig: d.Config): d.ValidatedConfig => {
userConfig.logger = userConfig.logger ?? createNodeLogger();
const flags = createConfigFlags(userConfig.flags ?? {});
userConfig.flags = flags;
const config: d.ValidatedConfig = validateConfig(userConfig, {}).config;
return config;
};