Skip to content
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

fix(transform-imports): Only fallback to alternative icon #2003

Merged
merged 2 commits into from
May 3, 2024

Conversation

bastilian
Copy link
Member

@bastilian bastilian commented May 2, 2024

Compliance was raising an error when building regarding the AnsibeTowerIcon:


ERROR in ./src/PresentationalComponents/RemediationCell/RemediationCell.js
Module build failed (from ./node_modules/ts-loader/index.js):
Error: Cannot find source files for the AnsibeTowerIcon icon. Expected filename ansibeTower-icon. It is possible the icon name does not match the filename pattern. You can look for the source file and add a new entry to the ICONS_NAME_FIX in the @redhat-cloud-services/tsc-transform-imports package.
    at /Users/bastilian/Projects/RedHat/CSfR/compliance-frontend/node_modules/@redhat-cloud-services/tsc-transform-imports/index.js:153:19
    at Array.map (<anonymous>)
    at createIconDynamicImports (/Users/bastilian/Projects/RedHat/CSfR/compliance-frontend/node_modules/@redhat-cloud-services/tsc-transform-imports/index.js:148:29)
    at visitor (/Users/bastilian/Projects/RedHat/CSfR/compliance-frontend/node_modules/@redhat-cloud-services/tsc-transform-imports/index.js:221:24)
    at visitArrayWorker (/Users/bastilian/Projects/RedHat/CSfR/compliance-frontend/node_modules/typescript/lib/typescript.js:88864:51)
    at visitNodes2 (/Users/bastilian/Projects/RedHat/CSfR/compliance-frontend/node_modules/typescript/lib/typescript.js:88835:21)
    at visitLexicalEnvironment (/Users/bastilian/Projects/RedHat/CSfR/compliance-frontend/node_modules/typescript/lib/typescript.js:88891:18)
    at visitEachChildOfSourceFile (/Users/bastilian/Projects/RedHat/CSfR/compliance-frontend/node_modules/typescript/lib/typescript.js:90080:13)
    at Object.visitEachChild (/Users/bastilian/Projects/RedHat/CSfR/compliance-frontend/node_modules/typescript/lib/typescript.js:89052:35)
    at visitor (/Users/bastilian/Projects/RedHat/CSfR/compliance-frontend/node_modules/@redhat-cloud-services/tsc-transform-imports/index.js:238:19)
 @ ./src/PresentationalComponents/RulesTable/Cells.js 6:0-65 39:88-103
 @ ./src/PresentationalComponents/RulesTable/Columns.js 3:0-125 8:32-36 14:32-42 21:32-44 27:32-42 35:32-53
 @ ./src/PresentationalComponents/RulesTable/RulesTable.js
 @ ./src/SmartComponents/SystemDetails/ComplianceDetail.js
 @ ./src/Modules/ComplianceDetails.js
 @ container entry ./SystemDetail[0]

I noticed that it had already an entry for an alternative file/import name. However, it seems that the file name for this icon has been fixed in some version of the react-icons package.

To not break apps that have an older version with the icon name not fixed, instead of removing the "fixed" name, this changes the import transforming to only check for a fallback version of the icon if the check for the filename we assume fails.

Copy link
Contributor

@Hyperkid123 Hyperkid123 left a comment

Choose a reason for hiding this comment

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

Just FYI, we now have PF module map available internally from PF: patternfly/patternfly-react#10046

This while guessing game will be used just as a fallback if the module map file does not exist.

@Hyperkid123 Hyperkid123 added the release Once merged it will trigger bugfix release label May 3, 2024
@bastilian
Copy link
Member Author

we now have PF module map available internally from PF

Cool! Are we going to integrate that with the tsc-transform-imports?

@Hyperkid123
Copy link
Contributor

Yes. I've created issue here: https://issues.redhat.com/browse/RHCLOUD-32457

@Hyperkid123 Hyperkid123 merged commit f283eba into RedHatInsights:master May 3, 2024
2 checks passed
@nacho-bot
Copy link
Collaborator

                      :soon::shipit::octocat:
     :bug:Shipit Squirrel has this release bugfix surrounded, be ready for a new version:beetle:

@nacho-bot
Copy link
Collaborator

     🌱 🌸 🌷 🌻 🌟 New version of package has been released 🌟 🌻 🌷 🌸 🌱

                The release is available on:

         :package:@redhat-cloud-services/tsc-transform-imports/v/1.0.10📦

             :boom:This feature is brought to you by probot🚀

@nacho-bot nacho-bot added the released Pr has been released label May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release Once merged it will trigger bugfix release released Pr has been released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants