-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make this project simpler #27
base: master
Are you sure you want to change the base?
Conversation
I think that toppkg generates an opam install file. Is that correct? Maybe ocamlfind is sufficient. |
I think topkg makes building an opam package much easier. cc: @tekknolagi who set this up. |
Cc @yunxing too |
@jordwalke There's an existent @bordoley I would love to know why. From looking at the difference with and without, topkg does nothing to help here. You can add opam deps in the EDIT: Indeed it seems like topkg generates a |
Crazy idea: Use package.json as the source of truth, and add a small js script that generates all the build artifacts for both bucklescript and native. |
So topkg generates both How important is it to allow releasing on opam for the example project? (Guess answer: pretty important because otherwise people can't share their library lol). My goal here is to avoid having to understand: ocamlfind (and META file), ocambuild, topkg (and topkg.ml and _tags), opam (and opam file, and .install file). Is there any way we can hide all that complexity? The two things users need to be able to do for now are to depend on opam things and publish to opam. Can we squish all the middle layers of abstractions to avoid having people learn that stuff? @bordoley Do you think we could generate everything from |
We can either build our own abstraction that squashes all the concepts or use an existing one. The only other tools I know if that do so are jBuilder and solvuu. |
topkg was used to simplify package generation and compile flow. It does generate META and .install files and allows the developer to specify a bunch of stuff in OCaml instead of arbitrary text files. It was the easiest solution that I found to packaging in my tenure as an intern -- though I only really spent a couple of days searching. |
and ocamlfind. I mean you do need them but for the user they're just calling `rebuild`.
I've updated this PR. This is now using opam_of_packagejson a small utility that converts a package.json into the different files that you'll need. It's pushed on opam and built to native. It has very good defaults so most newcomers won't need to fiddle with any options and it uses the standard npm options which facilitates integration into Reason projects who are already using npm (this does not depend on npm though). Immutable-re is currently using it to simplify its release flow. I'd like to emphasis that I think having so many technologies together here (ocamlbuild, topkg, opam, reason) is just too much for newcomers. With this PR we're eliminating a invasive dependency: topkg and gaining a trivial and noninvasive one opam_of_packagejson. If we use topkg here, we're forcing everyone to learn it. Opam_of_packagejson has good defaults, only acts during the release process, which is already made very tough because of opam (there are between 5 and 8 steps to release and if you miss any of them you gotta bump the version number) and works with the bsb-native flow (since it's not a build system merely a dumb tool). I'm hoping to tackle that problem next but I think this PR is a step forward in terms of reducing complexity. |
Are you committed to maintaining https://github.com/bsansouci/opam_of_packagejson as @dbuenzli is for topkg? |
Also it still requires people learn how to write and understand package.json. |
Don't know what is being discussed here. But for technical accuracy I would just like to point out that
Yes, make sure you understand the |
@tekknolagi Yes. opam_of_packagejson is a very manageably small script. I don't intend it to become as powerful as @dbuenzli's topkg either. I think there is a place for topkg but not in the starter environment. I can't imagine package.json being harder to understand than topkg's API. As @dbuenzli said you still need to understand the META file syntax, the topkg API and how opam works. @dbuenzli Sorry I'm not sure I understand in what way topkg is transitory. |
@bsansouci, How will this work now that reason project uses jbuilder? |
@bordoley It might still be cool to use |
@bordoley I'm not sure I understand your question. This is tangential from how reason's built. @jordwalke I think it's outside of the scope of opam_of_packagejson to relate to build system. The point is that it allows using a package.json to publish on opam. It doesn't concern itself with how you build. |
That sounds like a neat little utility. Lol because Andrey has pretty much built the reverse direction (opam to package.json!) I do agree that the same utility that converts from package.json to opam file could be a great place to perform the opam publish workflow. But there's more to that than just creating an opam file - it needs a lot of work to rival npm's publish workflow IMHO. |
I don't know about this workflow. If you used it, what do you think is missing on the |
@dbuenzli I've only used opam-publish. Opam-publish was confusing because it creates this separate small metadata package apart from the actual source release. But overall I think most of the issues are with opam's publish workflow, are related to opam's metadata system and publish workflow itself, and topkg wouldn't be any different right? There's no way a human can intervene with the publishing of an npm package, or prevent it from being merged. Granted, there's reasons why human review benefits a compiled language ecosystem - but at this point most of those benefits are becoming automated as well for opam. For npm it's just one command I'd like to see opam become that lightweight, but from discussions so far it seems like this isn't what opam wants to be. That's okay by me as well, as there's benefits to having a more closed "app store" type model to package management. Still, I would like to see the equivalent of npm but for opam packages. Perhaps it can even be npm! Having an open, instant release package management workflow and having a stable curation of packages aren't mutually exclusive. One is just a subset of the other. |
@jordwalke I agree that there is a lot to the npm publish workflow. Right now That means that all you would need is a @dbuenzli I don't know topkg enough to be able to tell you if anything's missing. What I can say is that writing a
So the reason I wrote opam_of_packagejson is because I want people to be able to just run one publish command and have their project published both on npm and opam. I could potentially generate a topkg ml file and run that but right now it was simpler to hardcode everything to get immutable-re working with it. It's very possible I'll come back begging to topkg though :p So maybe I could go extend opam_of_packagejson to also run the appropriate publishing commands that you'd have to run manually, so that we truly have a one |
Note that there are two problems here which should really not be confused.
I won't comment on 2. since personally have the impression that it's a better model in the long term for repository quality. Regarding 1. it is the reason I didn't use @bsansouci Sure |
Yeah, perhaps - it might be an undertaking though. Basically, I wish we can create a cli that is nearly indistinguishable from |
This PR aims at making this project simpler for newcomers to understand.
Before this we used make to run ocamlbuild which built a topkg.ml file which we invoked and than ran ocamlfind to finally build the user's source code.
I think most of that isn't needed, so I stripped it down to having the make command calling
rebuild
directly.I'm not sure why this project was setup the way it was, so please tell me if what I'm doing doesn't make sense. I'd love to skip learning topkg though ;)