You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/your-fable-project/author-a-fable-library.md
+86-2Lines changed: 86 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,9 @@ title: Author a Fable library
3
3
layout: standard
4
4
---
5
5
6
-
To write a library that can be used in Fable you only need to fulfill a few conditions:
6
+
## Requirements
7
+
8
+
To write a library that can be used in Fable you need to fulfill a few conditions:
7
9
8
10
- Don't use FSharp.Core/BCL APIs that are not [compatible with Fable](../dotnet/compatibility.html).
9
11
- Keep a simple `.fsproj` file: don't use MSBuild conditions or similar.
@@ -18,7 +20,89 @@ The last point may sound complicated but it's only a matter of adding a couple o
18
20
</ItemGroup>
19
21
```
20
22
21
-
That's all it takes to make your library compatible with Fable! In order to publish the package to Nuget check [the Microsoft documentation](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package-using-the-dotnet-cli) or alternatively you can also [use Fake](https://fake.build/dotnet-nuget.html#Creating-NuGet-packages).
23
+
In order to publish the package to Nuget check [the Microsoft documentation](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package-using-the-dotnet-cli) or alternatively you can also [use Fake](https://fake.build/dotnet-nuget.html#Creating-NuGet-packages).
24
+
25
+
## Make your package discoverable
26
+
27
+
[Fable.Packages](https://fable.io/packages/) is a tool making it easy for users to search for Fable packages.
28
+
29
+
To make your packages listed on Fable.Packages, you need to add some tags to your `.fsproj`.
30
+
31
+
<ulclass="textual-steps">
32
+
33
+
<li>
34
+
35
+
**All Fable** packages must have the `fable` tag.
36
+
37
+
</li>
38
+
39
+
<li>
40
+
41
+
Specify what kind of package you are publishing.
42
+
43
+
A fable package can be one of the following:
44
+
45
+
-`fable-library`: A library that can be used in Fable
46
+
47
+
Examples of libraries could be [Fable.Promise](https://github.com/fable-compiler/fable-promise/), [Elmish](https://elmish.github.io/), [Thoth.Json](https://thoth-org.github.io//Thoth.Json/), [Feliz](https://zaid-ajaj.github.io/Feliz/)
48
+
49
+
<div></div> <!-- Force a space to improve visual -->
50
+
51
+
-`fable-binding`: The package consist of a set of API to make a native library available
52
+
53
+
For example:
54
+
55
+
- A package which makes an NPM package API available
56
+
- A package which makes the Browser API available
57
+
- A package which makes a cargo package API available
58
+
59
+
</li>
60
+
61
+
<li>
62
+
63
+
Specify which targets are supported by your package.
64
+
65
+
Choose one or more of the following tags:
66
+
67
+
-`fable-dart`: Dart is supported by the package
68
+
-`fable-dotnet`: .NET is supported by the package
69
+
-`fable-javascript`: JavaScript is supported by the package
70
+
-`fable-python`: Python is supported by the package
71
+
-`fable-rust`: Rust is supported by the package
72
+
-`fable-all`: Package is compatible with all Fable targets.
73
+
74
+
:::warning
75
+
A package can be compatible with all targets if it depends only on packages that are also compatible with all targets.
76
+
77
+
A package compatible with all targets cannot be a binding, as these are target-specific.
78
+
:::
79
+
80
+
Example:
81
+
82
+
If your package supports only JavaScript you need to use `fable-javascript`
83
+
84
+
If your package supports both JavaScript and Python, you need to use `fable-javascript` and `fable-python`
85
+
86
+
</li>
87
+
88
+
</ul>
89
+
90
+
Examples:
91
+
92
+
If your package is a binding which target JavaScript you need to write:
0 commit comments