|
1 | | -import { joinPathFragments, stripIndents } from '@nrwl/devkit'; |
| 1 | +import { joinPathFragments } from '@nrwl/devkit'; |
2 | 2 | import { existsSync } from 'fs'; |
3 | | -import { from, Observable } from 'rxjs'; |
4 | | -import { mergeCustomWebpackConfig } from '../utilities/webpack'; |
5 | | -import { Schema } from './schema'; |
6 | | -import { createTmpTsConfigForBuildableLibs } from '../utilities/buildable-libs'; |
| 3 | +import { Observable, from } from 'rxjs'; |
7 | 4 | import { switchMap } from 'rxjs/operators'; |
| 5 | +import { lt } from 'semver'; |
8 | 6 | import { getInstalledAngularVersionInfo } from '../../executors/utilities/angular-version-utils'; |
9 | | -import { gte, lt } from 'semver'; |
| 7 | +import { createTmpTsConfigForBuildableLibs } from '../utilities/buildable-libs'; |
| 8 | +import { mergeCustomWebpackConfig } from '../utilities/webpack'; |
| 9 | +import { Schema } from './schema'; |
| 10 | +import { validateOptions } from './validate-options'; |
10 | 11 |
|
11 | 12 | function buildServerApp( |
12 | 13 | options: Schema, |
@@ -92,25 +93,9 @@ export function executeWebpackServerBuilder( |
92 | 93 | options: Schema, |
93 | 94 | context: import('@angular-devkit/architect').BuilderContext |
94 | 95 | ): Observable<import('@angular-devkit/build-angular').ServerBuilderOutput> { |
95 | | - const installedAngularVersionInfo = getInstalledAngularVersionInfo(); |
96 | | - |
97 | | - if ( |
98 | | - lt(installedAngularVersionInfo.version, '15.1.0') && |
99 | | - Array.isArray(options.assets) && |
100 | | - options.assets.length > 0 |
101 | | - ) { |
102 | | - throw new Error(stripIndents`The "assets" option is only supported in Angular >= 15.1.0. You are currently using ${installedAngularVersionInfo.version}. |
103 | | - You can resolve this error by removing the "assets" option or by migrating to Angular 15.1.0.`); |
104 | | - } |
105 | | - |
106 | | - if ( |
107 | | - gte(installedAngularVersionInfo.version, '15.0.0') && |
108 | | - options.bundleDependencies |
109 | | - ) { |
110 | | - throw new Error(stripIndents`The "bundleDependencies" option was removed in Angular version 15. You are currently using ${installedAngularVersionInfo.version}. |
111 | | - You can resolve this error by removing the "bundleDependencies" option.`); |
112 | | - } |
| 96 | + validateOptions(options); |
113 | 97 |
|
| 98 | + const installedAngularVersionInfo = getInstalledAngularVersionInfo(); |
114 | 99 | // default bundleDependencies to true if supported by Angular version |
115 | 100 | if ( |
116 | 101 | lt(installedAngularVersionInfo.version, '15.0.0') && |
|
0 commit comments