diff --git a/README.md b/README.md index 355c8f97c..9f1b537a9 100644 --- a/README.md +++ b/README.md @@ -10,21 +10,26 @@ You can reset the Vega Editor by going to https://vega.github.io/editor/#/reset ## Usage Instructions -To run the editor locally, you must first install the dependencies and then launch a local web server. We assume you have [yarn](https://yarnpkg.com/) installed. +### Run Vega-Editor With Docker +```bash +sudo docker run -it --rm -p 1234:1234 node:21 bash -xc 'mkdir -p vega/editor && git clone --depth=1 https://github.com/vega/editor.git vega/editor && cd vega/editor && yarn && yarn start' +``` -1. Install the dependencies: +### Development Setup +We assume you have [yarn](https://yarnpkg.com/), `bash`, `curl`, and `tar` installed. -``` -$ yarn -``` +Your working copy of this git repository must be located at least two levels below the system root `/`. +E.g. `/home/user/editor` or `/vega/editor`, but not `/editor`. -2. Start the server: +Inside your working copy ... -``` -$ yarn start -``` +1. Install the dependencies: + `$ yarn` + +2. Launch the local web server: + `$ yarn start` -3. The local web server will be accessible from [http://localhost:8080](http://localhost:8080). +3. The local web server will be accessible via [http://localhost:1234](http://localhost:1234). ## Local Testing & Debugging diff --git a/scripts/vendor.sh b/scripts/vendor.sh index a1672259f..b2dc03823 100755 --- a/scripts/vendor.sh +++ b/scripts/vendor.sh @@ -4,37 +4,28 @@ set -e DATA=public/data SPEC=public/spec -SCHEMA=schema - -CWD=$(pwd) echo "Copying data to '$DATA'." - -if [ ! -d "$DATA" ]; then - mkdir $DATA -fi - -eval rsync -r "$CWD/node_modules/vega-datasets/data/*" $DATA +rm -rf "$DATA" +cp -R node_modules/vega-datasets/data/ "$DATA" echo "Copy examples to '$SPEC'." -if [ ! -d "$SPEC" ]; then - mkdir $SPEC -fi - # without v! VEGA_VERSION=$(scripts/version.sh vega) VEGA_LITE_VERSION=$(scripts/version.sh vega-lite) pushd /tmp -curl https://github.com/vega/vega/archive/refs/tags/v$VEGA_VERSION.tar.gz -L -o vega.tar.gz -curl https://github.com/vega/vega-lite/archive/refs/tags/v$VEGA_LITE_VERSION.tar.gz -L -o vl.tar.gz -tar xzf vega.tar.gz vega-$VEGA_VERSION/docs -tar xzf vl.tar.gz vega-lite-$VEGA_LITE_VERSION/examples vega-lite-$VEGA_LITE_VERSION/site/_data +curl "https://github.com/vega/vega/archive/refs/tags/v$VEGA_VERSION.tar.gz" -L -o vega.tar.gz +curl "https://github.com/vega/vega-lite/archive/refs/tags/v$VEGA_LITE_VERSION.tar.gz" -L -o vl.tar.gz +tar xzf vega.tar.gz "vega-$VEGA_VERSION/docs" +tar xzf vl.tar.gz "vega-lite-$VEGA_LITE_VERSION/examples" "vega-lite-$VEGA_LITE_VERSION/site/_data" popd -eval rsync -r "/tmp/vega-$VEGA_VERSION/docs/examples/*.vg.json" "$SPEC/vega" -eval rsync -r "/tmp/vega-lite-$VEGA_LITE_VERSION/examples/specs/*.vl.json" "$SPEC/vega-lite/" +rm -rf "$SPEC" +mkdir -p "$SPEC/vega" "$SPEC/vega-lite" +cp "/tmp/vega-$VEGA_VERSION/docs/examples/"*.vg.json "$SPEC/vega" +cp "/tmp/vega-lite-$VEGA_LITE_VERSION/examples/specs/"*.vl.json "$SPEC/vega-lite/" cp "/tmp/vega-lite-$VEGA_LITE_VERSION/site/_data/examples.json" "$SPEC/vega-lite/index.json" cp "/tmp/vega-$VEGA_VERSION/docs/_data/examples.json" "$SPEC/vega/index.json"