J

devcycle-to-openfeature-nodejs-update-imports

How to Use
Run this codemod on your codebase using one of the following commands

The easiest way to run this codemod without installing anything globally:

Documentation

DevCycle to OpenFeature Node.js - Update Imports CodeMod

This Codemod helps to convert DevCycle Node.js SDK implementations to the OpenFeature Node.js SDK using the DevCycle Provider. It handles the first step of the conversion by updating the packages imports:

  • Only if the file is using initializeDevCycle, removes the imports of initializeDevCycle, and replaces those imports with DevCycleProvider from @devcycle/nodejs-server-sdk
  • Only if the file is using DevCycleClient, removes the import of DevCycleClient, and replaces those imports with DevCycleProvider from @devcycle/nodejs-server-sdk
  • Replaces DevCycleUser type with EvaluationContext from @openfeature/server-sdk
  • Add imports for OpenFeature from @openfeature/server-sdk if the file is using initializeDevCycle or DevCycleClient

Before

ts

After

ts

Ready to contribute?

Build your own codemod and share it with the community.