0.9.3 • Published 29 days ago
@compiled/codemods v0.9.3
codemods
Codemods for easy migration from styled components and emotion.
Usage
Codemods in this repository can be run with the CodeshiftCommunity tooling.
# Transform single file
npx @codeshift/cli --packages @compiled/codemods /Project/path/to/file
# Transform multiple files
npx @codeshift/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.9.3
29 days ago
0.9.2
1 month ago
0.9.1
6 months ago
0.9.0
1 year ago
0.8.0
1 year ago
0.7.1
1 year ago
0.7.0
1 year ago
0.6.0
2 years ago
0.5.0
2 years ago
0.4.2
2 years ago
0.4.1
2 years ago
0.4.0
2 years ago
0.3.4
2 years ago
0.3.3
2 years ago
0.3.2
2 years ago
0.3.1
2 years ago
0.3.0
3 years ago
0.2.0
3 years ago
0.1.0
3 years ago