# @compiled/codemods

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

Latest version **0.10.2** (published 2026-07-28) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @compiled/codemods
pnpm add @compiled/codemods
yarn add @compiled/codemods
bun add @compiled/codemods
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.10.2 |
| Published | 2026-07-28 |
| First published | 2021-10-13 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 185.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2056 |
| Author | Michael Dougall |
| Maintainers | atlassianartifactteam |
| Keywords | codemod, compiled, css-in-js, typescript |

## Links

- npm: https://www.npmjs.com/package/@compiled/codemods
- Repository: https://github.com/atlassian-labs/compiled
- Homepage: https://compiledcssinjs.com/docs/pkg-cli
- Issues: https://github.com/atlassian-labs/compiled/issues/new?assignees=&labels=bug&template=bug_report.md
- npm.io page: https://npm.io/package/@compiled/codemods

## Dependencies (3)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [jscodeshift](https://npm.io/package/jscodeshift.md) ^0.16.1
- [@compiled/utils](https://npm.io/package/@compiled/utils.md) ^0.14.0

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 0.10.2 (latest) — 2026-07-28
- 0.10.1 — 2026-03-30
- 0.10.0 — 2024-10-14
- 0.9.5 — 2024-09-30
- 0.9.4 — 2024-05-13
- 0.9.3 — 2024-04-11
- 0.9.2 — 2024-04-09
- 0.9.1 — 2023-11-15
- 0.9.0 — 2023-04-26
- 0.8.0 — 2023-02-20
- 0.7.1 — 2023-01-09
- 0.7.0 — 2023-01-06
- 0.6.0 — 2022-06-09
- 0.5.0 — 2022-03-16
- 0.4.2 — 2022-03-07
- … 9 more at https://npm.io/package/@compiled/codemods/versions

## README

# codemods

> Codemods for easy migration from [styled components](https://styled-components.com/) and [emotion](https://emotion.sh/docs/introduction).

## Usage

Codemods in this repository can be run with the [Hypermod.io CLI](https://www.hypermod.io/docs/tools/cli/).

```bash
# 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](./src/transforms/styled-components-to-compiled)
2. [emotion-to-compiled](./src/transforms/emotion-to-compiled)
3. [styled-components-inner-ref-to-ref](./src/transforms/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:

```ts
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;
```

---
_Source: https://npm.io/package/@compiled/codemods · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
