Skip to content

Commit 57dba51

Browse files
committed
chore: add tests + setup build process
1 parent f056b8b commit 57dba51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1892
-14
lines changed

.config/dotnet-tools.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"easybuild.commitlinter": {
6+
"version": "0.1.0",
7+
"commands": [
8+
"commit-linter"
9+
]
10+
},
11+
"fantomas": {
12+
"version": "6.3.7",
13+
"commands": [
14+
"fantomas"
15+
]
16+
},
17+
"husky": {
18+
"version": "0.6.5",
19+
"commands": [
20+
"husky"
21+
]
22+
}
23+
}
24+
}

.husky/commit-msg

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
## husky task runner examples -------------------
5+
## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky'
6+
7+
## run all tasks
8+
#husky run
9+
10+
### run all tasks with group: 'group-name'
11+
#husky run --group group-name
12+
13+
## run task with name: 'task-name'
14+
#husky run --name task-name
15+
16+
## pass hook arguments to task
17+
#husky run --args "$1" "$2"
18+
19+
## or put your custom commands -------------------
20+
#echo 'Husky.Net is awesome!'
21+
dotnet commit-linter "$1"

.husky/pre-commit

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
## husky task runner examples -------------------
5+
## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky'
6+
7+
## run all tasks
8+
#husky run
9+
10+
### run all tasks with group: 'group-name'
11+
#husky run --group group-name
12+
13+
## run task with name: 'task-name'
14+
#husky run --name task-name
15+
16+
## pass hook arguments to task
17+
#husky run --args "$1" "$2"
18+
19+
## or put your custom commands -------------------
20+
#echo 'Husky.Net is awesome!'
21+
22+
dotnet husky run --name fantomas-format-staged-files

.husky/task-runner.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"tasks": [
3+
{
4+
"name": "fantomas-format-staged-files",
5+
"group": "pre-commit",
6+
"command": "dotnet",
7+
"args": [
8+
"fantomas",
9+
"${staged}"
10+
],
11+
"include": [
12+
"src/**/*.fs",
13+
"src/**/*.fsx",
14+
"src/**/*.fsi",
15+
"test/**/*.fs",
16+
"test/**/*.fsx",
17+
"test/**/*.fsi"
18+
]
19+
}
20+
]
21+
}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Directory.Build.props

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<Project>
2+
<!-- Make F# support Central Package Management -->
3+
<PropertyGroup>
4+
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
5+
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
6+
</PropertyGroup>
7+
<!-- Use lock files -->
8+
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
9+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
10+
</PropertyGroup>
11+
<PropertyGroup>
12+
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
13+
<RestoreLockedMode Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</RestoreLockedMode>
14+
</PropertyGroup>
15+
<PropertyGroup>
16+
<PackageProjectUrl>https://github.com/antidote-org/Glutinum.Feliz.Victory</PackageProjectUrl>
17+
<Packagelicense>
18+
https://github.com/antidote-org/Glutinum.Feliz.Victory/blob/master/LICENSE.txt</Packagelicense>
19+
<RepositoryUrl>https://github.com/antidote-org/Glutinum.Feliz.Victory</RepositoryUrl>
20+
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
21+
<PackageReadmeFile>README.md</PackageReadmeFile>
22+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
23+
<Authors>Maxime Mangel</Authors>
24+
</PropertyGroup>
25+
<ItemGroup>
26+
<None Include="$(MSBuildThisFileDirectory)/LICENSE.txt" Pack="true"
27+
PackagePath="$(PackageLicenseFile)" />
28+
<None Include="$(MSBuildThisFileDirectory)\README.md" Pack="true" PackagePath="\" />
29+
</ItemGroup>
30+
<!-- Packages common to all the projects excepts build project -->
31+
<ItemGroup Condition="'$(PackageId)'!='EasyBuild'">
32+
<!-- Depends on the same version of FSharp.Core for all the projects -->
33+
<PackageReference Include="FSharp.Core" PrivateAssets="all" />
34+
</ItemGroup>
35+
</Project>

Directory.Packages.props

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<PackageVersion Include="EasyBuild.FileSystemProvider" Version="0.3.0" />
7+
<PackageVersion Include="FSharp.Core" Version="8.0.101" />
8+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
9+
<PackageVersion Include="NUnit" Version="4.1.0" />
10+
<PackageVersion Include="NUnit.Analyzers" Version="4.2.0">
11+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
12+
<PrivateAssets>all</PrivateAssets>
13+
</PackageVersion>
14+
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
15+
<PackageVersion Include="SimpleExec" Version="12.0.0" />
16+
</ItemGroup>
17+
</Project>

Fable.Package.SDK.sln

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31903.59
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "EasyBuild", "build\EasyBuild.fsproj", "{ECE38644-6F65-4AED-B8FD-5BCB79BC02AC}"
7+
EndProject
8+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fable.Package.SDK", "src\Fable.Package.SDK.fsproj", "{A0152FE0-D06E-4756-89A6-B46CD6CAB340}"
9+
EndProject
10+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fable.Package.SDK.Tests", "tests\Fable.Package.SDK.Tests.fsproj", "{40058B7F-25FC-424D-BA79-39E873B41535}"
11+
EndProject
12+
Global
13+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
14+
Debug|Any CPU = Debug|Any CPU
15+
Release|Any CPU = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(SolutionProperties) = preSolution
18+
HideSolutionNode = FALSE
19+
EndGlobalSection
20+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
21+
{ECE38644-6F65-4AED-B8FD-5BCB79BC02AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22+
{ECE38644-6F65-4AED-B8FD-5BCB79BC02AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
23+
{ECE38644-6F65-4AED-B8FD-5BCB79BC02AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
24+
{ECE38644-6F65-4AED-B8FD-5BCB79BC02AC}.Release|Any CPU.Build.0 = Release|Any CPU
25+
{A0152FE0-D06E-4756-89A6-B46CD6CAB340}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26+
{A0152FE0-D06E-4756-89A6-B46CD6CAB340}.Debug|Any CPU.Build.0 = Debug|Any CPU
27+
{A0152FE0-D06E-4756-89A6-B46CD6CAB340}.Release|Any CPU.ActiveCfg = Release|Any CPU
28+
{A0152FE0-D06E-4756-89A6-B46CD6CAB340}.Release|Any CPU.Build.0 = Release|Any CPU
29+
{40058B7F-25FC-424D-BA79-39E873B41535}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30+
{40058B7F-25FC-424D-BA79-39E873B41535}.Debug|Any CPU.Build.0 = Debug|Any CPU
31+
{40058B7F-25FC-424D-BA79-39E873B41535}.Release|Any CPU.ActiveCfg = Release|Any CPU
32+
{40058B7F-25FC-424D-BA79-39E873B41535}.Release|Any CPU.Build.0 = Release|Any CPU
33+
EndGlobalSection
34+
EndGlobal

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) [2024] [Mangel Maxime]
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,85 @@
11
# Fable.Package.SDK
2+
3+
Fable.Package.SDK is a set of MSBuild targets and tasks that help you build and package Fable projects.
4+
5+
## Features 🚀
6+
7+
- Automatically add Fable specific tags to `PackageTags` based on the `FablePackageType` property
8+
- Automatically include F# source files in the package if needed
9+
- Check that at least one Fable target is defined in the `PackageTags` property
10+
- Set `GenerateDocumentationFile` to `true`
11+
- Set up your package for improving IDE experiences by setting:
12+
- `DebugType` to `embedded`
13+
- `EmbedUntrackedSources` to `true`
14+
15+
## Installation
16+
17+
```bash
18+
dotnet add package Fable.Package.SDK
19+
```
20+
21+
## Usage
22+
23+
### 1. Set the `FablePackageType` property
24+
25+
Set the `FablePackageType` property in your project file to one of the following values:
26+
27+
- `library`: If your package is a library that can be used by Fable.
28+
29+
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/)
30+
31+
> [!NOTE]
32+
> This will include the source files in the package.
33+
34+
- `binding`: If your package consist of a set of API to make a native library available
35+
36+
For example:
37+
38+
- A package which makes an NPM package API available
39+
- A package which makes the Browser API available
40+
- A package which makes a cargo package API available
41+
42+
> [!NOTE]
43+
> Only the DLL will be included in the package, allowing for a faster build and smaller package size.
44+
45+
### 2. Specify the targets
46+
47+
Choose one or more of the following tags:
48+
49+
- `fable-dart`: Dart is supported by the package
50+
- `fable-dotnet`: .NET is supported by the package
51+
- `fable-javascript`: JavaScript is supported by the package
52+
- `fable-python`: Python is supported by the package
53+
- `fable-rust`: Rust is supported by the package
54+
- `fable-all`: Package is compatible with all Fable targets.
55+
56+
> [!WARNING]
57+
> A package can be compatible with all targets if it depends only on packages that are also compatible with all targets.
58+
>
59+
> A package compatible with all targets cannot be a binding, as these are target-specific.
60+
61+
Example:
62+
63+
If your package supports only JavaScript you need to use `fable-javascript`
64+
65+
If your package supports both JavaScript and Python, you need to use `fable-javascript` and `fable-python`
66+
67+
### Example of use case
68+
69+
If your package is a binding which target JavaScript you need to write:
70+
71+
```xml
72+
<PropertyGroup>
73+
<PackageTags>fable-javascript</PackageTags>
74+
<FablePackageType>binding</FablePackageType>
75+
</PropertyGroup>
76+
```
77+
78+
If your package is a library which targets JavaScript and Python you need to write:
79+
80+
```xml
81+
<PropertyGroup>
82+
<PackageTags>fable-javascript;fable-python</PackageTags>
83+
<FablePackageType>library</FablePackageType>
84+
</PropertyGroup>
85+
```

0 commit comments

Comments
 (0)