Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jchavarri/bs-playground-bundler
Create browser playground embeddable files from BuckleScript compilation cmi/cmj artifacts
https://github.com/jchavarri/bs-playground-bundler
bucklescript ocaml reasonml
Last synced: 24 days ago
JSON representation
Create browser playground embeddable files from BuckleScript compilation cmi/cmj artifacts
- Host: GitHub
- URL: https://github.com/jchavarri/bs-playground-bundler
- Owner: jchavarri
- License: mit
- Created: 2019-12-14T12:38:45.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-16T22:38:10.000Z (about 5 years ago)
- Last Synced: 2024-12-14T20:46:50.454Z (27 days ago)
- Topics: bucklescript, ocaml, reasonml
- Language: Reason
- Size: 38.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# bs-playground-bundler
![](https://github.com/jchavarri/bs-playground-bundler/workflows/bsembed%20pipeline/badge.svg)
Create browser playground embeddable files from BuckleScript compilation cmi/cmj artifacts.
It includes one binary `bsembed` that can be called with `npx bsembed` or
`yarn run bsembed`.## Install
```
yarn add -D @jchavarri/bs-playground-bundler
```or:
```
npm install --save-dev @jchavarri/bs-playground-bundler
```Now you can run `yarn run bsembed -o path/to/embeddedlibs.js` or add
`bsembed -o path/to/embeddedlibs.js` to `package.json` scripts.## Configuring
`bsembed` works by checking the key `bsembed` in `package.json`. This key should
contain the name of the node modules that we want to embed in the playground.E.g.:
```json
"bsembed": [
"reason-react",
"@glennsl/bs-json"
],
````bsembed` will check `node_modules` to look for these modules folders, trying to
gather all `*.cmi` and `*.cmj` files from `/lib/bs`.`bsembed` takes a param `-o path/to/embeddedlibs.js` to indicate where the
resulting file should be added.After that, just include this file into the playground web page. Note that the
resulting code assumes that `ocaml.load_modules` is available in the global
namespace, so it is required to load BuckleScript's playground "core" JavaScript
exported file before `bsembed` resulting file.## Contributing
See [./CONTRIBUTING.md](CONTRIBUTING.md).