-
Notifications
You must be signed in to change notification settings - Fork 25.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(migrations): add migration to convert templates to use self-clos…
…ing tags (#57342) This schematic helps developers to convert their templates to use self-closing tags mostly as a aesthetic change. PR Close #57342
- Loading branch information
1 parent
b6fa69f
commit 1cd3a7d
Showing
19 changed files
with
984 additions
and
22 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
26 changes: 26 additions & 0 deletions
26
adev/src/content/reference/migrations/self-closing-tags.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Migration to self-closing tags | ||
|
||
Self-closing tags are supported in Angular templates since [v16](https://blog.angular.dev/angular-v16-is-here-4d7a28ec680d#7065). . | ||
|
||
This schematic migrates the templates in your application to use self-closing tags. | ||
|
||
Run the schematic using the following command: | ||
|
||
<docs-code language="shell"> | ||
|
||
ng generate @angular/core:self-closing-tag | ||
|
||
</docs-code> | ||
|
||
|
||
#### Before | ||
|
||
<docs-code language="angular-html"> | ||
|
||
<!-- Before --> | ||
<hello-world></hello-world> | ||
|
||
<!-- After --> | ||
<hello-world /> | ||
|
||
</docs-code> |
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
48 changes: 48 additions & 0 deletions
48
packages/core/schematics/migrations/self-closing-tags-migration/BUILD.bazel
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library") | ||
|
||
ts_library( | ||
name = "migration", | ||
srcs = glob( | ||
["**/*.ts"], | ||
exclude = ["*.spec.ts"], | ||
), | ||
visibility = [ | ||
"//packages/core/schematics/ng-generate/self-closing-tags-migration:__pkg__", | ||
"//packages/language-service/src/refactorings:__pkg__", | ||
], | ||
deps = [ | ||
"//packages/compiler", | ||
"//packages/compiler-cli", | ||
"//packages/compiler-cli/private", | ||
"//packages/compiler-cli/src/ngtsc/annotations", | ||
"//packages/compiler-cli/src/ngtsc/annotations/directive", | ||
"//packages/compiler-cli/src/ngtsc/file_system", | ||
"//packages/compiler-cli/src/ngtsc/imports", | ||
"//packages/compiler-cli/src/ngtsc/metadata", | ||
"//packages/compiler-cli/src/ngtsc/reflection", | ||
"//packages/core/schematics/utils", | ||
"//packages/core/schematics/utils/tsurge", | ||
"@npm//@types/node", | ||
"@npm//typescript", | ||
], | ||
) | ||
|
||
ts_library( | ||
name = "test_lib", | ||
testonly = True, | ||
srcs = glob( | ||
["**/*.spec.ts"], | ||
), | ||
deps = [ | ||
":migration", | ||
"//packages/compiler-cli", | ||
"//packages/compiler-cli/src/ngtsc/file_system/testing", | ||
"//packages/core/schematics/utils/tsurge", | ||
], | ||
) | ||
|
||
jasmine_node_test( | ||
name = "test", | ||
srcs = [":test_lib"], | ||
env = {"FORCE_COLOR": "3"}, | ||
) |
Oops, something went wrong.