diff --git a/packages/schematics/angular/migrations/update-12/update-angular-config.ts b/packages/schematics/angular/migrations/update-12/update-angular-config.ts index ec32330418f3..d9e91ea64ea2 100644 --- a/packages/schematics/angular/migrations/update-12/update-angular-config.ts +++ b/packages/schematics/angular/migrations/update-12/update-angular-config.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import { JsonValue, workspaces } from '@angular-devkit/core'; +import { JsonValue, tags, workspaces } from '@angular-devkit/core'; import { Rule } from '@angular-devkit/schematics'; import { allTargetOptions, allWorkspaceTargets, updateWorkspace } from '../../utility/workspace'; @@ -30,29 +30,39 @@ const ServerBuilderOptions: BuilderOptionsType = [ ]; export default function (): Rule { - return updateWorkspace((workspace) => { - for (const [, target] of allWorkspaceTargets(workspace)) { - if (!target?.builder.startsWith('@angular-devkit/build-angular')) { - continue; - } + return (_tree, context) => + updateWorkspace((workspace) => { + for (const [targetName, target, projectName] of allWorkspaceTargets(workspace)) { + if ( + !target.builder.startsWith('@angular-devkit/') && + !target.builder.startsWith('@nguniversal/') + ) { + context.logger.warn(tags.stripIndent` + "${targetName}" target in "${projectName}" project is using a third-party builder. + You may need to adjust the options to retain the existing behavior. + For more information, see the breaking changes section within the release notes: https://github.com/angular/angular-cli/releases/tag/v12.0.0 + `); - // Only interested in Angular Devkit browser and server builders - switch (target.builder) { - case '@angular-devkit/build-angular:server': - updateOptions(target, ServerBuilderOptions); - break; - case '@angular-devkit/build-angular:browser': - updateOptions(target, BrowserBuilderOptions); - break; - } + continue; + } - for (const [, options] of allTargetOptions(target)) { - delete options.experimentalRollupPass; - delete options.lazyModules; - delete options.forkTypeChecker; + // Only interested in Angular Devkit browser and server builders + switch (target.builder) { + case '@angular-devkit/build-angular:server': + updateOptions(target, ServerBuilderOptions); + break; + case '@angular-devkit/build-angular:browser': + updateOptions(target, BrowserBuilderOptions); + break; + } + + for (const [, options] of allTargetOptions(target)) { + delete options.experimentalRollupPass; + delete options.lazyModules; + delete options.forkTypeChecker; + } } - } - }); + }); } function updateOptions(