Last active
May 19, 2020 17:35
-
-
Save jamesmfriedman/cc8ef976888962b3d9a0d252cf7ec2d0 to your computer and use it in GitHub Desktop.
Rename all camelcase files to kebab case, and all ts to tsx because OS is case insensitive love React.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm -rf temp \ | |
&& mkdir temp \ | |
&& git mv src/* temp \ | |
&& find ./temp -name '*' -type f -exec sh -c "echo '{}' \ | |
| sed 's/\([a-z]\)\([A-Z]\)/\1-\2/g'\ | |
| sed 's/\([A-Z]\{2,\}\)\([A-Z]\)/\1-\2/g' \ | |
| sed 's/\.ts$/\.tsx/g' \ | |
| sed 's/\.\/temp/\.\/src/g' \ | |
| tr '[:upper:]' '[:lower:]' \ | |
| xargs -I newName sh -c 'dirname newName | xargs mkdir -p && git mv --force {} newName' | |
" \; \ | |
&& rm -rf temp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment