Jjonathannorris

devcycle-to-openfeature-nodejs-update-imports

No description available

devcycleopenfeaturenodejs
Public
10 executions

Run locally

npx codemod devcycle-to-openfeature-nodejs-update-imports

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.