Skip to content

Commit a2d1ae1

Browse files
authored
chore: use the multiplexer for the playground (#58)
1 parent c4c1ef6 commit a2d1ae1

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@
2121
"lint": "eslint --ext=ts .",
2222
"post:generate": "./scripts/post-gen/global.sh",
2323
"generate": "./scripts/multiplexer.sh ./scripts/generate.sh ${0:-all} ${1:-all} && yarn post:generate",
24-
"playground:java": "mvn clean compile exec:java -f playground/java/pom.xml",
25-
"playground:js:analytics": "yarn workspace javascript-playground start:analytics",
26-
"playground:js:personalization": "yarn workspace javascript-playground start:personalization",
27-
"playground:js:recommend": "yarn workspace javascript-playground start:recommend",
28-
"playground:js:search": "yarn workspace javascript-playground start:search",
24+
"playground": "./scripts/multiplexer.sh ./scripts/playground.sh ${0:-javascript} ${1:-search}",
2925
"specs:format": "yarn prettier --write specs",
3026
"specs:lint": "eslint --ext=yml specs/ .github/"
3127
},

scripts/multiplexer.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ CMD=$1
1919
LANGUAGE=$2
2020
CLIENT=$3
2121

22+
if [[ $CMD == "./scripts/playground.sh" ]] && ([[ $LANGUAGE == "all" ]] || [[ $CLIENT == "all" ]]); then
23+
echo "You cannot use 'all' when running the playground, please specify the language and client"
24+
25+
exit 1
26+
fi
27+
2228
LANGUAGES=()
2329
CLIENTS=()
2430

scripts/playground.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# Break on non-zero code
4+
set -e
5+
6+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
7+
# Move to the root (easier to locate other scripts)
8+
cd ${DIR}/..
9+
10+
lang=$1
11+
client=$2
12+
13+
# Run the pre generation script if it exists.
14+
run_playground() {
15+
if [[ $lang == 'javascript' ]]; then
16+
yarn workspace javascript-playground start:$client
17+
elif [[ $lang == 'java' ]]; then
18+
mvn clean compile exec:java -f playground/java/pom.xml
19+
fi
20+
}
21+
22+
run_playground

0 commit comments

Comments
 (0)