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(upgrade): adds featureflag-deprecate-flags-prop codemod and deprecates flags prop #17266

Merged

Conversation

2nikhiltom
Copy link
Contributor

@2nikhiltom 2nikhiltom commented Aug 25, 2024

Closes #17243

New props to feature flag props were added here #17239

This introduces a new codemod to Convert FeatureFlags' flags object prop to individual boolean props
and deprecates the existing flags prop

Changelog

New

  • Added a new featureflag-deprecate-flags-prop codemod
  • Added test fixtures for all existing featureflags and tests to validate
  • flags prop for FeatureFlag is marked as deprecated

Changed

  • Updated FeatureFlags/overview.stories.mdx to document the codemod
  • Added instructions for running the codemod to the flags deprecation warning message

Testing / Reviewing

  • Ensure that the test fixtures make sense - input is what someones code should look like before running the codemod, and the output is what we expect the codemod to generate/change it to.
  • Make sure the docs read well and I didn't miss anything
  • I used below command to run the codemode locally to verify it works ( --parser=tsx used to process typescript files)
  • jscodeshift -t featureflag-deprecate-flags-prop.js --parser=tsx _your_file_path_

curious to hear how you feel about this

@2nikhiltom 2nikhiltom requested review from a team as code owners August 25, 2024 17:29
Copy link

netlify bot commented Aug 25, 2024

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 1cd4432
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/66ed1ca7552df80008d1e005
😎 Deploy Preview https://deploy-preview-17266--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

netlify bot commented Aug 25, 2024

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 1cd4432
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/66ed1ca78001c20008e2aac2
😎 Deploy Preview https://deploy-preview-17266--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.

@riddhybansal
Copy link
Contributor

Hey @tay1orjones one doubt , what do you think on test fixture ? can we just make it generic for all feature flags , May be just this

The input.js

<FeatureFlags flags={{ 'enable-v12-tile-default-icons': true, 'enable-v12-overflowmenu': true, }}> <Tile /> </FeatureFlags>;

The output.js
`<FeatureFlags
enableV12TileDefaultIcons
enableV12Overflowmenu

;`

Copy link
Member

@tay1orjones tay1orjones 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 great! Just a few things from our pair reviewing session today:

  • Add this codemod to the available migrations via @carbon/upgrade migrate, in packages/upgrade/src/upgrades.js
  • Update the codemod to remove old flags that are no longer needed, like enable-v11-release. Mention this in the description of the migration in packages/upgrade/src/upgrades.js
  • Add some new test fixtures mixing old flags and new to validate that the right one are being removed

packages/react/src/components/FeatureFlags/index.js Outdated Show resolved Hide resolved
packages/react/src/components/FeatureFlags/index.js Outdated Show resolved Hide resolved
@2nikhiltom 2nikhiltom requested a review from tay1orjones August 29, 2024 13:13
Copy link
Member

@tay1orjones tay1orjones 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 so good! 🔥 just three minor things I saw

packages/upgrade/src/upgrades.js Outdated Show resolved Hide resolved
packages/react/src/components/FeatureFlags/index.js Outdated Show resolved Hide resolved
@2nikhiltom 2nikhiltom requested a review from a team as a code owner September 5, 2024 11:09
@2nikhiltom 2nikhiltom force-pushed the 17243_CodeModes_FeatureFlags branch from 152bfee to ab7bc72 Compare September 5, 2024 11:25
Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

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

There's one more spot where enable-use-controlled-state-with-value is used that could probably be deleted, it's not used anywhere else in the styles

'enable-use-controlled-state-with-value': true,

Copy link

codecov bot commented Sep 13, 2024

Codecov Report

Attention: Patch coverage is 61.11111% with 7 lines in your changes missing coverage. Please review.

Project coverage is 76.95%. Comparing base (72c80b3) to head (1cd4432).
Report is 726 commits behind head on main.

Files with missing lines Patch % Lines
packages/upgrade/src/upgrades.js 0.00% 5 Missing and 1 partial ⚠️
...ackages/react/src/components/FeatureFlags/index.js 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17266      +/-   ##
==========================================
- Coverage   76.95%   76.95%   -0.01%     
==========================================
  Files         408      408              
  Lines       13979    13992      +13     
  Branches     4343     4300      -43     
==========================================
+ Hits        10758    10768      +10     
- Misses       3047     3051       +4     
+ Partials      174      173       -1     

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

@kennylam kennylam added this pull request to the merge queue Sep 21, 2024
Merged via the queue into carbon-design-system:main with commit 23b8ff3 Sep 21, 2024
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Deprecate the existing flags prop, add codemod migration
4 participants