-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Execute all codemodes using one command (#403)
* feat: allow to execute all codemods at once Signed-off-by: Nikolai Lopin <[email protected]> * style: improve console output Signed-off-by: Nikolai Lopin <[email protected]> * Apply suggestions from code review Co-authored-by: martimalek <[email protected]> --------- Signed-off-by: Nikolai Lopin <[email protected]> Co-authored-by: martimalek <[email protected]>
- Loading branch information
1 parent
8fbe026
commit 9dabffd
Showing
3 changed files
with
45 additions
and
8 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
set -e # Exit immediately if any command fails | ||
CODEMODS_FOLDER="node_modules/@freenow/wave/lib/esm/codemods" | ||
if [ ! -d "$CODEMODS_FOLDER" ]; then | ||
echo "The 'codemods' folder does not exist." | ||
exit 1 | ||
fi | ||
|
||
# remove the first argument (the `run_v2_migration`) | ||
shift | ||
|
||
total_files=$(find "$CODEMODS_FOLDER" -type f | wc -l | tr -d '[:space:]') | ||
|
||
current_file=0 | ||
for file in "$CODEMODS_FOLDER"/*; do | ||
if [ -f "$file" ]; then | ||
current_file=$((current_file + 1)) | ||
echo "Executing npx codeshift for $(basename "$file") ($current_file of $total_files)" | ||
npx jscodeshift --extensions=js,jsx,ts,tsx --parser=tsx -t="$file" "$@" | ||
echo | ||
fi | ||
done |