Skip to content

List available migrations and let users choose on ng update (including optional migrations) #23205

Closed

Description

@d-koppenhagen

🚀 Feature request

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

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:

  1. Users can't select / see the available migrations with their details before executing ng update
  2. Optional migrations that may be available won't be executed and listed. In fact users that doesn't know about such probably very helpful but optional migrations aren't able to find and execute them.

One example for this which can be found at update.angular.io only when selecting 'medium' or 'advanced' option:

ng update @angular/cli@12 --migrate-only production-by-default

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:

> ng update
Which migrations do you want to execute:
[x] migration1Name: migration1Description
[x] migration2Name: migration1Description
[ ] optionalMigration1Name: optionalMigration1Description

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):

ng update --interactive=false

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:

> ng update --list-migrations
- migration1Name: migration1Description
- migration2Name: migration1Description
- optionalMigration1Name: optionalMigration1Description

To execute a migration run: ng update --migrate-only <migration-name>

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 manually

> ng update

...

Further optional migrations are available:

- migration1Name: migration1Description
- migration2Name: migration1Description
- optionalMigration1Name: optionalMigration1Description

To execute a migration run: ng update --migrate-only <migration-name>

Activity

  1. added
    feature
    on May 24, 2022
  2. modified the milestone: needsTriage on May 24, 2022
  3. alan-agius4 commented on May 24, 2022

    @alan-agius4
    Collaborator

    I do agree that we should provide a better DX experience for optional migrations.

  4. angular-robot commented on May 24, 2022

    @angular-robot
    Contributor

    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.

  5. added
    feature: votes required
    on May 24, 2022
  6. d-koppenhagen commented on May 24, 2022

    @d-koppenhagen
    Author

    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.

    See: https://github.com/angular/angular-cli/blob/12.2.x/packages/schematics/angular/migrations/migration-collection.json#L128-L133

     "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 optional with the type of boolean. This would allow to define migrations for related versions but make them optionally executable.

  7. angular-robot commented on Jul 3, 2022

    @angular-robot
    Contributor

    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.

  8. added
    feature: under consideration
    and removed
    feature: votes required
    on Jul 12, 2022
  9. added 2 commits that reference this issue on Mar 8, 2023
    0e1bfce
    46d5385
  10. added a commit that references this issue on Mar 8, 2023
    7cb5689
  11. angular-automatic-lock-bot commented on Apr 8, 2023

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  12. locked and limited conversation to collaborators on Apr 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @angular/clifeaturefeature: under considerationng update DX

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions