MCPcopy
hub / github.com/angular/angular-cli / main

Function main

packages/angular_devkit/architect/bin/architect.ts:215–267  ·  view source on GitHub ↗
(args: string[])

Source from the content-addressed store, hash-verified

213}
214
215async function main(args: string[]): Promise<number> {
216 /** Parse the command line. */
217 const { positionals, cliOptions, builderOptions } = parseOptions(args);
218
219 /** Create the DevKit Logger used through the CLI. */
220 const logger = createConsoleLogger(!!cliOptions['verbose'], process.stdout, process.stderr, {
221 info: (s) => s,
222 debug: (s) => s,
223 warn: (s) => styleText(['yellow', 'bold'], s),
224 error: (s) => styleText(['red', 'bold'], s),
225 fatal: (s) => styleText(['red', 'bold'], s),
226 });
227
228 // Check the target.
229 const targetStr = positionals[0];
230 if (!targetStr || cliOptions.help) {
231 // Show architect usage if there's no target.
232 usage(logger);
233 }
234
235 // Load workspace configuration file.
236 const currentPath = process.cwd();
237 const configFileNames = ['angular.json', '.angular.json', 'workspace.json', '.workspace.json'];
238
239 const configFilePath = findUp(configFileNames, currentPath);
240
241 if (!configFilePath) {
242 logger.fatal(
243 `Workspace configuration file (${configFileNames.join(', ')}) cannot be found in ` +
244 `'${currentPath}' or in parent directories.`,
245 );
246
247 return 3;
248 }
249
250 const root = path.dirname(configFilePath);
251
252 const registry = new schema.CoreSchemaRegistry();
253 registry.addPostTransform(schema.transforms.addUndefinedDefaults);
254
255 // Show usage of deprecated options
256 registry.useXDeprecatedProvider((msg) => logger.warn(msg));
257
258 const { workspace } = await workspaces.readWorkspace(
259 configFilePath,
260 workspaces.createWorkspaceHost(new NodeJsSyncHost()),
261 );
262
263 // Clear the console.
264 process.stdout.write('\u001Bc');
265
266 return await _executeTarget(logger, workspace, root, targetStr, builderOptions, registry);
267}
268
269main(process.argv.slice(2)).then(
270 (code) => {

Callers 1

architect.tsFile · 0.70

Calls 10

addPostTransformMethod · 0.95
createConsoleLoggerFunction · 0.90
usageFunction · 0.85
_executeTargetFunction · 0.85
parseOptionsFunction · 0.70
findUpFunction · 0.70
fatalMethod · 0.65
warnMethod · 0.65
writeMethod · 0.65

Tested by

no test coverage detected