Fable.Package.SDK is a set of MSBuild targets and tasks that help you build and package Fable projects.
- Automatically add Fable specific tags to
PackageTags
based on theFablePackageType
property - Automatically include F# source files in the package if needed
- Check that at least one Fable target is defined in the
PackageTags
property - Set
GenerateDocumentationFile
totrue
- Set up your package for improving IDE experiences by setting:
DebugType
toembedded
EmbedUntrackedSources
totrue
dotnet add package Fable.Package.SDK
This will add the package to your project file.
<PackageReference Include="Fable.Package.SDK" Version="x.y.z" />
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
These rules are necessary to ensure that the package is not included in the final package, you don't want you package to depend on Fable.Package.SDK
at runtime.
# In your paket.dependencies
nuget Fable.Package.SDK copy_local: true
# In your paket.references
Fable.Package.SDK
Set the FablePackageType
property in your project file to one of the following values:
-
library
: If your package is a library that can be used by Fable.Examples of libraries could be Fable.Promise, Elmish, Thoth.Json, Feliz
This will include the source files in the package.
-
binding
: If your package consist of a set of API to make a native library availableFor example:
- A package which makes an NPM package API available
- A package which makes the Browser API available
- A package which makes a cargo package API available
Only the DLL will be included in the package, allowing for a faster build and smaller package size.
Choose one or more of the following tags:
fable-dart
: Dart is supported by the packagefable-dotnet
: .NET is supported by the packagefable-javascript
: JavaScript is supported by the packagefable-python
: Python is supported by the packagefable-rust
: Rust is supported by the packagefable-all
: Package is compatible with all Fable targets.
Warning
A package can be compatible with all targets if it depends only on packages that are also compatible with all targets.
A package compatible with all targets cannot be a binding, as these are target-specific.
Example:
If your package supports only JavaScript you need to use fable-javascript
If your package supports both JavaScript and Python, you need to use fable-javascript
and fable-python
If your package is a binding which target JavaScript you need to write:
<PropertyGroup>
<PackageTags>fable-javascript</PackageTags>
<FablePackageType>binding</FablePackageType>
</PropertyGroup>
If your package is a library which targets JavaScript and Python you need to write:
<PropertyGroup>
<PackageTags>fable-javascript;fable-python</PackageTags>
<FablePackageType>library</FablePackageType>
</PropertyGroup>