Skip to content

Commit fc05495

Browse files
authored
Use jq to merge json files (#24)
1 parent 0de0a82 commit fc05495

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

ci/prepare_playwright.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ set -eux
88
export TYPE=typescript
99
export EXAMPLE=vanilla_webpack
1010

11+
function merge-json() {
12+
# merge the second json file into the first.
13+
TEMP_FILE=$(mktemp)
14+
jq '. * input' $1 $2 > TEMP_FILE && mv TEMP_FILE $1
15+
}
16+
1117
# 1. Create and build example code in temporary directory
1218
cd $TYPE && bash ./create_$EXAMPLE.sh && cd ..
1319

@@ -61,8 +67,7 @@ cat > temp.json << EOF
6167
}
6268
}
6369
EOF
64-
npm install --save-dev json-merger
65-
npx json-merger --output package.json --pretty package.json temp.json
70+
merge-json package.json temp.json
6671
rm temp.json
6772

6873
# 5. Copy tests into temp example directory

ci/typescript/create_vanilla_webpack.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ mkdir -p $OUTPUT_DIRECTORY
88
cd $OUTPUT_DIRECTORY
99
rm -rf *
1010

11+
function merge-json() {
12+
# merge the second json file into the first.
13+
TEMP_FILE=$(mktemp)
14+
jq '. * input' $1 $2 > TEMP_FILE && mv TEMP_FILE $1
15+
}
16+
1117
# 1. Create initial package.json (npm project settings)
1218
npm init --yes
1319

@@ -85,8 +91,7 @@ cat > temp.json << EOF
8591
}
8692
}
8793
EOF
88-
npm install --save-dev json-merger
89-
npx json-merger --output package.json --pretty package.json temp.json
94+
merge-json package.json temp.json
9095
rm temp.json
9196

9297
# 8. Build and run basic example without any BokehJS

0 commit comments

Comments
 (0)