@evensix-compiled/codemods
TypeScript icon, indicating that this package has built-in type declarations

0.6.0 • Public • Published

codemods

Codemods for easy migration from styled components and emotion.

Available codemods

  1. styled-components-to-compiled
  2. emotion-to-compiled

Plugins

Codemods support a simple plugin system where supported implementations can be overridden. The CodemodPlugin interface lists all the supported methods to be re-implemented. See the following example:

import type { API, FileInfo, Options } from 'jscodeshift';
import type { CodemodPlugin } from '@evensix-compiled/codemods';

const ExampleCodemodPlugin: CodemodPlugin = {
  name: 'example-codemod-plugin',
  create: (fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) => ({
    visitor: {
      program({ program }) {
        j(program)
          .find(j.ImportDeclaration)
          .at(-1)
          .get()
          .insertAfter(
            j.importDeclaration(
              [j.importSpecifier(j.identifier('getFeatureFlag'))],
              j.literal('./feature-flags')
            )
          );
      },
    },
  }),
};

export default ExampleCodemodPlugin;

Package Sidebar

Install

npm i @evensix-compiled/codemods

Weekly Downloads

1

Version

0.6.0

License

Apache-2.0

Unpacked Size

206 kB

Total Files

72

Last publish

Collaborators

  • andparsons