Fable support
See original GitHub issueRelated: https://github.com/fable-compiler/Fable/issues/856
I’ve been thinking about how we could use Paket for Fable dependencies. In 1.0 cycle, Fable libraries directly distribute their source code and it’s the final user who takes care of compiling all the files (and bundle them) in order to get a better control of the whole compilation. The final user references libraries as project references.
There are two main things to consider here:
Distributing the packages and version management
After considering this, I think the easiest thing to do would be to just move Fable packages to Nuget (they’re currently in npm), so downloading, version management, etc. is automatically handled by Paket. Fable lib authors would just have to make sure that the sources of their projects are distributed as content in their Nuget packages.
Reference Fable libs from user project
This is currently done by following the convention that Fable libs must have a single .fsproj in the root folder which users reference as <ProjectReference Include="path/to/node_modules/package-name/Project.Name.fsproj" />
. This more or less works but the ugliest part is how to resolve the references among Fable dependencies, as the paths differ from lib development and when being consumed by the final user. At the moment this is solved by using a hard-coded condition that detects if the .fsproj file is in node_modules folder or not, if so it assumes other dependencies are on the same level.
An alternative way would be to make Paket create an artificial .fsproj
file in the obj
folder containing all the files from the dependency projects and reference it from the user project. I think @enricosada suggested something like this. The main trick is to create the whole dependency graph to order the files properly. Fable itself follows a similar strategy as it collects all files from referenced projects before sending them to FCS.
Thoughts?
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (9 by maintainers)
Top GitHub Comments
they are now ordered so that a package down in the list only references packages above itself (similar to what we do with fs files in a fsproj).
Crazy thinking:
What about adding a frontend to
npm
intopaket
to stay innpm
ecosystem as @forki is suggesting time and time again?So having something like
fablegroup
where you can addnpm
packages. Resolving and installing vianpm
and adding some fable specific logic on top?