( host: Tree, options: ApplicationOptions, )
| 359 | } |
| 360 | |
| 361 | async 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 | |
| 399 | function getComponentOptions(options: ApplicationOptions): Partial<ComponentOptions> { |
| 400 | const componentOptions: Partial<ComponentOptions> = !options.minimal |
no test coverage detected