Skip to content

refactor(ui-codemods): add ui metapackage to icon codemod and simplif…#2472

Open
joyenjoyer wants to merge 1 commit intomasterfrom
refactor_icon_codemod
Open

refactor(ui-codemods): add ui metapackage to icon codemod and simplif…#2472
joyenjoyer wants to merge 1 commit intomasterfrom
refactor_icon_codemod

Conversation

@joyenjoyer
Copy link
Contributor

@joyenjoyer joyenjoyer commented Mar 18, 2026

CLOSES INSTUI-4935

During refactoring I added already existing helper functions to the icon migration codemod and added the ui metapackage with new test fixtures.

Test: Run pnpm -w run test:vitest ui-codemods and check for any errors

@joyenjoyer joyenjoyer self-assigned this Mar 18, 2026
@joyenjoyer joyenjoyer force-pushed the refactor_icon_codemod branch from 31ecc9a to ad08c25 Compare March 18, 2026 13:14
printWarning,
renameElements,
renameImportAndUsages
} from './utils/codemodHelpers'
Copy link
Contributor Author

@joyenjoyer joyenjoyer Mar 18, 2026

Choose a reason for hiding this comment

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

I refactored the codemod and used these helper functions.

const IMPORT_PATHS = [
'@instructure/ui-icons',
'@instructure/ui-icons/es/svg',
'@instructure/ui'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the key part of this PR.

@joyenjoyer joyenjoyer force-pushed the refactor_icon_codemod branch from ad08c25 to a650273 Compare March 18, 2026 13:33
@github-actions
Copy link

github-actions bot commented Mar 18, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://instructure.design/pr-preview/pr-2472/

Built to branch gh-pages at 2026-03-19 13:17 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@joyenjoyer joyenjoyer requested review from HerrTopi and matyasf March 18, 2026 13:41
Copy link
Collaborator

@matyasf matyasf left a comment

Choose a reason for hiding this comment

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

see my comments

Comment on lines +70 to +75
function warnUnmappedIcons(
j: JSCodeshift,
root: Collection,
filePath: string
): void {
// findEveryImport only accepts a single path, so flatMap collects results across all paths
Copy link
Collaborator

Choose a reason for hiding this comment

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

When can this happen? We have icons which have no mappings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This may happen, when the mapping file changes so I believe it is worth preparing for this case (we get a new mapping.json and a line gets deleted mistakenly).

@joyenjoyer joyenjoyer force-pushed the refactor_icon_codemod branch from a650273 to 147f9e5 Compare March 19, 2026 13:12
@joyenjoyer joyenjoyer requested a review from matyasf March 19, 2026 13:35
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