Skip to content

Commit 9ea74a1

Browse files
alan-agius4clydin
authored andcommittedNov 8, 2021
fix(@schematics/angular): show warning when migrating ng-packagr JS configurations
Our migrations only handle JSON configs. Closes #22107 (cherry picked from commit 950b430)
1 parent 966a133 commit 9ea74a1

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed
 

‎packages/schematics/angular/migrations/update-13/update-libraries.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import { join } from '@angular-devkit/core';
9+
import { join, tags } from '@angular-devkit/core';
1010
import { DirEntry, Rule } from '@angular-devkit/schematics';
1111
import { JSONFile } from '../../utility/json-file';
1212
import { allTargetOptions, getWorkspace } from '../../utility/workspace';
@@ -36,7 +36,7 @@ export default function (): Rule {
3636
['lib', 'umdId'],
3737
];
3838

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.