-
Notifications
You must be signed in to change notification settings - Fork 12k
List available migrations and let users choose on ng update
(including optional migrations)
#23205
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
Comments
I do agree that we should provide a better DX experience for optional migrations. |
This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list. You can find more details about the feature request process in our documentation. |
Currently an optional migration seems to be handled by simply setting a version in the migration that will not match with any realistic Angular Version. That will cause the migration isn't executed by default. "production-by-default": {
"version": "9999.0.0",
"factory": "./update-12/production-default-config",
"description": "Optional migration to update Angular CLI workspace configurations to 'production' mode by default."
} I think it would be better to add an explicit flag like |
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends. Find more details about Angular's feature request process in our documentation. |
When running `ng update` we now display optional migrations from packages. When the terminal is interactive, we prompt the users and ask them to choose which migrations they would like to run. ``` $ ng update @angular/core --from=14 --migrate-only --allow-dirty Using package manager: yarn Collecting installed dependencies... Found 22 dependencies. ** Executing migrations of package '@angular/core' ** ▸ Since Angular v15, the `RouterLink` contains the logic of the `RouterLinkWithHref` directive. This migration replaces all `RouterLinkWithHref` references with `RouterLink`. Migration completed (No changes made). ** Optional migrations of package '@angular/core' ** This package have 2 optional migrations that can be executed. Select the migrations that you'd like to run (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed) ❯◯ Update server builds to use generate ESM output. ◯ Lorem ipsum dolor sit amet, consectetur adipiscing elit. ``` In case the terminal is non interactive, we will print the commands that need to be executed to run the optional migrations. ``` $ ng update @angular/core --from=14 --migrate-only --allow-dirty Using package manager: yarn Collecting installed dependencies... Found 22 dependencies. ** Executing migrations of package '@angular/core' ** ▸ Since Angular v15, the `RouterLink` contains the logic of the `RouterLinkWithHref` directive. This migration replaces all `RouterLinkWithHref` references with `RouterLink`. Migration completed (No changes made). ** Optional migrations of package '@angular/core' ** This package have 2 optional migrations that can be executed. ▸ Update server builds to use generate ESM output. ng update @angular/core --migration-only --name esm-server-builds ▸ Lorem ipsum dolor sit amet, consectetur adipiscing elit. ng update @angular/core --migration-only --name migration-v15-router-link-with-href ``` **Note:** Optional migrations are defined by setting the `optional` property to `true`. Example: ```json { "schematics": { "esm-server-builds": { "version": "15.0.0", "description": "Update server builds to use generate ESM output", "factory": "./migrations/relative-link-resolution/bundle", "optional": true } } ``` Closes angular#23205
When running `ng update` we now display optional migrations from packages. When the terminal is interactive, we prompt the users and ask them to choose which migrations they would like to run. ``` $ ng update @angular/core --from=14 --migrate-only --allow-dirty Using package manager: yarn Collecting installed dependencies... Found 22 dependencies. ** Executing migrations of package '@angular/core' ** ▸ Since Angular v15, the `RouterLink` contains the logic of the `RouterLinkWithHref` directive. This migration replaces all `RouterLinkWithHref` references with `RouterLink`. Migration completed (No changes made). ** Optional migrations of package '@angular/core' ** This package have 2 optional migrations that can be executed. Select the migrations that you'd like to run (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed) ❯◯ Update server builds to use generate ESM output. ◯ Lorem ipsum dolor sit amet, consectetur adipiscing elit. ``` In case the terminal is non interactive, we will print the commands that need to be executed to run the optional migrations. ``` $ ng update @angular/core --from=14 --migrate-only --allow-dirty Using package manager: yarn Collecting installed dependencies... Found 22 dependencies. ** Executing migrations of package '@angular/core' ** ▸ Since Angular v15, the `RouterLink` contains the logic of the `RouterLinkWithHref` directive. This migration replaces all `RouterLinkWithHref` references with `RouterLink`. Migration completed (No changes made). ** Optional migrations of package '@angular/core' ** This package have 2 optional migrations that can be executed. ▸ Update server builds to use generate ESM output. ng update @angular/core --migration-only --name esm-server-builds ▸ Lorem ipsum dolor sit amet, consectetur adipiscing elit. ng update @angular/core --migration-only --name migration-v15-router-link-with-href ``` **Note:** Optional migrations are defined by setting the `optional` property to `true`. Example: ```json { "schematics": { "esm-server-builds": { "version": "15.0.0", "description": "Update server builds to use generate ESM output", "factory": "./migrations/relative-link-resolution/bundle", "optional": true } } ``` Closes angular#23205
When running `ng update` we now display optional migrations from packages. When the terminal is interactive, we prompt the users and ask them to choose which migrations they would like to run. ``` $ ng update @angular/core --from=14 --migrate-only --allow-dirty Using package manager: yarn Collecting installed dependencies... Found 22 dependencies. ** Executing migrations of package '@angular/core' ** ▸ Since Angular v15, the `RouterLink` contains the logic of the `RouterLinkWithHref` directive. This migration replaces all `RouterLinkWithHref` references with `RouterLink`. Migration completed (No changes made). ** Optional migrations of package '@angular/core' ** This package have 2 optional migrations that can be executed. Select the migrations that you'd like to run (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed) ❯◯ Update server builds to use generate ESM output. ◯ Lorem ipsum dolor sit amet, consectetur adipiscing elit. ``` In case the terminal is non interactive, we will print the commands that need to be executed to run the optional migrations. ``` $ ng update @angular/core --from=14 --migrate-only --allow-dirty Using package manager: yarn Collecting installed dependencies... Found 22 dependencies. ** Executing migrations of package '@angular/core' ** ▸ Since Angular v15, the `RouterLink` contains the logic of the `RouterLinkWithHref` directive. This migration replaces all `RouterLinkWithHref` references with `RouterLink`. Migration completed (No changes made). ** Optional migrations of package '@angular/core' ** This package have 2 optional migrations that can be executed. ▸ Update server builds to use generate ESM output. ng update @angular/core --migration-only --name esm-server-builds ▸ Lorem ipsum dolor sit amet, consectetur adipiscing elit. ng update @angular/core --migration-only --name migration-v15-router-link-with-href ``` **Note:** Optional migrations are defined by setting the `optional` property to `true`. Example: ```json { "schematics": { "esm-server-builds": { "version": "15.0.0", "description": "Update server builds to use generate ESM output", "factory": "./migrations/relative-link-resolution/bundle", "optional": true } } ``` Closes #23205
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. |
🚀 Feature request
Command (mark with an
x
)Description
Currently executing
ng update
will perform necessary migrations from one angular version to another which works smoothly.However there there are two issues I see:
ng update
One example for this which can be found at update.angular.io only when selecting 'medium' or 'advanced' option:
Identifying and executing such optional migrations can be tricky if there isn't a way to list/select them.
Describe the solution you'd like
Ideally during the execution,
ng update
should list the migrations with their default execution state and also include all available optional migrations with a non-preselected state like this:After a user made the selection, all selected migrations will be executed including the selected optional ones.
This will cause a better developer experience as it's more clear what will happen during the update process before actually running the migrations.
It should be considered, that tools like renovate or dependabot can't handle such interactive selections.
Therefore a flag could be helpful to deactivate the prompt and switch back to the current behavior (only executing the pre-selected non-optional migrations):
As users may have already executed migrations previously or want to know what migrations are available at another point of time, a separate migration command/option could be helpful:
Describe alternatives you've considered
An alternative would be to implement a "small" solution that would at least list possible optional migrations at the end of the
ng update
log to give users a hint about possibly further migration they can execute manuallyThe text was updated successfully, but these errors were encountered: