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

Use jq to merge json files #24

Merged
merged 1 commit into from
Feb 6, 2025
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
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