Skip to content

Commit f30466b

Browse files
author
Maxime Mangel
authored
Merge pull request #184 from baronfel/patch-1
Add more general suggestions for fable packages
2 parents b2e1c56 + 81079fc commit f30466b

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

docs/docs/your-fable-project/author-a-fable-library.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ To write a library that can be used in Fable you need to fulfill a few condition
2222
```xml
2323
<!-- Add source files to "fable" folder in Nuget package -->
2424
<ItemGroup>
25-
<Content Include="*.fsproj; **\*.fs; **\*.fsi" PackagePath="fable\" />
25+
<!-- Include all files that are compiled with this project -->
26+
<Content Include="@(Compile)" Pack="true" PackagePath="fable/%(RelativeDir)%(Filename)%(Extension)" />
27+
<!-- Include the project file itself as well -->
28+
<Content Include="$(MSBuildThisFileFullPath)" Pack="true" PackagePath="fable/" />
2629
</ItemGroup>
2730
```
2831

@@ -32,7 +35,8 @@ To write a library that can be used in Fable you need to fulfill a few condition
3235

3336
```xml
3437
<ItemGroup>
35-
<Content Include="*.fsproj; *.fs; *.js" Exclude="**\*.fs.js" PackagePath="fable\" />
38+
<!-- Your F# code is already included because of the previous rules, so you only need to ensure the .js files are included as well -->
39+
<Content Include="**/*.js" Exclude="**\*.fs.js" PackagePath="fable/%(RelativeDir)%(Filename)%(Extension)" />
3640
</ItemGroup>
3741
```
3842

@@ -42,6 +46,21 @@ To write a library that can be used in Fable you need to fulfill a few condition
4246

4347
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).
4448

49+
## Make your package usable by others
50+
51+
In addition to the source files, there are a few things you should do to make your package easier to consume by others. Adding these items will improve the development experience for your users inside their editors,
52+
specifically enabling Go To Definition (F12 in most editors) to work on your library's code.
53+
54+
```xml
55+
<PropertyGroup>
56+
<!-- Ensure debugging information is easily found, so that editors can locate the source code locations for your library.
57+
This slightly increases the size of your package, but the usability benefits are worth it. -->
58+
<DebugType>embedded</DebugType>
59+
<!-- Ensure that files that are generated during the build by the .NET SDK are also included in your compiled library. -->
60+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
61+
</PropertyGroup>
62+
```
63+
4564
## Make your package discoverable
4665

4766
[Fable.Packages](https://fable.io/packages/) is a tool making it easy for users to search for Fable packages.

0 commit comments

Comments
 (0)