From de78e32d67140b4ad8d42895b0d97c359a1d9282 Mon Sep 17 00:00:00 2001 From: Nikolai Lopin Date: Tue, 9 Jan 2024 20:07:09 +0100 Subject: [PATCH] style: improve console output Signed-off-by: Nikolai Lopin --- scripts/run_v2_migration.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/run_v2_migration.sh b/scripts/run_v2_migration.sh index 210a49906..4746ff0a7 100644 --- a/scripts/run_v2_migration.sh +++ b/scripts/run_v2_migration.sh @@ -1,7 +1,7 @@ #!/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 @@ -9,9 +9,14 @@ 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 \ No newline at end of file