Skip to content

Commit

Permalink
Use jq to merge json files (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthomas23 authored Feb 6, 2025
1 parent 0de0a82 commit fc05495
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions ci/prepare_playwright.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ set -eux
export TYPE=typescript
export EXAMPLE=vanilla_webpack

function merge-json() {
# merge the second json file into the first.
TEMP_FILE=$(mktemp)
jq '. * input' $1 $2 > TEMP_FILE && mv TEMP_FILE $1
}

# 1. Create and build example code in temporary directory
cd $TYPE && bash ./create_$EXAMPLE.sh && cd ..

Expand Down Expand Up @@ -61,8 +67,7 @@ cat > temp.json << EOF
}
}
EOF
npm install --save-dev json-merger
npx json-merger --output package.json --pretty package.json temp.json
merge-json package.json temp.json
rm temp.json

# 5. Copy tests into temp example directory
Expand Down
9 changes: 7 additions & 2 deletions ci/typescript/create_vanilla_webpack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ mkdir -p $OUTPUT_DIRECTORY
cd $OUTPUT_DIRECTORY
rm -rf *

function merge-json() {
# merge the second json file into the first.
TEMP_FILE=$(mktemp)
jq '. * input' $1 $2 > TEMP_FILE && mv TEMP_FILE $1
}

# 1. Create initial package.json (npm project settings)
npm init --yes

Expand Down Expand Up @@ -85,8 +91,7 @@ cat > temp.json << EOF
}
}
EOF
npm install --save-dev json-merger
npx json-merger --output package.json --pretty package.json temp.json
merge-json package.json temp.json
rm temp.json

# 8. Build and run basic example without any BokehJS
Expand Down

0 comments on commit fc05495

Please sign in to comment.