0.0.2-beta.0 • Published 1 year ago
@lg-tools/migrator v0.0.2-beta.0
Migrator
Installation
Yarn
yarn add @lg-tools/migratorNPM
npm install @lg-tools/migratorUsage
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> --forceMigrations
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" />0.0.2-beta.0
1 year ago