Skip to content

Commit

Permalink
fix(@schematics/angular): show warning when migrating ng-packagr JS c…
Browse files Browse the repository at this point in the history
…onfigurations

Our migrations only handle JSON configs.

Closes #22107

(cherry picked from commit 950b430)
  • Loading branch information
alan-agius4 authored and clydin committed Nov 8, 2021
1 parent 966a133 commit 9ea74a1
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import { join } from '@angular-devkit/core';
import { join, tags } from '@angular-devkit/core';
import { DirEntry, Rule } from '@angular-devkit/schematics';
import { JSONFile } from '../../utility/json-file';
import { allTargetOptions, getWorkspace } from '../../utility/workspace';
Expand Down Expand Up @@ -36,7 +36,7 @@ export default function (): Rule {
['lib', 'umdId'],
];

return async (tree) => {
return async (tree, context) => {
const workspace = await getWorkspace(tree);
const librariesTsConfig = new Set<string>();
const ngPackagrConfig = new Set<string>();
Expand All @@ -53,7 +53,14 @@ export default function (): Rule {
}

if (typeof options.project === 'string') {
ngPackagrConfig.add(options.project);
if (options.project.endsWith('.json')) {
ngPackagrConfig.add(options.project);
} else {
context.logger
.warn(tags.stripIndent`Expected a JSON configuration file but found "${options.project}".
You may need to adjust the configuration file to remove invalid options.
For more information, see the breaking changes section within the release notes: https://github.com/ng-packagr/ng-packagr/releases/tag/v13.0.0/.`);
}
}
}
}
Expand Down

0 comments on commit 9ea74a1

Please sign in to comment.