Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@compiled/codemods

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@compiled/codemods

A familiar and performant compile time CSS-in-JS library for React.

  • 0.10.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by200%
Maintainers
0
Weekly downloads
 
Created
Source

codemods

Codemods for easy migration from styled components and emotion.

Usage

Codemods in this repository can be run with the Hypermod.io CLI.

# Transform single file
npx @hypermod/cli --packages @compiled/codemods /Project/path/to/file

# Transform multiple files
npx @hypermod/cli --packages @compiled/codemods /Project/**/*.tsx

Available codemods

  1. styled-components-to-compiled
  2. emotion-to-compiled
  3. styled-components-inner-ref-to-ref

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 '@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;

Keywords

FAQs

Package last updated on 14 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc