package
Web platform codemods
npm install uber-codemodsGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Estimated unpacked size across 2 packages.
3.6 kB
Includes dependencies.
A collection of code-changing JSCodeshift's for JavaScript.
npm install -g jscodeshift
npm install uber-codemods
jscodeshift -t node_modules/uber-codemods/<codemod-name> <transform-path>Use the -d option for a dry-run and use -p to print the output for comparison.
r-dom-to-react-create-elementReplaces all uses of r-dom with React's createElement(). After this conversion, you can optionally use the create-element-to-jsx codemod to generate jsx.
jscodeshift -t node_modules/uber-codemods/src/r-dom-to-react-create-element.js <transform-path>replace-requireReplaces all requires and imports of toReplace with replaceWith. Takes two options via the cli. Also replaces sub-paths in your require/import statements.
jscodeshift -t node_modules/uber-codemods/src/replace-require.js <transform-path> --toReplace="object.omit" --replaceWith="just-omit"replace-require-absolute-pathReplaces all requires and imports of toReplace with the relative path to replaceWith. Takes two options via the cli. The reason this is needed as a separate mod from replace-require is because the relative path to replaceWith changes relative to the current file being evaluated by jscodeshift.
jscodeshift -t node_modules/uber-codemods/src/replace-require-absolute-path.js <transform-path> --toReplace="object.omit" --replaceWith=$(pwd)/just-omitxtend-to-spreadReplaces all uses of xtend with the es6 spread operator.
jscodeshift -t node_modules/uber-codemods/src/xtend-to-spread.js <transform-path>MIT © Uber
rtsao
ryan.j.tsao@gmail.com