-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
feat(upgrade): run migrations from upgrade cli #10494
feat(upgrade): run migrations from upgrade cli #10494
Conversation
✔️ Deploy Preview for carbon-react-next ready! 🔨 Explore the source changes: 904f70e 🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-react-next/deploys/61f2d32ac680430007b04e6a 😎 Browse the preview: https://deploy-preview-10494--carbon-react-next.netlify.app |
✔️ Deploy Preview for carbon-elements ready! 🔨 Explore the source changes: 904f70e 🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-elements/deploys/61f2d32adca11a00073e430a 😎 Browse the preview: https://deploy-preview-10494--carbon-elements.netlify.app |
✔️ Deploy Preview for carbon-components-react ready! 🔨 Explore the source changes: 904f70e 🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-components-react/deploys/61f2d32a301159000855a521 😎 Browse the preview: https://deploy-preview-10494--carbon-components-react.netlify.app |
Was thinking about this the other day, one thing that could simplify our upgrade paths is that we blanket run migrations associated with the upgrade (in this case we would not prompt users to select migrations). For those who would like to select a specific migration, we could have a
|
@joshblack Great point! Having to navigate through the upgrade flow to run a migration is cumbersome. I just pushed an update to run all migrations with an upgrade, and provide separate |
@joshblack Amazing suggestions, thank you! All have been addressed and feedback incorporated. |
I've removed the The cli now runs the |
…es/carbon into 10466-upgrade-cli-run-codemods
Co-authored-by: Josh Black <josh@josh.black>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 🚀
Closes #10466
This PR updates the
@carbon/upgrade
CLI to be able to run one or moremigrations
as part of an upgrade flow. Thesemigrations
contain amigrate
function that can run jscodeshift codemods.The following is now possible:
@carbon/upgrade
: upgrade and run all available migrations for a given upgraderemoved based on feedback@carbon/upgrade migrate
: prompt a list of all available migrations, select one to run@carbon/upgrade migrate list
: list all available migrations@carbon/upgrade migrate <migration-name>
: run a specific migrationChangelog
New
migrate
command to run and list individual migrationsAdd a newmoved to feat(upgrade): add codemod, rewrite imports toimports-to-unified-package.js
codemod to rewrite imports fromcarbon-components-react
to@carbon/react
@carbon/react
#10523Changed
transforms
fromcodemods
package to live within theupgrade
packageRemoved
codemods
packageTesting / Reviewing
cd packages/upgrade
yarn build
to build the CLIcd fixtures/sample-project
to use our sample project fixture../../bin/carbon-upgrade.js --help
to verify the CLI is up-and-running../../bin/carbon-upgrade.js
and choose an upgrade path. Verify the CLI runs all the available migrations for that upgrade path. In the case ofv11: carbon-components
, two stub migrations should be called and log out to the console.../../bin/carbon-upgrade.js migrate list
to see a list of migrations should be shownRunremoved based on feedback../../bin/carbon-upgrade.js migrate
to see a prompt of migrations should be shown allowing a single selection