Skip to content

[codemod] Add packageName support to the v9 system props codemod#48253

Open
franco-dias wants to merge 1 commit intomui:masterfrom
franco-dias:fix/system-props-v9-codemod-package-name
Open

[codemod] Add packageName support to the v9 system props codemod#48253
franco-dias wants to merge 1 commit intomui:masterfrom
franco-dias:fix/system-props-v9-codemod-package-name

Conversation

@franco-dias
Copy link
Copy Markdown

Summary

The v9.0.0/system-props codemod ignores the --packageName CLI option. The import matching is hardcoded to only match @mui:

root.find(j.ImportDeclaration, decl => decl.source.value.includes('@mui'))

The CLI (codemod.js) accepts --packageName and passes it through to jscodeshift as options.packageName, but removeSystemProps.js never reads it. This means the option documented in the README has no effect for this codemod.

This is a problem for design systems that re-export MUI components under a custom package name. Those usages are silently skipped.

Fix

Read options.packageName and include it in the import declaration filter. When not provided, behavior is unchanged -- only @mui imports are matched.

const packageName = options.packageName;
root.find(j.ImportDeclaration, decl =>
  decl.source.value.includes('@mui') ||
  (packageName && decl.source.value.includes(packageName))
)

Add unit tests to cover the behavior changes when the packageName option is provided.

@mui-bot
Copy link
Copy Markdown

mui-bot commented Apr 9, 2026

Netlify deploy preview

https://deploy-preview-48253--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 40c3517

@franco-dias franco-dias changed the title [codemod] Adds packageName support to the v9 system props codemod [codemod] Add packageName support to the v9 system props codemod Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants