0.1.0 ā¢ Published 3 years ago
lingui-codemod v0.1.0
This repository contains a collection of codemod scripts for use with JSCodeshift that help update Lingui APIs.
Usage
npx lingui-codemod <transform> <path> [...options]
transform
- name of transform, see available transforms below.path
- files or directory to transform- use the
--dry
option for a dry-run and use--print
to print the output for comparison
This will start an interactive wizard, and then run the specified transform.
Included Transforms
v2-to-v3
Converts some outdated standards from lingui
version 2.x.x to new features and best practices introduced in lingui
version 3.x.x
npx lingui-codemod v2-to-v3 <path>
jscodeshift options
To pass more options directly to jscodeshift, use --jscodeshift="..."
. For example:
npx lingui-codemod --jscodeshift="--run-in-band --verbose=2"
See all available options here.
Recast Options
Options to recast's printer can be provided
through jscodeshift's printOptions
command line argument
npx lingui-codemod <transform> <path> --jscodeshift="--printOptions='{\"quote\":\"double\"}'"
Usage without params
A CLI is built-in to help you migrate your codebase, will ask you some questions:
ā project git:(master) lingui-codemod
? On which files or directory should the codemods be applied? for ex: ./src
? Which dialect of JavaScript do you use? for ex: JavaScript | Typescript | JavaScript with Flow
? Which transform would you like to apply? for ex: `v2-to-v3`
License
lingui-codemod is MIT licensed.
0.1.0
3 years ago