Created
April 1, 2023 12:42
-
-
Save yashsway/a6b0f7727be93c167eaeef517df68372 to your computer and use it in GitHub Desktop.
Rename JS and JSX files to TSX (as part of a Typescript migration)
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
# rename all js to tsx | |
find . -type f \( -iname '*.js' -or -iname '*.jsx' \) -not -wholename '*node_modules*' -exec sh -c 'mv "$1" "${1%.js*}.tsx"' _ {} \; | |
# keep js files as ts | |
find . -type f \( -iname '*.js' -or -iname '*.jsx' \) -not -wholename '*node_modules*' -exec sh -c 'mv "$1" `sed -Ee "s/\.js(x)?$/\.ts\1/g" <<< "$1"`' _ {} \; | |
# credits to https://github.com/markogresak |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment