Skip to content

Fable support in dotnet sdk #584

@alfonsogarciacaro

Description

@alfonsogarciacaro

@enricosada

I'm opening this issue to follow the discussion here. It's interesting to keep a conversation using git commits but probably this is a better medium ;)

I'm trying to summarize the three main parts of the integration and the tasks we need to accomplish:

Project initialization

User just types dotnet new -t fable as for other dotnet projects. More templates for different Fable projects (React, etc) will be available in the future.

TODO: Will you create the template @enricosada?

Package restore

We'll try to make things easier for the user, but not replace/hide npm completely. There should be a command like dotnet fable install fable-powerpack that will install a package both in package.json and the .fsproj (with a <FableReference Include="Fable.Core" /> item).

TODO: Decide if the user should type fable-core (the npm package name) or Fable.Core (the F# project name).

TODO: Add the references to package.json and the .fsproj. I can add this capability to Fable but, @enricosada, do you know what's the best way to edit the .fsproj XML?

TODO: The <FableReference Include="Fable.Core" /> must be translated to a ./node_modules/fable-core/Fable.Core.dll (the tool should be also able to detect if package.json is in a parent dir). I guess @enricosada can do the MSBuild trickery, but I can write a script for path resolution if needed.

Building

User will type dotnet fable (or dotnet fable build, or dotnet build fable) and the project will be compiled normally.

TODO: MSBuild should generate a response file with the F# compiler arguments (@enricosada? 😉) and then call Fable with a reference to this file.


Other considerations

Right now it looks like Fable.Sdk and fable-compiler will be two different things. Fable.Sdk will only contain the Fable.targets, while fable-compiler remains an npm package. The main problem with this is it may be difficult to keep the versions in sync, so Fable.Sdk must pass the version to the compiler and warn the user if they differ. Probably Fable.Sdk should contain also the dotnet sdk tool that would redirect the dotnet fable calls to the locally installed fable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions