Skip to content
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

Distribute Fable packages too through npm? #1649

Closed
alfonsogarciacaro opened this issue Nov 21, 2018 · 7 comments
Closed

Distribute Fable packages too through npm? #1649

alfonsogarciacaro opened this issue Nov 21, 2018 · 7 comments

Comments

@alfonsogarciacaro
Copy link
Member

Fable 2.1 will be distributed through npm #1639, removing the need of calling a dotnet cli tool. At first, I thought the packages should still be distributed through Nuget for better compatibility with F# tooling but given that @ncave has published a JS version of the compiler (see for example #1648) and given that in the near future we may give users the possibility to switch between the dotnet or js versions of the compiler, I'm reconsidering the possibility of experimenting again with npm distribution for Fable libraries.

Differences with Fable 0.7

  • Libraries won't be precompiled, all sources will be compiled at first as it happens now
  • We should add a command to inject .dll references in the .fsproj file instead of forcing users to do so. For this, the compiler must scan the node_modules for Fable packages, so we need a way to mark them (possibly a file next to package.json).

Potential benefits

  • In Fable-only projects, users only need to deal with one package manager. This can be a good point for users coming from JS.
  • Fable packages could have npm dependencies (and install them automatically!)
  • We wouldn't need to copy sources from Nuget cache to a .fable folder to avoid Webpack module resolution issues.
  • Simplified publishing process? I find managing npm packages much easier than Nuget, but I guess it depends on the personal experience.

Potential problems

  • Users will need to remember to add the special command to inject .dll references in a "postinstall" script in their package.json
  • Touching the .fsproj is risky
  • Assembly reference issues?
  • npm may try to install package dependencies as sub dependencies as it happened with Fable 0.7. To avoid this, we'll have to use peerDependencies always (or can we create a crawler to detect these cases?), but this is cumbersome for the user as npm doesn't install peerDependencies automatically anymore.

Please give your feedback and other problems you may foresee. cc @ncave @MangelMaxime @Zaid-Ajaj @et1975 @forki @inosik

@alfonsogarciacaro alfonsogarciacaro changed the title Distribute Fable packages through npm too? Distribute Fable packages too through npm? Nov 21, 2018
@Nhowka
Copy link
Contributor

Nhowka commented Nov 21, 2018

Fable packages could have npm dependencies (and install them automatically!)

That one has potential to be awesome. Would it be fine to have both npm and nuget dependencies?

@et1975
Copy link
Member

et1975 commented Nov 21, 2018

Just saying...

Benefits < Problems + Differences

We still need to have dotnet installed, which comes with package management, so it's not like we're forcing people to install an extra tool.
I'm also not convinced that fable dependencies can have a good story with JS dependencies, peer or otherwise - I bet no specific Fable.React version represents any particular ReactJS 100% correctly, conversely I can use Preact instead, so is it really worth forcing this relationship?
Also these aren't the early days, there are probably hundreds if not thousands of projects, howtos and tutorials. Do you really want Fable ecosystem to look like the rest of JS, where you can't be sure of anything you find that's not days-fresh?
I still have npm packages I haven't migrated from pre-1.x days to nuget, and I can guarantee there will be even more fragmentation if you switch the method again.

@ncave
Copy link
Collaborator

ncave commented Nov 21, 2018

@alfonsogarciacaro First of all, by all means +1 for tooling stabilization and simple tooling story.

While it does sound interesting to be able to use different package managers, I'm not sure about updating the .fsproj, perhaps updating the paket.dependencies can work. But it could be a lot of maintenance cost to take on supporting another package manager, and perhaps @et1975 has a point there about the fragmentation.

@forki
Copy link
Collaborator

forki commented Nov 22, 2018

Regarding npm dependencies - if that's a serious concern, then we could also put meta data into the nupkgs and paket can add the npm package deps to the project. Then you only need to call yarn or npm after paket install. Just as another option.

@MangelMaxime
Copy link
Member

I think we should stay with dotnet dependencies because this is what the IDE knows and also paket & co are already doing an amazing job managing the deps for us.

Also as @et1975 said, we will have even more fragmentation. Another point, is that I don't think all the package have been migrated to Fable 2 by their authors so imagine if they had to move to npm ?

Regarding npm dependencies - if that's a serious concern

I think it can be for projects like Fulma for example. This is not mandory if in the documentation we mention which version of the JS lib is supported etc. but it can make people life easier I think. I so some people coming from .Net installing Fulma and saying it's not working because they didn't know they had to install Bulma too.

In Have langauge, when writing an extern we put a special macro in the binding like npm.Package.Require<"bcrypt","^3.0.2"> and then on the first execution if the macro doesn't find bcrypt in the packge.json it will had it.

So you can then, run npm install and yarn install and be ready to go.

I think this is similar to what @forki propose and I am more for this solution.

@forki
Copy link
Collaborator

forki commented Nov 22, 2018 via email

@alfonsogarciacaro
Copy link
Member Author

Thanks a lot for the feedback! You're right this move can bring a lot of confusion to users and authors for little benefit, I got a bit too excited 😅 Ok, let's close this issue and maybe open another one in Paket about the possibility of adding npm dependencies.

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

No branches or pull requests

6 participants