-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[core] Introduce x-codemod
package
#6876
Conversation
"@babel/core": "^7.20.2", | ||
"@babel/runtime": "^7.20.1", | ||
"@babel/traverse": "^7.20.1", | ||
"jscodeshift": "0.13.1", |
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.
Locking version to the same as in material-ui
as 0.14.0 produces unstable transformations...
I.e.:
return (
<LocalizationProvider>
stuff
</LocalizationProvider>
);
becomes
return (
(<LocalizationProvider>
stuff
</LocalizationProvider>)
);
"directory": "packages/x-codemod" | ||
}, | ||
"license": "MIT", | ||
"homepage": "https://github.com/mui/mui-x/tree/next/packages/x-codemod", |
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.
Ideally this should be updated once we do a stable release. 🙈
These are the results for the performance tests:
|
packages/x-codemod/src/v6.0.0/component-rename-prop.test/actual.js
Outdated
Show resolved
Hide resolved
2 things that could be improved from the core repo:
|
Fully agree with Jun 1st point ! |
@siriwatknp Thank you for the suggestion on a better file structure.
|
`build` contents will be published and there are only relevant files there
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
🤩 Definitely better than the core repo. One note about the spec files because it is possible to have multiple test cases in a single codemod, it could look like this:
But for a single test case, it is enough with this:
|
@siriwatknp
Are you sure that it does not allow? There is even a mention of it in readme. 🤔 |
They can be passed in via `--jscodeshift` option
After changing folder structure to have index.js we can simply target the folder and it's index file will be executed
@siriwatknp |
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.
Great work !
Add the initial "infra" for
@mui/x-codemod
package.Added most of the available
utils
frommaterial-ui
, event though only one is used for now.mui-codemod
codepreset-safe
x-codemod
bin commandx-codemod
bin commandnpx @mui/x-codemod
jscodeshift
options can be passed in