4532634515 | ||
---|---|---|
.. | ||
src | ||
.eslintignore | ||
.eslintrc.js | ||
CHANGELOG.json | ||
CHANGELOG.md | ||
README.md | ||
babel.config.js | ||
jest.config.js | ||
just.config.js | ||
package.json | ||
transform.js | ||
tsconfig.json |
README.md
@fluentui-react-native/transforms
This package supplies transforms that help with refactoring FURN code. The transforms are passed into jscodeshift to transform code.
Usage
- Install jscodeshift using the instructions here
- Run the transforms using the following command:
npx -p @fluentui-react-native/codemods transform -t <transform_name> --path <path_to_files_to_transform>
For example
npx -p @fluentui-react-native/codemods transform -t button-v0-to-v1 --path .\apps\fluent-tester\src\TestComponents\Button\deprecated\ButtonFocusTest.tsx
Tests
Test files are named in the format <transform>-test.ts
. The "defineTest" from jscodeshift is used to run the test.
Each test has an input and output file under the __testfixtures__
folder. The input is an example of code before the transform is run, and the output is what the code should look like after running the transform.
Using this, we can ensure that the codemod works the way we intend to.
One caveat is that the codemod doesn't quite respect Prettier settings and doesn't seem to correctly format the output. So the output files are ignored by Prettier.