MCPcopy Index your code
hub / github.com/angular/angular-cli / getSchematicDefaults

Function getSchematicDefaults

packages/angular/cli/src/utilities/config.ts:350–386  ·  view source on GitHub ↗
(
  collection: string,
  schematic: string,
  project?: string | null,
)

Source from the content-addressed store, hash-verified

348}
349
350export async function getSchematicDefaults(
351 collection: string,
352 schematic: string,
353 project?: string | null,
354): Promise<{}> {
355 const result = {};
356 const mergeOptions = (source: json.JsonValue | undefined): void => {
357 if (isJsonObject(source)) {
358 // Merge options from the qualified name
359 Object.assign(result, source[`${collection}:${schematic}`]);
360
361 // Merge options from nested collection schematics
362 const collectionOptions = source[collection];
363 if (isJsonObject(collectionOptions)) {
364 Object.assign(result, collectionOptions[schematic]);
365 }
366 }
367 };
368
369 // Global level schematic options
370 const globalOptions = await getWorkspace('global');
371 mergeOptions(globalOptions?.extensions['schematics']);
372
373 const workspace = await getWorkspace('local');
374 if (workspace) {
375 // Workspace level schematic options
376 mergeOptions(workspace.extensions['schematics']);
377
378 project = project || getProjectByCwd(workspace);
379 if (project) {
380 // Project level schematic options
381 mergeOptions(workspace.projects.get(project)?.extensions['schematics']);
382 }
383 }
384
385 return result;
386}
387
388export async function isWarningEnabled(warning: string): Promise<boolean> {
389 const getWarning = (source: json.JsonValue | undefined): boolean | undefined => {

Callers 1

Calls 4

getProjectByCwdFunction · 0.85
getWorkspaceFunction · 0.70
mergeOptionsFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected