Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env bash

run_old_new() {
local FN="$1"

if [[ "$(type -t "$FN")" != 'function' ]]; then
exit 11
fi

cd old/
"$FN"
cd -

cd new/
"$FN"
cd -
}

# Install wpp-research if missing

if [ ! -d "./wpp-research" ]; then
Expand Down Expand Up @@ -44,15 +60,16 @@ fi

if [[ $SKIP_INIT != 'true' ]]; then

# Install WordPress

(cd old && npm i && npm run wp-env --silent start)
(cd new && npm i && npm run wp-env --silent start)

# Update permalink structure
install_wordpress() {
npm i
npm run wp-env --silent start
}
run_old_new install_wordpress

(cd old && npm run wp-env --silent run tests-cli wp rewrite structure '/%postname%/' -- --hard)
(cd new && npm run wp-env --silent run tests-cli wp rewrite structure '/%postname%/' -- --hard)
update_permalink_structure() {
npm run wp-env --silent run tests-cli wp rewrite structure '/%postname%/' -- --hard
}
run_old_new update_permalink_structure

# Delete any data that might already exist by re-installing WordPress.
# Prevents mock data from being duplicated on subsequent runs.
Expand Down