Skip to content

Commit 52d7577

Browse files
authored
Merge branch 'angular:main' into chip-edit
2 parents b1d6c05 + d681762 commit 52d7577

File tree

2 files changed

+38
-10
lines changed

2 files changed

+38
-10
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
<a name="20.0.1"></a>
2+
# 20.0.1 "sulfur-sandpaper" (2025-05-28)
3+
### material
4+
| Commit | Type | Description |
5+
| -- | -- | -- |
6+
| [ecd17ad75](https://github.com/angular/components/commit/ecd17ad758dd831f0be2d106ad4b4cd63f116069) | fix | **button:** add token for icon button shape ([#31223](https://github.com/angular/components/pull/31223)) |
7+
| [20fa71807](https://github.com/angular/components/commit/20fa71807bcbb8ef4dee75b86f0000aee31591f5) | fix | **schematics:** filter paths when renaming tokens ([#31249](https://github.com/angular/components/pull/31249)) |
8+
9+
<!-- CHANGELOG SPLIT MARKER -->
10+
111
<a name="20.0.0"></a>
212
# 20.0.0 "calcium-carrot" (2025-05-28)
313
## Breaking Changes

src/material/schematics/ng-update/index.ts

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,31 @@ export function updateToV20(): Rule {
3636
]);
3737
}
3838

39+
// Whether the given path should be included when renaming theme token names.
40+
function shouldRenameTokens(path: string) {
41+
if (path.includes('node_modules') || path.includes('.angular') || path.includes('.git')) {
42+
return false;
43+
}
44+
45+
return (
46+
path.endsWith('.html') ||
47+
path.endsWith('.css') ||
48+
path.endsWith('.scss') ||
49+
path.endsWith('.ts')
50+
);
51+
}
52+
3953
// Renames any CSS variables beginning with "--mdc-" to be "--mat-". These CSS variables
4054
// refer to tokens that used to be derived from a mix of MDC and Angular. Now all the tokens
4155
// are converged on being prefixed "--mat-".
4256
function renameMdcTokens(): Rule {
4357
return tree => {
4458
tree.visit(path => {
45-
const content = tree.readText(path);
46-
const updatedContent = content.replace('--mdc-', '--mat-');
47-
tree.overwrite(path, updatedContent);
59+
if (shouldRenameTokens(path)) {
60+
const content = tree.readText(path);
61+
const updatedContent = content.replace('--mdc-', '--mat-');
62+
tree.overwrite(path, updatedContent);
63+
}
4864
});
4965
};
5066
}
@@ -78,13 +94,15 @@ function renameComponentTokens(): Rule {
7894
];
7995
return tree => {
8096
tree.visit(path => {
81-
const content = tree.readText(path);
82-
let updatedContent = content;
83-
for (const tokenPrefix of tokenPrefixes) {
84-
updatedContent = updatedContent.replace(tokenPrefix.old, tokenPrefix.replacement);
85-
}
86-
if (content !== updatedContent) {
87-
tree.overwrite(path, updatedContent);
97+
if (shouldRenameTokens(path)) {
98+
const content = tree.readText(path);
99+
let updatedContent = content;
100+
for (const tokenPrefix of tokenPrefixes) {
101+
updatedContent = updatedContent.replace(tokenPrefix.old, tokenPrefix.replacement);
102+
}
103+
if (content !== updatedContent) {
104+
tree.overwrite(path, updatedContent);
105+
}
88106
}
89107
});
90108
};

0 commit comments

Comments
 (0)