Skip to content

docs: add an MDC migration guide #25543

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

Merged
merged 4 commits into from
Sep 19, 2022
Merged

docs: add an MDC migration guide #25543

merged 4 commits into from
Sep 19, 2022

Conversation

mmalerba
Copy link
Contributor

No description provided.

@angular-robot angular-robot bot added the area: docs Related to the documentation label Aug 26, 2022

Depending on the size and complexity of your app, you may want to migrate a single component (or
small group of components) at a time, rather than all at once.
TODO(wagnermaciel): Add details on this: script params, which components need to move together
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only group of components that need to be migrated together are autocomplete, form-field, input, and select (https://github.com/angular/components/blob/main/src/material/schematics/ng-generate/mdc-migration/index.ts#L21)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, and what happens if I do ng generate @angular/material:mdc-migration --component input? Does that migrate the whole group or do they have to do ng generate @angular/material:mdc-migration --component input,form-field,autocomplete,select?

identified.

```ts
// TODO(wagnermaciel): Do we have a common format for all TODOs the script adds?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For styles, its "TODO: The following rule targets internal classes of COMPONENT_NAME that may no longer apply for the MDC version". (https://github.com/angular/components/blob/main/src/material/schematics/ng-generate/mdc-migration/rules/style-migrator.ts#L183)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Styles are the only places we add these todos

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change it to generate a more searchable TODO, e.g. TODO(MDC):. I'm surprised there's no TODO for templates that use chips-list, are we able to figure out what new version of chips to change them to?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! It was tricky but we got it working


Depending on the size and complexity of your app, you may want to migrate a single component (or
small group of components) at a time, rather than all at once.
TODO(wagnermaciel): Add details on this: script params, which components need to move together
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 3 params are the tsconfig, the directory that will be migrated, and the list of the components (https://github.com/angular/components/blob/main/src/material/schematics/ng-generate/mdc-migration/schema.json).

Right now the integration test's command looks like this:
ng generate @angular/material:mdc-migration --components all --tsconfig tsconfig.app.json (https://github.com/angular/components/blob/main/integration/mdc-migration/migration-test.bzl#L34)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be good to add an example of migrating specific components as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if I don't specify any of the params and just do ng generate @angular/material:mdc-migration do they default to something? does it prompt me?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm 99% sure it does prompt you but @amysorto would know for certain

@mmalerba mmalerba force-pushed the mdc-guide branch 4 times, most recently from 5ae81ae to 455af0b Compare September 8, 2022 21:43
@mmalerba mmalerba marked this pull request as ready for review September 8, 2022 21:45
@mmalerba mmalerba requested a review from jelbourn as a code owner September 8, 2022 21:45
@mmalerba mmalerba added the target: major This PR is targeted for the next major release label Sep 8, 2022
@mmalerba
Copy link
Contributor Author

mmalerba commented Sep 8, 2022

There's still lots of work to be done on this guide, but I'm marking the PR as ready because I'd like to do an initial review and get this in. Then we can divy up the detailed changes section and have everyone contribute improvements

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hopping into a meeting, will continue reviewing afterwards

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on this iteration- we can make tweaks once this is in

@mmalerba mmalerba added the action: merge The PR is ready for merge by the caretaker label Sep 18, 2022
@mmalerba mmalerba merged commit b88b2aa into angular:main Sep 19, 2022
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: docs Related to the documentation target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants