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

feat: implement codemod ibm-products-update-http-errors #17960

Merged
merged 8 commits into from
Dec 4, 2024

Conversation

makafsal
Copy link
Member

@makafsal makafsal commented Nov 4, 2024

Closes 6036

This PR updates the @carbon/upgrade package with a new transform ibm-products-update-http-errors, to update the HttpError403, HttpError404, HttpErrorOther to FullPageError.

Changelog

New

  • New transform packages/upgrade/transforms/ibm-products-update-http-errors.js
  • Includ fixtures in the packages/upgrade/transforms/__testfixtures__/ibm-products-update-http-errors.input.js and packages/upgrade/transforms/__testfixtures__/ibm-products-update-http-errors.output.js files
  • Include tests packages/upgrade/transforms/__tests__/ibm-products-update-http-errors-test.js
  • Implement a sample packages/upgrade/fixtures/ibm-products-update-http-errors-sample.jsx to test the Codemod locally

Changed

  • Update packages/upgrade/src/upgrades.js with a new migration entry ibm-products-update-http-errors

Testing / Reviewing

  • Try out the Codemod locally by:
    • Pulling down this PR
    • Run cd packages/upgrade
    • Run yarn build to build the CLI
    • Run ./bin/carbon-upgrade.js migrate list and verify a new entry ibm-products-update-http-errors (Rewrites HttpError403, HttpError404, HttpErrorOther to FullPageError) present
    • Run npx jest transforms/__tests__/ibm-products-update-http-errors-test.js and verify test result
    • Run ./bin/carbon-upgrade.js migrate ibm-products-update-http-errors fixtures/ibm-products-update-http-errors-sample.jsx -w to try the Codemod. (Can select the /carbon/packages/upgrade as workspace)

@makafsal makafsal requested a review from a team as a code owner November 4, 2024 14:32
@makafsal makafsal requested review from emyarod and guidari November 4, 2024 14:32
Copy link

netlify bot commented Nov 4, 2024

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit b3cefb9
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/6750466e5a64ec0008476cb8
😎 Deploy Preview https://deploy-preview-17960--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Nov 4, 2024

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit b3cefb9
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/6750466ed6c4520008f9db9d
😎 Deploy Preview https://deploy-preview-17960--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Nov 4, 2024

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit b3cefb9
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/6750466e6b9a8d000816b161
😎 Deploy Preview https://deploy-preview-17960--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Nov 4, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 83.69%. Comparing base (879f619) to head (b3cefb9).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
packages/upgrade/src/upgrades.js 0.00% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17960      +/-   ##
==========================================
- Coverage   83.72%   83.69%   -0.04%     
==========================================
  Files         404      404              
  Lines       14344    14350       +6     
  Branches     4646     4599      -47     
==========================================
  Hits        12010    12010              
- Misses       2173     2178       +5     
- Partials      161      162       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@2nikhiltom 2nikhiltom left a comment

Choose a reason for hiding this comment

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

This looks amazing 🔥
just a thought -> a deprecation notice can be provided that would instruct users to run this codemod

@makafsal
Copy link
Member Author

makafsal commented Nov 6, 2024

This looks amazing 🔥 just a thought -> a deprecation notice can be provided that would instruct users to run this codemod

@2nikhiltom That sounds good! Where do we typically provide this notice? Would it go on our Storybook or PAL website?

@2nikhiltom
Copy link
Contributor

2nikhiltom commented Nov 7, 2024

I meant to document this change and give out the information to run "npx @carbon/upgrade migrate ibm-products-update-http-errors --write" in any reverent .md file, I am not sure where will this apply for PAL/web-components
something like this
image

@annawen1 annawen1 changed the title implement codemod ibm-products-update-http-errors feat: implement codemod ibm-products-update-http-errors Nov 8, 2024
Copy link
Contributor

@riddhybansal riddhybansal left a comment

Choose a reason for hiding this comment

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

This looks amazing !!

Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

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

looks good to me!

@guidari guidari enabled auto-merge December 4, 2024 12:09
@guidari guidari added this pull request to the merge queue Dec 4, 2024
Merged via the queue into carbon-design-system:main with commit 22f19fc Dec 4, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

codemod to transform from HttpError403, HttpError404, HttpErrorOther to FullPageError
6 participants