Skip to content

Commit

Permalink
fix(angular): change the resolution order of the tsconfig.json config
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaudAV committed Nov 24, 2021
1 parent d6ba659 commit b9d10ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion app/angular/src/builders/start-storybook/index.ts
Expand Up @@ -14,6 +14,7 @@ import {
import { from, Observable, of } from 'rxjs';
import { CLIOptions } from '@storybook/core-common';
import { map, switchMap, mapTo } from 'rxjs/operators';
import { sync as findUpSync } from 'find-up';

// eslint-disable-next-line import/no-extraneous-dependencies
import buildStandalone, { StandaloneOptions } from '@storybook/angular/standalone';
Expand Down Expand Up @@ -122,7 +123,10 @@ async function setup(options: StorybookBuilderOptions, context: BuilderContext)
}

return {
tsConfig: options.tsConfig ?? browserOptions.tsConfig ?? undefined,
tsConfig:
options.tsConfig ??
findUpSync('tsconfig.json', { cwd: options.configDir }) ??
browserOptions.tsConfig,
};
}
function runInstance(options: StandaloneOptions) {
Expand Down
4 changes: 2 additions & 2 deletions app/angular/src/server/framework-preset-angular-cli.ts
Expand Up @@ -118,8 +118,8 @@ async function getBuilderOptions(
...(options.angularBuilderOptions as JsonObject),
tsConfig:
options.tsConfig ??
browserTargetOptions.tsConfig ??
findUpSync('tsconfig.json', { cwd: options.configDir }),
findUpSync('tsconfig.json', { cwd: options.configDir }) ??
browserTargetOptions.tsConfig,
};
logger.info(`=> Using angular project with "tsConfig:${builderOptions.tsConfig}"`);

Expand Down

0 comments on commit b9d10ac

Please sign in to comment.