@lg-tools/migrator
v0.0.2-beta.0
Published
Migrator for LeafyGreen UI, think of a better description
Downloads
5
Keywords
Readme
Migrator
Installation
Yarn
yarn add @lg-tools/migrator
NPM
npm install @lg-tools/migrator
Usage
yarn lg migrator <migration> <path> [...options]
Arguments
migration
name of migration, see available migrations below.
path
files or directory to transform
Options
--i or --ignore
Glob patterns to ignore
yarn lg migrator <migration> <path> --ignore **/node_modules/** **/.next/**
--d or --dry
Dry run (no changes to files are made)
yarn lg migrator <migration> <path> --dry
--p or --print
Print transformed files to stdout and changes are also made to files
yarn lg migrator <migration> <path> --print
--f or --force
Bypass Git safety checks and forcibly run codemods.
yarn lg migrator <migration> <path> --force
Migrations
NOTE: These migrations are for testing purposes only
consolidate-props
This codemod consolidates two props into one.
yarn lg migrator consolidate-props <path>
E.g.
In this example, the disabled
props is merged into the state
prop.
Before:
<MyComponent disabled={true} state="valid" />
After:
<MyComponent state="disabled" />
rename-component-prop
This codemod renames a component prop
yarn lg migrator rename-component-prop <path>
E.g.
In this example, prop
is renamed to newProp
.
Before:
<MyComponent prop="hey" />
After:
<MyComponent newProp="hey" />
update-component-prop-value
This codemod updates a prop value
yarn lg migrator update-component-prop-value <path>
E.g.
In this example, value
is updated to new prop value
.
Before:
<MyComponent prop="value" />
After:
<MyComponent prop="new prop value" />