Skip to content

Commit

Permalink
style: improve console output
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolai Lopin <[email protected]>
  • Loading branch information
Nikolai Lopin committed Jan 9, 2024
1 parent 201f565 commit de78e32
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions scripts/run_v2_migration.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
#!/bin/bash
set -e # Exit immediately if any command fails

if [ ! -d "node_modules/@freenow/wave/lib/esm/codemods" ]; then
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.sh)
shift

for file in node_modules/@freenow/wave/lib/esm/codemods/*; do
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
echo "Executing the rule: $file"
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

0 comments on commit de78e32

Please sign in to comment.