Skip to content

Commit 32761d3

Browse files
authored
Move partiql-playground to Node.js (#177)
* Move partiql-playground to Node.js This is the first PR as part of a series of PR to new features in PartiQL Playground: This PR includes the following: - Moves the PartiQL Playground to a Node.js project. This allows using the Node features within the project, such as having a server side listerner instead of an arbitrary web-server. - Removes the `ace-builds` sub-modules as an action from previous reviews. TODO: [x] Node.js server listener [x] Remove `ace-builds` submodule. [] Containerization [] Client side URL export [] AST Graph pan and zooming bugfix
1 parent fa340de commit 32761d3

19 files changed

+1146
-13
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ CMakeCache.txt
193193
CMakeFiles
194194
CMakeScripts
195195
Testing
196-
Makefile
197196
cmake_install.cmake
198197
install_manifest.txt
199198
compile_commands.json

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[submodule "partiql-conformance-tests/partiql-tests"]
22
path = partiql-conformance-tests/partiql-tests
33
url = https://github.com/partiql/partiql-tests.git
4-
[submodule "partiql-playground/ace-builds"]
5-
path = partiql-playground/ace-builds
4+
[submodule "partiql-playground/src/ace-builds"]
5+
path = partiql-playground/src/ace-builds
66
url = https://github.com/ajaxorg/ace-builds.git

partiql-playground/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build:
2+
wasm-pack --version && \
3+
wasm-pack build --target web --out-dir pkg-web/ && \
4+
wasm-pack build --target nodejs --out-dir pkg-node/ && \
5+
npm i

partiql-playground/README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,35 @@ _Please note, at this stage the code within this package is considered experimen
77
## Local Usage
88
For local usage follow the below steps.
99

10-
1. Pull down the `partiql-rust` package from GitHub:
10+
1. Ensure `wasm-pack` is installed on your machine by running the following command; if not, install it from [here](https://rustwasm.github.io/wasm-pack/installer/):
11+
```bash
12+
wasm-pack --version
13+
# Sample output
14+
wasm-pack 0.10.2
15+
```
16+
2. Ensure `npm` is intalled on your machine; see [here](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) for more details:
17+
```bash
18+
npm --version
19+
# Sample output
20+
8.13.2
21+
```
22+
3. Pull down the `partiql-lang-rust` repository from GitHub:
1123
```bash
1224
git clone --recursive https://github.com/partiql/partiql-lang-rust.git
1325
```
14-
2. Enter the `partiql-playground` root directory:
26+
3. Enter the `partiql-playground` root directory:
1527
```bash
1628
cd partiql-lang-rust/partiql-playground
1729
```
18-
3. Build the WASM package:
30+
4. Run `make`:
1931
```
20-
wasm-pack build --target web
32+
make
2133
```
22-
4. Start a webserver from the root directory, as an example, you can use [Python's SimpleHTTPServer](https://docs.python.org/3.8/library/http.server.html#http.server.SimpleHTTPRequestHandler):
34+
5. Start the node server from `partiql-playground` package's root directory:
2335
```bash
24-
python3 -m http.server
36+
node src/server.ts
2537
```
26-
4. On your browser go to `http://localhost:8000/`
38+
6. your browser go to `http://localhost:8000/`
2739

2840
## Development
2941
`PartiQL Playground` uses [WebAssembly (Wasm)](https://webassembly.org/) for integrating the front-end with PartiQL Rust back-end.
@@ -43,6 +55,7 @@ _Please note, as the package is experimental at this stage, all HTML code and as
4355
| [bootstrap](https://getbootstrap.com/) | [MIT License](https://github.com/twbs/bootstrap/blob/main/LICENSE) |
4456
| [D3.js](https://d3js.org/) | [ISC License](https://github.com/d3/d3/blob/main/LICENSE) |
4557
| [jquery](https://jquery.com) | [MIT License](https://github.com/jquery/jquery/blob/main/LICENSE.txt) |
46-
| [jquery.json-viewer](https://www.npmjs.com/package/jquery.json-viewer) | [MIT License](https://github.com/abodelot/jquery.json-viewer/blob/master/LICENSE) |
58+
| [jquery.json-viewer](https://www.npmjs.com/package/jquery.json-viewer) | [MIT License](https://github.com/abodelot/jquery.json-viewer/blob/master/LICENSE) |
59+
| [node](https://nodejs.org/en/) | [MIT License](https://github.com/nodejs/node/blob/main/LICENSE) |
4760
| [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen) | [Apache License Version 2.0](https://github.com/rustwasm/wasm-bindgen/blob/main/LICENSE-APACHE) |
4861
| [wasm-pack](https://github.com/rustwasm/wasm-pack) | [Apache License Version 2.0](https://github.com/rustwasm/wasm-pack/blob/master/LICENSE-APACHE) |

partiql-playground/ace-builds

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)