MCPcopy Create free account
hub / github.com/SoCreate/angular-playground / applyConfigurationFile

Function applyConfigurationFile

projects/cli/src/configure.ts:101–162  ·  view source on GitHub ↗
(options: {[key: string]: any})

Source from the content-addressed store, hash-verified

99}
100
101export function applyConfigurationFile(options: {[key: string]: any}): Config {
102 const playgroundConfig = loadConfig(options.config);
103 // TODO: remove this deprecation warning at next major version
104 if (playgroundConfig.sourceRoot) {
105 console.warn('Using `sourceRoot` is deprecated. Please use `sourceRoots` instead.');
106 console.warn('See https://angularplayground.it/docs/api/configuration for more info.');
107 playgroundConfig.sourceRoots = [playgroundConfig.sourceRoot];
108 }
109
110 const config: Config = {
111 sourceRoots: playgroundConfig.sourceRoots || options.src,
112 chunk: negate(playgroundConfig.noChunk) || options.chunk,
113 watch: negate(playgroundConfig.noWatch) || options.watch,
114 serve: negate(playgroundConfig.noServe) || options.serve,
115 build: playgroundConfig.build || options.build,
116 buildWithServiceWorker: playgroundConfig.buildWithServiceWorker || options.buildWithServiceWorker,
117 baseHref: playgroundConfig.baseHref || options.baseHref,
118
119 verifySandboxes: playgroundConfig.verifySandboxes || options.checkErrors,
120 randomScenario: playgroundConfig.randomScenario || options.randomScenario,
121 timeout: playgroundConfig.timeout || options.timeout,
122 reportPath: playgroundConfig.reportPath || options.reportPath,
123 reportType: playgroundConfig.reportType || options.reportType,
124
125 checkVisualRegressions: playgroundConfig.checkVisualRegressions || options.checkVisualRegressions,
126 snapshotDirectory: playgroundConfig.snapshotDirectory || options.snapshotDirectory,
127 diffDirectory: playgroundConfig.diffDirectory || options.diffDirectory,
128 viewportSizes: playgroundConfig.viewportSizes || [],
129 updateSnapshots: playgroundConfig.updateSnapshots || options.updateSnapshots,
130 deleteSnapshots: playgroundConfig.deleteSnapshots || options.deleteSnapshots,
131 imageSnapshotConfig: playgroundConfig.imageSnapshotConfig || {},
132 visualRegressionIgnore: playgroundConfig.visualRegressionIgnore || [],
133 visualRegressionMockDate: playgroundConfig.visualRegressionMockDate || options.visualRegressionMockDate,
134 visualRegressionSleepDuration: playgroundConfig.visualRegressionSleepDuration || options.visualRegressionSleepDuration,
135
136 pathToSandboxes: playgroundConfig.pathToSandboxes || options.pathToSandboxes,
137
138 definedSandboxesPath: playgroundConfig.definedSandboxesPath || options.definedSandboxesPath,
139 };
140
141 if (config.verifySandboxes && config.reportType && !config.reportPath) {
142 switch (config.reportType) {
143 case REPORT_TYPE.JSON:
144 config.reportPath = './sandbox.report.json';
145 break;
146 case REPORT_TYPE.XML:
147 config.reportPath = './sandbox.report.xml';
148 break;
149 }
150 }
151
152 if (playgroundConfig.angularCli) {
153 config.angularAppName = playgroundConfig.angularCli.appName || options.ngCliApp;
154 config.angularCliPath = playgroundConfig.angularCli.cmdPath || options.ngCliCmd;
155 config.angularCliHost = playgroundConfig.angularCli.host || options.ngCliHost;
156 config.angularCliPort = playgroundConfig.angularCli.port || options.ngCliPort;
157 config.angularCliAdditionalArgs = playgroundConfig.angularCli.args || options.ngCliArgs;
158 config.angularCliMaxBuffer = playgroundConfig.angularCli.maxBuffer || options.ngCliMaxBuffer;

Callers 3

tFunction · 0.90
configure.spec.tsFile · 0.90
configureFunction · 0.85

Calls 2

loadConfigFunction · 0.85
negateFunction · 0.85

Tested by 1

tFunction · 0.72