Update js-sandbox README

This commit is contained in:
Andrew Bastin 2021-09-26 11:27:46 +05:30 committed by GitHub
parent 1aa94a12c0
commit e0f88e01f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,36 +15,35 @@
This package deals with providing a JavaScript sandbox for executing various security sensitive external scripts.
## Usage
Install the [npm package](https://www.npmjs.com/package/@hoppscotch/js-sandbox).
```
npm install --save @hoppscotch/js-sandbox
```
## How does this work?
This package makes use of [quickjs-empscripten](https://www.npmjs.com/package/quickjs-emscripten) for building sandboxes for running external code on Hoppscotch.
Currently implemented sandboxes:
- Hoppscotch Test Scripts
- Hoppscotch Pre Request Scripts
## Development
1. Clone the repository
```
git clone https://github.com/hoppscotch/hopp-js-sandbox
git clone https://github.com/hoppscotch/hoppscotch
```
2. Install the package dependencies
```
npm install
pnpm install
```
3. Try out the demo [`src/demo.ts`](https://github.com/hoppscotch/hopp-js-sandbox/blob/main/src/demo.ts) using:
3. Navigate to the [package folder](https://github.com/hoppscotch/hoppscotch/tree/main/packages/hoppscotch-js-sandbox)
```
cd hoppscotch/packages/hoppscotch-js-sandbox
```
4. Try out the demo [`src/demo.ts`](https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-js-sandbox/src/demo.ts) using:
```
npm run demo