Skip to content

Commit 2d55cff

Browse files
committed
Go for paket and use direct link to other docs site
1 parent 5450fd2 commit 2d55cff

33 files changed

+5522
-816
lines changed

.editorconfig

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# EditorConfig is awesome: http://EditorConfig.org
2-
3-
# top-most EditorConfig file
4-
root = true
5-
6-
# Unix-style newlines with a newline ending every file
7-
[*]
8-
insert_final_newline = true
9-
charset = utf-8
10-
trim_trailing_whitespace = true
11-
indent_style = space
12-
indent_size = 2
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
insert_final_newline = true
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
indent_style = space
12+
indent_size = 2

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ obj/
55

66
# Ignore webpack generated files
77
dist/
8+
packages/

.paket/Paket.Restore.targets

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<PropertyGroup>
3+
<!-- Mark that this target file has been loaded. -->
4+
<IsPaketRestoreTargetsFileLoaded>true</IsPaketRestoreTargetsFileLoaded>
5+
<PaketToolsPath>$(MSBuildThisFileDirectory)</PaketToolsPath>
6+
<MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
7+
<MonoPath Condition="'$(MonoPath)' == ''">mono</MonoPath>
8+
<!-- Paket command -->
9+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket.exe')">$(PaketRootPath)paket.exe</PaketExePath>
10+
<PaketExePath Condition=" '$(PaketExePath)' == '' ">$(PaketToolsPath)paket.exe</PaketExePath>
11+
<PaketCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketExePath)"</PaketCommand>
12+
<PaketCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
13+
</PropertyGroup>
14+
15+
<Target Name="PaketRestore" BeforeTargets="_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" >
16+
17+
<Exec Command='$(PaketCommand) restore --project "$(MSBuildProjectFullPath)" --target-framework $(TargetFramework)' ContinueOnError="false" />
18+
19+
<PropertyGroup>
20+
<PaketReferencesFilePath>$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references</PaketReferencesFilePath>
21+
</PropertyGroup>
22+
23+
<ReadLinesFromFile File="$(PaketReferencesFilePath)" >
24+
<Output TaskParameter="Lines" ItemName="PaketReferencesFileLines"/>
25+
</ReadLinesFromFile>
26+
27+
<ItemGroup Condition=" '@(PaketReferencesFileLines)' != '' " >
28+
<PaketReferencesFileLinesInfo Include="@(PaketReferencesFileLines)" >
29+
<PackageName>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName>
30+
<PackageVersion>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion>
31+
</PaketReferencesFileLinesInfo>
32+
<PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)">
33+
<Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
34+
</PackageReference>
35+
</ItemGroup>
36+
37+
<PropertyGroup>
38+
<RestoreConfigFile>$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).NuGet.Config</RestoreConfigFile>
39+
</PropertyGroup>
40+
41+
</Target>
42+
43+
<Target Name="PaketDisableDirectPack" AfterTargets="_IntermediatePack" BeforeTargets="GenerateNuspec" >
44+
<PropertyGroup>
45+
<ContinuePackingAfterGeneratingNuspec>false</ContinuePackingAfterGeneratingNuspec>
46+
</PropertyGroup>
47+
</Target>
48+
49+
<Target Name="PaketOverrideNuspec" AfterTargets="GenerateNuspec" >
50+
<PropertyGroup>
51+
<PaketReferencesFilePath>$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references</PaketReferencesFilePath>
52+
<ContinuePackingAfterGeneratingNuspec>true</ContinuePackingAfterGeneratingNuspec>
53+
</PropertyGroup>
54+
55+
<ItemGroup>
56+
<_NuspecFiles Include="$(BaseIntermediateOutputPath)*.nuspec"/>
57+
</ItemGroup>
58+
59+
<Exec Command='$(PaketCommand) fix-nuspec file "@(_NuspecFiles)" references-file "$(PaketReferencesFilePath)" ' />
60+
61+
<ConvertToAbsolutePath Condition="@(_NuspecFiles) != ''" Paths="@(_NuspecFiles)">
62+
<Output TaskParameter="AbsolutePaths" PropertyName="NuspecFileAbsolutePath" />
63+
</ConvertToAbsolutePath>
64+
65+
<!-- Call Pack -->
66+
<PackTask PackItem="$(PackProjectInputFile)"
67+
PackageFiles="@(_PackageFiles)"
68+
PackageFilesToExclude="@(_PackageFilesToExclude)"
69+
PackageVersion="$(PackageVersion)"
70+
PackageId="$(PackageId)"
71+
Title="$(Title)"
72+
Authors="$(Authors)"
73+
Description="$(Description)"
74+
Copyright="$(Copyright)"
75+
RequireLicenseAcceptance="$(PackageRequireLicenseAcceptance)"
76+
LicenseUrl="$(PackageLicenseUrl)"
77+
ProjectUrl="$(PackageProjectUrl)"
78+
IconUrl="$(PackageIconUrl)"
79+
ReleaseNotes="$(PackageReleaseNotes)"
80+
Tags="$(PackageTags)"
81+
TargetPathsToAssemblies="@(_TargetPathsToAssemblies->'%(FinalOutputPath)')"
82+
TargetPathsToSymbols="@(_TargetPathsToSymbols)"
83+
TargetFrameworks="@(_TargetFrameworks)"
84+
AssemblyName="$(AssemblyName)"
85+
PackageOutputPath="$(PackageOutputAbsolutePath)"
86+
IncludeSymbols="$(IncludeSymbols)"
87+
IncludeSource="$(IncludeSource)"
88+
PackageTypes="$(PackageType)"
89+
IsTool="$(IsTool)"
90+
RepositoryUrl="$(RepositoryUrl)"
91+
RepositoryType="$(RepositoryType)"
92+
SourceFiles="@(_SourceFiles->Distinct())"
93+
NoPackageAnalysis="$(NoPackageAnalysis)"
94+
MinClientVersion="$(MinClientVersion)"
95+
Serviceable="$(Serviceable)"
96+
AssemblyReferences="@(_References)"
97+
ContinuePackingAfterGeneratingNuspec="$(ContinuePackingAfterGeneratingNuspec)"
98+
NuspecOutputPath="$(BaseIntermediateOutputPath)"
99+
IncludeBuildOutput="$(IncludeBuildOutput)"
100+
BuildOutputFolder="$(BuildOutputTargetFolder)"
101+
ContentTargetFolders="$(ContentTargetFolders)"
102+
RestoreOutputPath="$(RestoreOutputAbsolutePath)"
103+
NuspecFile="$(NuspecFileAbsolutePath)"
104+
NuspecBasePath="$(NuspecBasePath)"
105+
NuspecProperties="$(NuspecProperties)"/>
106+
</Target>
107+
108+
</Project>

.paket/paket.exe

51 KB
Binary file not shown.

.paket/paket.exe.config

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<appSettings>
4+
<add key="Prerelease" value="True"/>
5+
</appSettings>
6+
</configuration>

NuGet.Config

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<configuration>
3-
<packageSources>
4-
<clear />
5-
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
6-
</packageSources>
7-
<disabledPackageSources>
8-
<clear />
9-
</disabledPackageSources>
10-
</configuration>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
6+
</packageSources>
7+
<disabledPackageSources>
8+
<clear />
9+
</disabledPackageSources>
10+
</configuration>

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
## Build and running the app
2-
3-
1. Install npm dependencies: `npm install`
4-
2. Install dotnet dependencies: `dotnet restore`
5-
3. Start Fable server and Webpack dev server: `dotnet fable npm-run start`
6-
4. In your browser, open: [http://localhost:8080/](http://localhost:8080/)
7-
8-
Any modification you do to the F# code will be reflected in the web page after saving.
1+
## Build and running the app
2+
3+
1. Install npm dependencies: `yarn install`
4+
2. Install dotnet dependencies: `dotnet restore`
5+
3. Start Fable server and Webpack dev server: `dotnet fable npm-run start`
6+
4. In your browser, open: [http://localhost:8080/](http://localhost:8080/)
7+
8+
Any modification you do to the F# code will be reflected in the web page after saving.

build.cmd

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@echo off
2+
cls
3+
4+
.paket\paket.bootstrapper.exe
5+
if errorlevel 1 (
6+
exit /b %errorlevel%
7+
)
8+
9+
.paket\paket.exe restore
10+
if errorlevel 1 (
11+
exit /b %errorlevel%
12+
)
13+
14+
packages\FAKE\tools\FAKE.exe build.fsx %*

build.fsx

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
// include Fake libs
2+
#r "./packages/FAKE/tools/FakeLib.dll"
3+
#r "System.IO.Compression.FileSystem"
4+
5+
open System
6+
open System.IO
7+
open Fake
8+
open Fake.NpmHelper
9+
10+
let yarn =
11+
if EnvironmentHelper.isWindows then "yarn.cmd" else "yarn"
12+
|> ProcessHelper.tryFindFileOnPath
13+
|> function
14+
| Some yarn -> yarn
15+
| ex -> failwith ( sprintf "yarn not found (%A)\n" ex )
16+
17+
// Directories
18+
let buildDir = "./build/"
19+
20+
// Filesets
21+
let projects =
22+
!! "src/*/*.proj"
23+
24+
25+
let dotnetcliVersion = "1.0.1"
26+
let mutable dotnetExePath = "dotnet"
27+
28+
let runDotnet workingDir args =
29+
printfn "CWD: %s" workingDir
30+
// printfn "dotnet %s" args
31+
let result =
32+
ExecProcess (fun info ->
33+
info.FileName <- dotnetExePath
34+
info.WorkingDirectory <- workingDir
35+
info.Arguments <- args) TimeSpan.MaxValue
36+
if result <> 0 then failwithf "Command failed: dotnet %s" args
37+
38+
39+
Target "InstallDotNetCore" (fun _ ->
40+
let dotnetSDKPath = FullName "./dotnetsdk"
41+
let correctVersionInstalled =
42+
try
43+
let processResult =
44+
ExecProcessAndReturnMessages (fun info ->
45+
info.FileName <- dotnetExePath
46+
info.WorkingDirectory <- Environment.CurrentDirectory
47+
info.Arguments <- "--version") (TimeSpan.FromMinutes 30.)
48+
49+
processResult.Messages |> separated "" = dotnetcliVersion
50+
with
51+
| _ -> false
52+
53+
if correctVersionInstalled then
54+
tracefn "dotnetcli %s already installed" dotnetcliVersion
55+
else
56+
CleanDir dotnetSDKPath
57+
let archiveFileName =
58+
if isWindows then
59+
sprintf "dotnet-dev-win-x64.%s.zip" dotnetcliVersion
60+
elif isLinux then
61+
sprintf "dotnet-dev-ubuntu-x64.%s.tar.gz" dotnetcliVersion
62+
else
63+
sprintf "dotnet-dev-osx-x64.%s.tar.gz" dotnetcliVersion
64+
let downloadPath =
65+
sprintf "https://dotnetcli.azureedge.net/dotnet/Sdk/%s/%s" dotnetcliVersion archiveFileName
66+
let localPath = Path.Combine(dotnetSDKPath, archiveFileName)
67+
68+
tracefn "Installing '%s' to '%s'" downloadPath localPath
69+
70+
use webclient = new Net.WebClient()
71+
webclient.DownloadFile(downloadPath, localPath)
72+
73+
if not isWindows then
74+
let assertExitCodeZero x =
75+
if x = 0 then () else
76+
failwithf "Command failed with exit code %i" x
77+
78+
Shell.Exec("tar", sprintf """-xvf "%s" -C "%s" """ localPath dotnetSDKPath)
79+
|> assertExitCodeZero
80+
else
81+
Compression.ZipFile.ExtractToDirectory(localPath, dotnetSDKPath)
82+
83+
tracefn "dotnet cli path - %s" dotnetSDKPath
84+
System.IO.Directory.EnumerateFiles dotnetSDKPath
85+
|> Seq.iter (fun path -> tracefn " - %s" path)
86+
System.IO.Directory.EnumerateDirectories dotnetSDKPath
87+
|> Seq.iter (fun path -> tracefn " - %s%c" path System.IO.Path.DirectorySeparatorChar)
88+
89+
dotnetExePath <- dotnetSDKPath </> (if isWindows then "dotnet.exe" else "dotnet")
90+
91+
// let oldPath = System.Environment.GetEnvironmentVariable("PATH")
92+
// System.Environment.SetEnvironmentVariable("PATH", sprintf "%s%s%s" dotnetSDKPath (System.IO.Path.PathSeparator.ToString()) oldPath)
93+
)
94+
95+
96+
Target "Install" (fun _ ->
97+
projects
98+
|> Seq.iter (fun s ->
99+
let dir = IO.Path.GetDirectoryName s
100+
printf "Installing: %s\n" dir
101+
runDotnet dir "restore"
102+
)
103+
)
104+
105+
// Targets
106+
Target "Clean" (fun _ ->
107+
CleanDirs [buildDir]
108+
)
109+
110+
Target "Build" (fun _ ->
111+
projects
112+
|> Seq.iter (fun s ->
113+
let dir = IO.Path.GetDirectoryName s
114+
runDotnet dir "pack")
115+
)
116+
117+
// Build order
118+
"Clean"
119+
==> "InstallDotNetCore"
120+
==> "Install"
121+
==> "Build"
122+
123+
// start build
124+
RunTargetOrDefault "Build"

build.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
if test "$OS" = "Windows_NT"
3+
then
4+
# use .Net
5+
6+
.paket/paket.bootstrapper.exe
7+
exit_code=$?
8+
if [ $exit_code -ne 0 ]; then
9+
exit $exit_code
10+
fi
11+
12+
.paket/paket.exe restore
13+
exit_code=$?
14+
if [ $exit_code -ne 0 ]; then
15+
exit $exit_code
16+
fi
17+
18+
packages/FAKE/tools/FAKE.exe $@ --fsiargs build.fsx
19+
else
20+
# use mono
21+
mono .paket/paket.bootstrapper.exe
22+
exit_code=$?
23+
if [ $exit_code -ne 0 ]; then
24+
exit $exit_code
25+
fi
26+
27+
mono .paket/paket.exe restore
28+
exit_code=$?
29+
if [ $exit_code -ne 0 ]; then
30+
exit $exit_code
31+
fi
32+
mono packages/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
33+
fi

0 commit comments

Comments
 (0)