Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use the multiplexer for the playground #58

Merged
merged 4 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
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
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
"lint": "eslint --ext=ts .",
"post:generate": "./scripts/post-gen/global.sh",
"generate": "./scripts/multiplexer.sh ./scripts/generate.sh ${0:-all} ${1:-all} && yarn post:generate",
"playground:java": "mvn clean compile exec:java -f playground/java/pom.xml",
"playground:js:analytics": "yarn workspace javascript-playground start:analytics",
"playground:js:personalization": "yarn workspace javascript-playground start:personalization",
"playground:js:recommend": "yarn workspace javascript-playground start:recommend",
"playground:js:search": "yarn workspace javascript-playground start:search",
"playground": "./scripts/multiplexer.sh ./scripts/playground.sh ${0:-javascript} ${1:-search}",
"specs:format": "yarn prettier --write specs",
"specs:lint": "eslint --ext=yml specs/ .github/"
},
Expand Down
6 changes: 6 additions & 0 deletions scripts/multiplexer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ CMD=$1
LANGUAGE=$2
CLIENT=$3

if [[ $CMD == "./scripts/playground.sh" ]] && ([[ $LANGUAGE == "all" ]] || [[ $CLIENT == "all" ]]); then
echo "You cannot use 'all' when running the playground, please specify the language and client"

exit 1
fi

LANGUAGES=()
CLIENTS=()

Expand Down
22 changes: 22 additions & 0 deletions scripts/playground.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Break on non-zero code
set -e

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
# Move to the root (easier to locate other scripts)
cd ${DIR}/..

lang=$1
client=$2
Comment on lines +10 to +11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing will break if you run all playground at the same time, it will just look ugly, It's possible to block it like this but not sure if it's necessary

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep but what I meant is it's not intended to run all of them


# Run the pre generation script if it exists.
run_playground() {
if [[ $lang == 'javascript' ]]; then
yarn workspace javascript-playground start:$client
elif [[ $lang == 'java' ]]; then
mvn clean compile exec:java -f playground/java/pom.xml
fi
}

run_playground