Skip to content

Commit

Permalink
Make themes choosable via CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
joemcgill committed Oct 30, 2023
1 parent 975d10e commit ee05c0c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 60 deletions.
5 changes: 3 additions & 2 deletions new/.wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"https://downloads.wordpress.org/plugin/performance-lab.zip"
],
"themes": [
"https://downloads.wordpress.org/theme/twentytwentyone.1.8.zip",
"https://downloads.wordpress.org/theme/twentytwentythree.1.1.zip"
"https://downloads.wordpress.org/theme/twentytwentyone.zip",
"https://downloads.wordpress.org/theme/twentytwentythree.zip",
"WordPress/twentytwentyfour"
],
"mappings": {
"wp-cli.yml": "../shared/wp-cli.yml",
Expand Down
5 changes: 3 additions & 2 deletions old/.wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"https://downloads.wordpress.org/plugin/performance-lab.zip"
],
"themes": [
"https://downloads.wordpress.org/theme/twentytwentyone.1.8.zip",
"https://downloads.wordpress.org/theme/twentytwentythree.1.1.zip"
"https://downloads.wordpress.org/theme/twentytwentyone.zip",
"https://downloads.wordpress.org/theme/twentytwentythree.zip",
"WordPress/twentytwentyfour"
],
"mappings": {
"wp-cli.yml": "../shared/wp-cli.yml",
Expand Down
70 changes: 14 additions & 56 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ fi

OLD_VERSION=${1-latest}
NEW_VERSION=${2-trunk}
SKIP_INIT=${3-false}
OUTPUT=${4-markdown}
SKIP_FORMATTING=${5-false}
PRINT_TO_FILES=${6-false}
THEME=${3-twentytwentyone}
SKIP_INIT=${4-false}
OUTPUT=${5-markdown}
SKIP_FORMATTING=${6-false}
PRINT_TO_FILES=${7-false}

# Configure WordPress versions

Expand Down Expand Up @@ -89,53 +90,10 @@ else

fi

# # Install theme
# Install theme

# (cd old && npm run wp-env --silent run tests-cli wp theme activate twentytwentythree)
# (cd new && npm run wp-env --silent run tests-cli wp theme activate twentytwentythree)

# ## Post debuging info.
# echo "Old version – Theme info"
# (cd old && npm run wp-env run tests-cli wp theme list)

# echo "New version – Theme info"
# (cd new && npm run wp-env run tests-cli wp theme list)

# cd ./wpp-research || exit

# # Benchmark Web Vitals

# npm run research --silent -- benchmark-web-vitals -u http://localhost:8881/ -n 20 -p -o csv > before.csv
# npm run research --silent -- benchmark-web-vitals -u http://localhost:8891/ -n 20 -p -o csv > after.csv
# if [[ $PRINT_TO_FILES == 'true' ]]; then
# if [[ $OUTPUT == 'csv' ]]; then
# node ../scripts/results.js "Web Vitals (twentytwentythree)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > web-vitals-block-theme.csv
# else
# node ../scripts/results.js "Web Vitals (twentytwentythree)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > web-vitals-block-theme.md
# fi
# else
# node ../scripts/results.js "Web Vitals (twentytwentythree)" before.csv after.csv $OUTPUT $SKIP_FORMATTING
# fi

# # Benchmark Server-Timing

# npm run research --silent -- benchmark-server-timing -u http://localhost:8881/ -n 100 -p -o csv > before.csv
# npm run research --silent -- benchmark-server-timing -u http://localhost:8891/ -n 100 -p -o csv > after.csv
# if [[ $PRINT_TO_FILES == 'true' ]]; then
# if [[ $OUTPUT == 'csv' ]]; then
# node ../scripts/results.js "Server-Timing (twentytwentythree)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > server-timing-block-theme.csv
# else
# node ../scripts/results.js "Server-Timing (twentytwentythree)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > server-timing-block-theme.md
# fi
# else
# node ../scripts/results.js "Server-Timing (twentytwentythree)" before.csv after.csv $OUTPUT $SKIP_FORMATTING
# fi

# Install classic theme

# cd ../
(cd old && npm run wp-env --silent run tests-cli wp theme activate twentytwentyone)
(cd new && npm run wp-env --silent run tests-cli wp theme activate twentytwentyone)
(cd old && npm run wp-env --silent run tests-cli wp theme activate $THEME)
(cd new && npm run wp-env --silent run tests-cli wp theme activate $THEME)

## Post debuging info.
echo "Old version – Theme info"
Expand All @@ -152,12 +110,12 @@ npm run research --silent -- benchmark-web-vitals -u http://localhost:8881/ -n 2
npm run research --silent -- benchmark-web-vitals -u http://localhost:8891/ -n 20 -p -o csv > after.csv
if [[ $PRINT_TO_FILES == 'true' ]]; then
if [[ $OUTPUT == 'csv' ]]; then
node ../scripts/results.js "Web Vitals (twentytwentyone)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > web-vitals-classic-theme.csv
node ../scripts/results.js "Web Vitals ($THEME)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > web-vitals-classic-theme.csv
else
node ../scripts/results.js "Web Vitals (twentytwentyone)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > web-vitals-classic-theme.md
node ../scripts/results.js "Web Vitals ($THEME)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > web-vitals-classic-theme.md
fi
else
node ../scripts/results.js "Web Vitals (twentytwentyone)" before.csv after.csv $OUTPUT $SKIP_FORMATTING
node ../scripts/results.js "Web Vitals ($THEME)" before.csv after.csv $OUTPUT $SKIP_FORMATTING
fi

# Benchmark Server-Timing
Expand All @@ -166,12 +124,12 @@ npm run research --silent -- benchmark-server-timing -u http://localhost:8881/
npm run research --silent -- benchmark-server-timing -u http://localhost:8891/ -n 100 -p -o csv > after.csv
if [[ $PRINT_TO_FILES == 'true' ]]; then
if [[ $OUTPUT == 'csv' ]]; then
node ../scripts/results.js "Server-Timing (twentytwentyone)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > server-timing-classic-theme.csv
node ../scripts/results.js "Server-Timing ($THEME)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > server-timing-classic-theme.csv
else
node ../scripts/results.js "Server-Timing (twentytwentyone)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > server-timing-classic-theme.md
node ../scripts/results.js "Server-Timing ($THEME)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > server-timing-classic-theme.md
fi
else
node ../scripts/results.js "Server-Timing (twentytwentyone)" before.csv after.csv $OUTPUT $SKIP_FORMATTING
node ../scripts/results.js "Server-Timing ($THEME)" before.csv after.csv $OUTPUT $SKIP_FORMATTING
fi

# Shutdown sites again
Expand Down

0 comments on commit ee05c0c

Please sign in to comment.