0.0.4 • Published 6 years ago
jsoo-is-sorted-esy v0.0.4
jsoo-is-sorted
js_of_ocaml bindings for is-sorted.
Just for personal learning and educational purposes. In real life, just use List.sort compare :)
Building vs bundling
For js_of_ocaml case, we use one tool for building and another for bundling:
- esy is used to gather the OCaml / ReasonML sources and all build tooling (OCaml compiler, Dune, etc).
- yarn (or npm) is used to gather the JavaScript dependencies from the bindings and also the bundling of resulting JS files.
Installation
As mentioned above, this is not intended to be used. But if it was to be added to an existing project,
it would need both esy.json and package.json.
- Run
yarn add jsoo-is-sorted. - Run
esy add jsoo-is-sorted-esy. - Add the library to your dune file:
(executable
(name App)
(libraries jsoo-is-sorted)
)Using it
let foo = IsSorted.isSorted [|20; 3; 124|]Or with Reason syntax:
let foo = IsSorted.isSorted([|20, 3, 124|]);Publishing
Due to esy not being able to read esy.json files
from published npm packages (this is to prevent downloading and unpacking all tarballs to do version resolution),
the bindings are distributed in two packages.
To publish:
- Make sure both
esy.jsonandpackage.jsonhave the same version - Run
npm publishnormally - Delete
package.json - Rename
esy.jsontopackage.json - Run
npm publishagain to publishjsoo-is-sorted-esy