Fable 1.0 beta has been out in the wild for several weeks now and the community has already provided very valuable feedback. Some people are concerned about the mix of .NET and JS tools, as it can be a bit confusing if you are used to a single ecosystem. This is actually a good thing(TM), because the effort you put to learn about dotnet SDK or Webpack is not exclusive to Fable, and can be reused for other .NET/JS projects. There are already big communities where you can get support from if you have an issue with the tooling as well.
However it's true there were some friction points we had to fix. The main one concerned Fable libraries: by nature they belong to the .NET ecosystem, but their destiny is to be converted to JS and must be distributed by source (Fable cannot read assemblies, only raw F# code), something Nuget (the register for .NET libraries) is not designed for. Because of these reasons, we've been distributing libraries through npm so far, though this wasn't ideal either as npm obviously is not prepared for F# packages and it was creating other problems on its own.
We wanted to move libraries back to the .NET side of things, but Fable still needed some collaboration from the package manager to locate the packages and know the dependency order, something Nuget cannot offer. Also, Fable community was very concerned about the need of lock files to ensure reproducible builds of the samples and templates in all machines. Enter Paket, a package manager that has been around for a long time and it's the choice of trust for most F# projects (and also many C# ones). Its author, Steffen Forkmann, is also a great Fable supporter and user and he's been really fast to implement the features needed by Fable. Thanks to this I'm happy to announce Fable now comes with Paket integration, and the best thing is you may not even notice! Paket is also integrated with the dotnet SDK: you only need to run
dotnet restore to download your packages (if you need to add or update dependencies, you can do it normally as with other Paket projects).
Fable simple (
Fable.Template) and Elmish (
Fable.Template.Elmish.React) templates have been updated to use Paket, download or update them to start enjoying reproducible builds and sane dependency management!
dotnet new -i Fable.Template::* dotnet new fable -n MyProject
Fable libraries will managed by Paket from now on, but we still need development tools like Webpack and other JS libraries from npm. Although not a strict requirement, yarn will be now the tool of choice for Fable samples and templates to manage JS packages, as it provides similar guarantees for reproducible builds as Paket thanks to the use of lock files.
Please note that, unlike Paket, yarn requires a global installation in your system. Check their website for details.
To enable Fable to use a NuGet library, the F# source code and the F# project file have to be included in the Nuget Package in a folder named
fable within the package. This may sound complicated but it's only a matter of adding a couple of lines to your project file and let the
dotnet pack command do all the job :). (In earlier versions the package name had to start with
Fable. but this is no longer required)
With Paket integration, the workflow for Fable 1.0 is basically done and we are now ready to publish the stable release very soon after fixing last issues and updating the documentation. But remember you can already use Fable 1.0 for your projects just by downloading the templates and creating a new project with them.
And remember: FableConf is approaching, get your ticket before it's too late!