Skip to content

Use the npm ocaml? #386

Closed
Closed

Description

@chenglou

We've put ocaml in a box: https://www.npmjs.com/package/ocaml

npm install ocaml will give you a small package.json that has a postinstall script which downloads the ocaml tgz and compile it. It's sandboxed, so deleting node_modules deletes that ocaml.

A really far-fetched idea, but hey, we'll need the sandboxed ocaml compiler in the future at some point!

Maybe related: #359

Activity

  1. bobzhang commented on May 19, 2016

    @bobzhang
    Member

    @chenglou , currently we already shipped the sandboxed ocaml compiler, so npm install -g bs-platform should just work(it will install the sandboxed ocaml & bs compiler), the opam is optional, does it not work for you?

  2. chenglou commented on May 23, 2016

    @chenglou
    MemberAuthor

    Seems like I misread the readme, sorry!

  3. chenglou commented on Jul 23, 2016

    @chenglou
    MemberAuthor

    cc @jordwalke

    @bobzhang any change to use npm-ml/ocaml? This'll allow npm-ml reason and bs to naturally share the same ocaml compiler, if the version matches.

  4. bobzhang commented on Jul 23, 2016

    @bobzhang
    Member

    @chenglou that would be cool if we can share the same compiler, is it possible for npm-ml to apply the patches bucklescript needed?
    Btw, I have some plans to make our patched compiler ABI compatible with vanilla OCaml compiler so that the merlin compiled with vanilla OCaml will still work with bsc.
    But it is always good to use the same compiler

  5. chenglou commented on Jul 23, 2016

    @chenglou
    MemberAuthor

    Ultimately, this allows us to declare compiler as a devDependency (!), without 99 recompiles since npm shares the same package.
    Somewhat related, we should learn from the js community's experience and expose artifacts that are sharable no matter what compiler version/build system you used. Might not be that realistic though.

    As for patching: @jordwalke probably has better ideas.

  6. bobzhang commented on Jul 25, 2016

    @bobzhang
    Member

    FYI, I just landed a change in master, so the merlin compiled with either vanilla OCaml 4.02.3 or our patched compiler should work fine with bucklescript.
    One thing I think about is when it reaches some maturity, npm install -g bs-platform is not a bad thing.
    I am not familiar with npm, but I found one solution is doable, user always does an npm link to link your local OCaml libraries to global scope, and when we install a new OCaml library, we can check if the dependencies match with the global version, if so, then do an npm link again to link the local back to current installed package, then it should work

  7. jordwalke commented on Jul 27, 2016

    @jordwalke

    Bob did you see the way I figured out how to host and install findlib libraries on NPM? It also provides a way to allow "temporarily global PATH" variables which are only augmenting the path with node_modules during the time of build.

  8. bobzhang commented on Jul 27, 2016

    @bobzhang
    Member

    Not yet, do you have a link ?

  9. jordwalke commented on Jul 27, 2016

    @jordwalke

    https://github.com/npm-ml/menhir

    That's an example of a findlib installed library that exports a path to binary by specifying so in its package.json. The OCaml compiler in NPM-ML is another example.

  10. bobzhang commented on Jul 27, 2016

    @bobzhang
    Member

    cool, I will try again tonight, is there any good book about npm?

  11. jordwalke commented on Jul 27, 2016

    @jordwalke

    I'm not aware of any books on npm, but the docs are pretty good. It's fairly simple. postinstall hooks are how you execute builds from source files distributed as npm packages.

  12. bobzhang commented on Aug 11, 2016

    @bobzhang
    Member

    we have to use our own compiler since some patches needed. Feel free to reopen if you want to use our patched compiler in npm-ml

  13. jordwalke commented on Aug 11, 2016

    @jordwalke

    Is the bucklescript repo representative of these patches?

  14. bobzhang commented on Aug 11, 2016

    @bobzhang
    Member

    @jordwalke we have a submodule which uses this https://github.com/bloomberg/ocaml/commits/master
    I think sharing the same compiler is no longer a high priority, since now bucklescript provides ABI compatibility with un-patched compiler, the cmi generated by buckle can be consumed by vanilla ocaml and vice versa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions