Skip to content

Commit

Permalink
Better usage instructions and less build requirements (rm+cp instead …
Browse files Browse the repository at this point in the history
…of rsync) (#1444)

* remove build requirement `rsync` and mention other requirements in readme

* fix and extend usage instructions
  • Loading branch information
schaetzc authored Sep 19, 2024
1 parent 691d619 commit 1484a09
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 29 deletions.
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
29 changes: 10 additions & 19 deletions scripts/vendor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 1484a09

Please sign in to comment.