Some random thoughts on ReScript's own package manager

Hi all,

This idea has been on my radar for quite a while, I would like to share with you and gauge some interest. ReScript has very good interop with JS, so that it fits the JS ecosystem very well, for example, npm/yarn.

These days I found more and more dissatisfaction with node_modules black wholes. So I am wondering if we should spend some time on our own package manager and grow more pure rescript libraries.

I expect this would be a community effort, and we can adapt the compiler and build system to collaborate with the “package manager”.

What do you think?

4 Likes

I think it will be more complicated for new people who come from javascript to start using rescript.

Some questions:

  • Will it works with npm/yarn packages as well? Or it will be for rescript modules only?
  • What if I have an existing project with ts/js should I use both package managers :thinking:
1 Like

I’d be curious to hear what you see as the big potential wins of having a dedicated package manager. Maybe you could elaborate a bit on that?

5 Likes

I would rather see more volume of pure libraries and potentially a react alternative framework than a custom package system, if I were to vote on general community improvements.

2 Likes

If it can seamlessly have the safety guarantees that Elm provides with their std libs yet make existing npm modules super easy to use, I’ll try it.

But the fear/annoyance of constant rebuild and churn instead of building on top of the native JS world is real.

3 Likes

I feel like dependabot is successful purely because elm lost.

That’s a really interesting take.

I believe there’s room for everything. So I just see Elm as a naturally narrow path, irregardless of its package ecosystem.

The idea is to encoruage people to build pure rescript stack.

It is great that we can piggyback the existing libraries to get job done. In the long term, in my opinion, it will be more healthy to the community to build the tech on top of rescript itself, i.e, write libraries in rescript itself instead of creating bindings to js libraries.

Note this will never be mandated, but I think will benefit us in the long term

1 Like

Yes, it is the similar idea.

How do you move forward with this idea?

I think having a rescript dedicated package manager so that people who only rely on rescript libraries will have much better user experience without node_modules black holes, this will encourage people to write more and more pure rescript libraries, that’s my idea.

1 Like

One thought: a separate package manager might make it easier to integrate with non-node ecosystems such as deno.

1 Like

Given that probably 90% of the projects need npm anyway (if they use react for example), that would mean there are two package managers necessary to use ReScript. Even if the ReScript package manager is very user friendly, wouldn’t it in any case be less user friendly to have two package managers?

Also rewriting something like React in ReScript (team within facebook working full-time on it, millions of users), or something like Next.js (tens of millions of VC funding), or a GraphQL client such as Relay (full-time team at facebook), or Apollo (tens of millions of VC funding), or React-Native (full-time team at facebook) and that’s just scratching the surface.

For me it feels like that for this to become feasible we need a TypeScript level of market share (with major libraries already using ReScript) which is still many orders of magnitude away unfortunately.

2 Likes

Since there’s no consensus on this, I will mark it as closed to avoid distraction

5 Likes

Lots of great threads and discussion on features etc right now. Keep up the great work @Hongbo ! Very exciting to discuss these things even if consensus isn’t always reached immediately. Thanks for involving us!

3 Likes

TBH I would love if the rescript binary would just work as a wrapper. Because then it can at least automatically add the packages to bs-dependencies. I am however not sure if it is feasible if it would only install pure ReScript libraries, at least it should also be able to install all of the bindings libraries.

I know this is closed, but I think I am so important that I have to write my oppinion here (disclaimer, this is sarcasm and I am just joking about my importance…)

One of the reasons why I’m starting to pick rescript for some projects is that is, literally, as easy as installing any other node library, with my existing project tooling and even bundler. Super nice onboarding experience that I think will bring more people to rescript ecosystem than a nicer purely rescript experience.

Just my 2 cents.
If it were like a wrapper as someone suggested for me it will make more sense. Something that just uses yarn or npm under the hood but also just adds the libraries to your bsbconfig.json will be nice.

2 Likes