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

Function getAppOptions

packages/schematics/angular/application/index.ts:361–397  ·  view source on GitHub ↗
(
  host: Tree,
  options: ApplicationOptions,
)

Source from the content-addressed store, hash-verified

359}
360
361async function getAppOptions(
362 host: Tree,
363 options: ApplicationOptions,
364): Promise<{
365 appDir: string;
366 appRootSelector: string;
367 componentOptions: Partial<ComponentOptions>;
368 folderName: string;
369 sourceDir: string;
370}> {
371 const appRootSelector = `${options.prefix}-root`;
372 const componentOptions = getComponentOptions(options);
373
374 const workspace = await getWorkspace(host);
375 const newProjectRoot = (workspace.extensions.newProjectRoot as string | undefined) || '';
376
377 // If scoped project (i.e. "@foo/bar"), convert dir to "foo/bar".
378 let folderName = options.name.startsWith('@') ? options.name.slice(1) : options.name;
379 if (/[A-Z]/.test(folderName)) {
380 folderName = strings.dasherize(folderName);
381 }
382
383 const appDir =
384 options.projectRoot === undefined
385 ? join(normalize(newProjectRoot), folderName)
386 : normalize(options.projectRoot);
387
388 const sourceDir = `${appDir}/src/app`;
389
390 return {
391 appDir,
392 appRootSelector,
393 componentOptions,
394 folderName,
395 sourceDir,
396 };
397}
398
399function getComponentOptions(options: ApplicationOptions): Partial<ComponentOptions> {
400 const componentOptions: Partial<ComponentOptions> = !options.minimal

Callers 1

index.tsFile · 0.85

Calls 4

getWorkspaceFunction · 0.90
joinFunction · 0.90
normalizeFunction · 0.90
getComponentOptionsFunction · 0.85

Tested by

no test coverage detected