Skip to content

Commit

Permalink
fix: retrieve builder opts by builder context
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Jul 3, 2023
1 parent ee4427d commit be12359
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
11 changes: 8 additions & 3 deletions lib/compiler/helpers/get-tsc-config.path.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Input } from '../../../commands';
import { Configuration, TscBuilderOptions } from '../../configuration';
import { Builder, Configuration } from '../../configuration';
import { getDefaultTsconfigPath } from '../../utils/get-default-tsconfig-path';
import { getValueOrDefault } from './get-value-or-default';

Expand All @@ -26,11 +26,16 @@ export function getTscConfigPath(
return tsconfigPath;
}

tsconfigPath = getValueOrDefault<TscBuilderOptions['configPath']>(
const builder = getValueOrDefault<Builder>(
configuration,
'compilerOptions.builder.options.configPath',
'compilerOptions.builder',
appName,
);

tsconfigPath =
typeof builder === 'object' && builder?.type === 'tsc'
? builder.options?.configPath
: undefined;

return tsconfigPath ?? getDefaultTsconfigPath();
}
10 changes: 7 additions & 3 deletions lib/compiler/helpers/get-webpack-config-path.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Input } from '../../../commands';
import { Configuration, WebpackBuilderOptions } from '../../configuration';
import { Builder, Configuration } from '../../configuration';
import { getValueOrDefault } from './get-value-or-default';

/**
Expand All @@ -25,11 +25,15 @@ export function getWebpackConfigPath(
return webpackPath;
}

webpackPath = getValueOrDefault<WebpackBuilderOptions['configPath']>(
const builder = getValueOrDefault<Builder>(
configuration,
'compilerOptions.builder.options.configPath',
'compilerOptions.builder',
appName,
);

webpackPath =
typeof builder === 'object' && builder?.type === 'webpack'
? builder.options?.configPath
: undefined;
return webpackPath;
}

0 comments on commit be12359

Please sign in to comment.