0.10.0 • Published 8 months ago
@compiled/codemods v0.10.0
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
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;
0.10.0
8 months ago
0.9.5
9 months ago
0.9.4
1 year ago
0.9.3
1 year ago
0.9.2
1 year ago
0.9.1
2 years ago
0.9.0
2 years ago
0.8.0
2 years ago
0.7.1
2 years ago
0.7.0
2 years ago
0.6.0
3 years ago
0.5.0
3 years ago
0.4.2
3 years ago
0.4.1
3 years ago
0.4.0
3 years ago
0.3.4
3 years ago
0.3.3
4 years ago
0.3.2
4 years ago
0.3.1
4 years ago
0.3.0
4 years ago
0.2.0
4 years ago
0.1.0
4 years ago