J

devcycle-to-openfeature-nodejs-initialization-transform

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 - Initialization Transform CodeMod

This Codemod will transform the initialization of the DevCycle Node.js Server SDK to use OpenFeature Node.js SDK.

  • Calls to initializeDevCycle() should be replaced with new DevCycleProvider() where the same parameters used.
  • The variable named from the initializeDevCycle() call should be renamed to replace client with provider. For example: devcycleClient renamed to devcycleProvider.
  • The new provider should be passed into await OpenFeature.setProviderAndWait(devcycleProvider);
  • C new openFeatureClient should be created from OpenFeature.getClient()
  • Usages of the variabled named from the initializeDevCycle() call should be updated to use the openFeatureClient instead.

Before

ts

After

ts

Ready to contribute?

Build your own codemod and share it with the community.