Skip to content

Commit

Permalink
inital commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Forkmann committed Nov 29, 2024
0 parents commit e3ad4d6
Show file tree
Hide file tree
Showing 52 changed files with 10,599 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
34 changes: 34 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"version": 1,
"isRoot": true,
"tools": {
"paket": {
"version": "9.0.0",
"commands": [
"paket"
],
"rollForward": false
},
"fable": {
"version": "4.23.0",
"commands": [
"fable"
],
"rollForward": false
},
"fantomas": {
"version": "6.3.15",
"commands": [
"fantomas"
],
"rollForward": false
},
"fake-cli": {
"version": "6.1.3",
"commands": [
"fake"
],
"rollForward": false
}
}
}
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[*]
indent_style = space
indent_size = 4
insert_final_newline = true

fsharp_multiline_bracket_style = stroustrup
49 changes: 49 additions & 0 deletions .github/workflows/Docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Docs

on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- 'src/Docs/**'
- '.github/workflows/Docs.yml'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2

- name: Setup .NET 7 SDK
uses: actions/setup-dotnet@v1.7.2
with:
dotnet-version: 8.0.101

- name: Install Tools
run: dotnet tool restore

- name: Build
run: dotnet run -- PublishDocs

- name: Publish Docs
uses: actions/upload-artifact@v2
with:
name: docs
path: publish/docs

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download app artifact
uses: actions/download-artifact@v2.0.5
with:
name: docs
path: docs
- name: Deploy
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs
CLEAN: true
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.fable/
.fable-build/
*.fs.js
.fake/
.farmer/
.idea/
.cache/
.parcel-cache/
.ionide/
dist/
.vs/
deploy/
obj/
bin/
packages/
paket-files/
node_modules/
release.cmd
release.sh
*.orig
*.DotSettings.user
src/Docs/output/
src/Client/output/
tests/Client/output/
tests/Client/*.js
565 changes: 565 additions & 0 deletions .paket/Paket.Restore.targets

Large diffs are not rendered by default.

247 changes: 247 additions & 0 deletions Build.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
open System
open System.IO
open Fake.Core
open Fake.DotNet
open Fake.Core.TargetOperators
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.IO.Globbing.Operators
open Fake.Tools
open Helpers
let execContext = Context.FakeExecutionContext.Create false "build.fsx" [ ]
Context.setExecutionContext (Context.RuntimeContext.Fake execContext)

let sharedPath = Path.getFullName "src/Shared"
let serverPath = Path.getFullName "src/Server"
let clientPath = Path.getFullName "src/Client"
let deployDir = Path.getFullName "deploy"
let sharedTestsPath = Path.getFullName "tests/Shared"
let serverTestsPath = Path.getFullName "tests/Server"
let buildDir = "./build/"

// --------------------------------------------------------------------------------------
// Information about the project to be used at NuGet and in AssemblyInfo files
// --------------------------------------------------------------------------------------

let release = ReleaseNotes.load "RELEASE_NOTES.md"


// Git configuration (used for publishing documentation in gh-pages branch)
// The profile where the project is posted
let gitHome = "https://github"
// The name of the project on GitHub
let gitName = "Feliz.ReactJoyride"

// The name of the project
// (used by attributes in AssemblyInfo, name of a NuGet package and directory in 'src')
let project = "Feliz.ReactJoyride"

let projectUrl = sprintf "%s/%s" gitHome gitName

// Short summary of the project
// (used as description in AssemblyInfo and as a short summary for NuGet package)
let summary = "Feliz React Binding for react-joyride"

let copyright = "Copyright \169 2022"
let iconUrl = "https://raw.githubusercontent.com/tforkmann/Feliz.ReactJoyride/main/Feliz.ReactJoyride_logo.png"
let licenceUrl = "https://github.com/tforkmann/Feliz.ReactJoyride/blob/master/LICENSE.md"
let configuration = DotNet.BuildConfiguration.Release

// Longer description of the project
// (used as a description for NuGet package; line breaks are automatically cleaned up)
let description = """Feliz binding for react-joyride."""
// List of author names (for NuGet package)
let authors = [ "Tim Forkmann"]
let owner = "tForkmann"
// Tags for your project (for NuGet package)
let tags = "fsharp;fable;react-joyride;feliz;react;joyride"


Target.create "Clean" (fun _ ->
!!"src/**/bin"
|> Shell.cleanDirs
!! "src/**/obj/*.nuspec"
|> Shell.cleanDirs

Shell.cleanDirs [buildDir; "temp"; "docs/output"; deployDir;]
run dotnet "fable clean --yes" clientPath // Delete *.fs.js files created by Fable
)

Target.create
"UpdateTools"
(fun _ ->
run dotnet "tool update fable" __SOURCE_DIRECTORY__
run dotnet "tool update fantomas" __SOURCE_DIRECTORY__
run dotnet "tool update fake-cli" __SOURCE_DIRECTORY__
run dotnet "tool update paket" __SOURCE_DIRECTORY__

)

Target.create "InstallClient" (fun _ -> run npm "install" ".")

Target.create "Run" (fun _ ->
[ "client", npm "start" "." ]
|> runParallel

)

Target.create "RunTests" (fun _ ->
run dotnet "build" sharedTestsPath
[ "server", dotnet "watch run" serverTestsPath
"client", npm "run test:live" "." ]
|> runParallel
)


Target.create
"ExecuteTests"
(fun _ ->
Environment.setEnvironVar "status" "Development"

run dotnet "build" sharedTestsPath

[ "server", dotnet "run" serverTestsPath
"client", npm "run test:build" "." ]
|> runParallel)

Target.create "Format" (fun _ ->
run dotnet "fantomas . -r" "src"
)

// --------------------------------------------------------------------------------------
// Build a NuGet package

Target.create "Build" (fun _ ->
!! "src/*.fsproj"
|> Seq.iter (fun s ->
let dir = Path.GetDirectoryName s
DotNet.build id dir)
)


Target.create "PrepareRelease" (fun _ ->
Git.Branches.checkout "" false "main"
Git.CommandHelper.directRunGitCommand "" "fetch origin" |> ignore
Git.CommandHelper.directRunGitCommand "" "fetch origin --tags" |> ignore

Git.Staging.stageAll ""
Git.Commit.exec "" (sprintf "Bumping version to %O" release.NugetVersion)
Git.Branches.pushBranch "" "origin" "main"

let tagName = string release.NugetVersion
Git.Branches.tag "" tagName
Git.Branches.pushTag "" "origin" tagName
)


Target.create "Pack" (fun _ ->
let nugetVersion = release.NugetVersion

let pack project =
let projectPath = sprintf "src/%s/%s.fsproj" project project
let args =
let defaultArgs = MSBuild.CliArguments.Create()
{ defaultArgs with
Properties = [
"Title", project
"PackageVersion", nugetVersion
"Authors", (String.Join(" ", authors))
"Owners", owner
"PackageRequireLicenseAcceptance", "false"
"Description", description
"Summary", summary
"PackageReleaseNotes", ((String.toLines release.Notes).Replace(",",""))
"Copyright", copyright
"PackageTags", tags
"PackageProjectUrl", projectUrl
"PackageIconUrl", iconUrl
"PackageLicenseUrl", licenceUrl
] }

DotNet.pack (fun p ->
{ p with
NoBuild = false
Configuration = configuration
OutputPath = Some "build"
MSBuildParams = args
}) projectPath

pack "Feliz.ReactJoyride"
)

let getBuildParam = Environment.environVar
let isNullOrWhiteSpace = String.IsNullOrWhiteSpace

// Workaround for https://github.com/fsharp/FAKE/issues/2242
let pushPackage _ =
let nugetCmd fileName key = sprintf "nuget push %s -k %s -s nuget.org" fileName key
let key =
//Environment.environVarOrFail "nugetKey"
match getBuildParam "nugetkey" with
| s when not (isNullOrWhiteSpace s) -> s
| _ -> UserInput.getUserPassword "NuGet Key: "
IO.Directory.GetFiles(buildDir, "*.nupkg", SearchOption.TopDirectoryOnly)
|> Seq.map Path.GetFileName
|> Seq.iter (fun fileName ->
Trace.tracef "fileName %s" fileName
let cmd = nugetCmd fileName key
run dotnet cmd buildDir)
Target.create "Push" (fun _ -> pushPackage [] )

let docsSrcPath = Path.getFullName "./src/Docs"
let docsDeployPath = "docs"

Target.create "InstallDocs" (fun _ ->

run npm "install --frozen-lockfile" docsSrcPath
run dotnet "restore" docsSrcPath )

Target.create "PublishDocs" (fun _ -> run npm "run build" ".")

Target.create "RunDocs" (fun _ ->
run npm "run startdocs" ".")

let dependencies = [

"Clean"
==> "InstallClient"
// ==> "UpdateTools"
==> "Run"

"Clean"
==> "InstallClient"
// ==> "UpdateTools"
==> "RunTests"

"Clean"
==> "InstallClient"
// ==> "UpdateTools"
==> "Build"
==> "ExecuteTests"

"Clean"
==> "InstallClient"
==> "UpdateTools"
==> "Build"
// ==> "ExecuteTests"
==> "PrepareRelease"
==> "Pack"
==> "Push"

"InstallDocs"
==> "RunDocs"

"InstallDocs"
==> "PublishDocs"
]

[<EntryPoint>]
let main args =
try
match args with
| [| target |] -> Target.runOrDefault target
| _ -> Target.runOrDefault "Run"
0
with e ->
printfn "%A" e
1
11 changes: 11 additions & 0 deletions Build.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Helpers.fs" />
<Compile Include="Build.fs" />
</ItemGroup>
<Import Project=".paket\Paket.Restore.targets" />
</Project>
Loading

0 comments on commit e3ad4d6

Please sign in to comment.