-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Switch theming API migration to ng update and other fixes #22628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
7a17485
to
ec7ebff
Compare
This comment has been minimized.
This comment has been minimized.
@googlebot I consent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 One minor comment.
const count = ThemingApiMigration.migratedFileCount; | ||
|
||
if (count > 0) { | ||
context.logger.info(`Migrated ${count === 1 ? `${count} files` : `1 file`} to the ` + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the ternary needs to be inversed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, out of curiosity, is there a doc/guide we could link too? that might be nice to see when the migration ran.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that we have a doc about the migration in particular. It'll be mentioned in the changelog.
ec7ebff
to
70343d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Switches the `themingApi` migration from `ng generate` to `ng update`. Includes refactoring it into a `DevkitMigration` and changing the test setup to match.
Stylesheets which aren't referneced as part of any component are also candidates for migration. We search for such stylesheets by recursing through the virtual devkit tree. This logic is currently not working for cases where project targets have a `root` set within the Angular CLI workspace configuration. It breaks because we do not build up a workspace-relative path, but instead only collect the file names. Signed-off-by: Kristiyan Kostadinov <[email protected]>
…e is an import Changes the migration logic so that variables without a `mat-` or `cdk-` prefix are only migrated if there is an explicit Material import. This aims to prevent accidental renames for variables that we don't own. Also adds a few variables that were previously skipped.
…tion Based on external feedback, adds a message with the number of migrated files at the end of the theming API migration.
…se statement at the top of the file in some cases Our logic for determining where to insert an `@use` statement is to look for the first `@import` and insert before it. The problem is that if the theming import is the only one in the file and it's further down, we'll insert it incorrectly, because `@use` has to always be above other statements.
70343d7
to
d5f2935
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Split up into several commits that include the following changes:
themingApi
migration fromng generate
tong update
as discussed. This required some adjustments to the code that is called by the CLI, as well as some changes to the unit test setup.@use
statement for the new API would be inserted too far down in the file, if the file only has one@import
statement which is placed further down too. This results in a compilation error, because@use
statements have to be at the top.