diff --git a/lib/cli/src/generators/ANGULAR/angular-helpers.ts b/lib/cli/src/generators/ANGULAR/angular-helpers.ts index cf38ccf2c642..bd9eecfa2bab 100644 --- a/lib/cli/src/generators/ANGULAR/angular-helpers.ts +++ b/lib/cli/src/generators/ANGULAR/angular-helpers.ts @@ -1,5 +1,7 @@ import * as path from 'path'; import * as fs from 'fs'; +import { pathExists } from 'fs-extra'; + import { readFileAsJson, writeFileAsJson } from '../../helpers'; type TsConfig = { @@ -52,3 +54,7 @@ export function isDefaultProjectSet() { const angularJson = readFileAsJson('angular.json', true); return angularJson && !!angularJson.defaultProject; } + +export async function getBaseTsConfigName() { + return (await pathExists('./tsconfig.base.json')) ? 'tsconfig.base.json' : 'tsconfig.json'; +} diff --git a/lib/cli/src/generators/ANGULAR/index.ts b/lib/cli/src/generators/ANGULAR/index.ts index 9d0e5344df2d..57a4758a41ad 100644 --- a/lib/cli/src/generators/ANGULAR/index.ts +++ b/lib/cli/src/generators/ANGULAR/index.ts @@ -4,6 +4,7 @@ import { editStorybookTsConfig, getAngularAppTsConfigJson, getAngularAppTsConfigPath, + getBaseTsConfigName, } from './angular-helpers'; import { writeFileAsJson, copyTemplate } from '../../helpers'; import { baseGenerator, Generator } from '../baseGenerator'; @@ -40,8 +41,9 @@ const generator: Generator = async (packageManager, npmOptions, options) => { editStorybookTsConfig(path.resolve('./.storybook/tsconfig.json')); // edit scripts to generate docs + const tsConfigFile = await getBaseTsConfigName(); packageManager.addScripts({ - 'docs:json': 'compodoc -p ./tsconfig.base.json -e json -d .', + 'docs:json': `compodoc -p ./${tsConfigFile} -e json -d .`, }); packageManager.addStorybookCommandInScripts({ port: 6006,