Module

x/vega_lite/scripts/build-examples.sh

A concise grammar of interactive graphics, built on Vega.
Latest
File
#!/usr/bin/env bash# script for npm run x-compile
set -eo pipefail
dir=${dir-"examples/compiled"}
echo "Compiling examples to $dir"
# Check if param is providedif [[ -z "$1" ]];then forcesvg=falseelse forcesvg=truefi
# record vega version and force rebuild SVG if version does not matchrm -f $dir/vega-versionecho "vega: `./scripts/version.sh vega`" > $dir/vega_versionif ! git diff --no-patch --exit-code $dir/vega_versionthen forcesvg=truefiexport forcesvg
nopatch='--no-patch'export nopatch
skipnormalize=falseexport skipnormalize
# Clean up outdated normalized vega-lite files and vega filesrm -f examples/specs/normalized/*_normalized.vl.jsonrm -f $dir/*.vg.json
# Re-compile all examplesecho "Using parallel to generate vega specs from examples in parallel."ls examples/specs/*.vl.json | parallel --env skipnormalize --env forcesvg --env nopatch --no-notice --plus --halt 1 "scripts/build-example.sh {/..}"
scripts/build-normalized-examples
# Clean up outdated svg and png files (This has to be done by checking files as we do not always regenerate svgs)ls examples/compiled/*.svg | parallel --no-notice --plus --halt 1 "[ -f examples/specs/{/..}.vl.json ] || rm -f examples/compiled/{/..}.svg"
ls examples/compiled/*.png | parallel --no-notice --plus --halt 1 "[ -f examples/specs/{/..}.vl.json ] || rm -f examples/compiled/{/..}.png"