forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(cdk/schematics): switch to latest API version
The latest `next` version of the CLI removed some deprecated APIs that we were depending. These changes update all the code so that it used the correct API (according to the CLI team). High-level overview of the changes and why they were necessary: 1. Previously we parsed the `angular.json` ourselves using `JSON.parse` in order to support very old versions of the CLI, however this is no longer feasible, because the CLI has set up classes around the parsed data which are non-trivial to construct. According to the CLI, we don't have to worry about older version anymore, because the schematics infrastructure will ensure that we're running against the correct version. 2. The interface of the new API is different from the one we were using before so I had to rewrite some code. 3. Some of these new APIs are asynchronous so I've had to move some code around to accommodate it. 4. Previously we would `JSON.parse` and `JSON.stringify` the `angular.json` file whenever we needed to mutate it (e.g. when adding a theme), but this isn't possible anymore due to the aforementioned classes around the config file. I've reworked our schematics to use a utility from the CLI to write to the file. 5. A lot of our tests depended on parsing the `angular.json`, changing a property and writing it back as JSON. This isn't possible, because the abstraction around the config can't be stringified so I've worked around it by writing out the `angular.json` file from scratch in the test. While this is more code, it should be easier to maintain in the long term.
- Loading branch information
1 parent
727285b
commit 5bac828
Showing
24 changed files
with
311 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.