Skip to content

Commit 14bbcfe

Browse files
committed
Initial commit
0 parents  commit 14bbcfe

30 files changed

+9027
-0
lines changed

.editorconfig

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = false

.gitignore

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.fake/
2+
.vs/
3+
obj/
4+
bin/
5+
packages/
6+
paket-files/
7+
node_modules/
8+
src/Client/public/js/
9+
release.cmd
10+
release.sh
11+
.idea/
12+
*.DotSettings.user
13+
deploy
14+
/src/Server/bar.jpg
15+
/tools/
16+
/audio
17+
/.ionide/symbolCache.db
18+
/yarn-error.log

.gitlab-ci.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
cache:
2+
paths:
3+
- packages/
4+
- node_modules/
5+
6+
stages:
7+
- build
8+
9+
build:win:
10+
stage: build
11+
cache:
12+
key: "%CI_COMMIT_REF_NAME"
13+
script:
14+
# - .\dotnet-install.ps1 -InstallDir tools
15+
- IF EXIST build.cmd build.cmd Build
16+
tags:
17+
- Build
18+
- NodeJS
19+

.paket/Paket.Restore.targets

+300
Large diffs are not rendered by default.

.paket/paket.exe

62.8 KB
Binary file not shown.

build.cmd

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@echo off
2+
cls
3+
4+
.paket\paket.exe restore
5+
if errorlevel 1 (
6+
exit /b %errorlevel%
7+
)
8+
9+
dotnet tool install --tool-path tools fake-cli
10+
tools\fake.exe build --target %*

build.fsx

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#r "paket: groupref build //"
2+
#load "./.fake/build.fsx/intellisense.fsx"
3+
4+
#if !FAKE
5+
#r "netstandard"
6+
#r "Facades/netstandard" // https://github.com/ionide/ionide-vscode-fsharp/issues/839#issuecomment-396296095
7+
#endif
8+
9+
open System
10+
11+
open Fake.Core
12+
open Fake.DotNet
13+
open Fake.IO
14+
15+
let serverPath = Path.getFullName "./src/Server"
16+
let piServerPath = Path.getFullName "./src/PiServer"
17+
let clientPath = Path.getFullName "./src/Client"
18+
let deployDir = Path.getFullName "./deploy"
19+
20+
let platformTool tool winTool =
21+
let tool = if Environment.isUnix then tool else winTool
22+
match Process.tryFindFileOnPath tool with
23+
| Some t -> t
24+
| _ ->
25+
let errorMsg =
26+
tool + " was not found in path. " +
27+
"Please install it and make sure it's available from your path. " +
28+
"See https://safe-stack.github.io/docs/quickstart/#install-pre-requisites for more info"
29+
failwith errorMsg
30+
31+
let nodeTool = platformTool "node" "node.exe"
32+
let yarnTool = platformTool "yarn" "yarn.cmd"
33+
34+
let install = lazy DotNet.install DotNet.Versions.FromGlobalJson
35+
36+
let inline withWorkDir wd =
37+
DotNet.Options.lift install.Value
38+
>> DotNet.Options.withWorkingDirectory wd
39+
40+
let runTool cmd args workingDir =
41+
let result =
42+
Process.execSimple (fun info ->
43+
{ info with
44+
FileName = cmd
45+
WorkingDirectory = workingDir
46+
Arguments = args })
47+
TimeSpan.MaxValue
48+
if result <> 0 then failwithf "'%s %s' failed" cmd args
49+
50+
let runDotNet cmd workingDir =
51+
let result =
52+
DotNet.exec (withWorkDir workingDir) cmd ""
53+
if result.ExitCode <> 0 then failwithf "'dotnet %s' failed in %s" cmd workingDir
54+
55+
let openBrowser url =
56+
let result =
57+
//https://github.com/dotnet/corefx/issues/10361
58+
Process.execSimple (fun info ->
59+
{ info with
60+
FileName = url
61+
UseShellExecute = true })
62+
TimeSpan.MaxValue
63+
if result <> 0 then failwithf "opening browser failed"
64+
65+
Target.create "Clean" (fun _ ->
66+
Shell.cleanDirs [deployDir]
67+
)
68+
69+
Target.create "InstallClient" (fun _ ->
70+
printfn "Node version:"
71+
runTool nodeTool "--version" __SOURCE_DIRECTORY__
72+
printfn "Yarn version:"
73+
runTool yarnTool "--version" __SOURCE_DIRECTORY__
74+
runTool yarnTool "install --frozen-lockfile" __SOURCE_DIRECTORY__
75+
runDotNet "restore" clientPath
76+
)
77+
78+
Target.create "RestoreServer" (fun _ ->
79+
runDotNet "restore" serverPath
80+
runDotNet "restore" piServerPath
81+
)
82+
83+
Target.create "Build" (fun _ ->
84+
runDotNet "build" serverPath
85+
runDotNet "build" piServerPath
86+
runDotNet "fable webpack-cli -- --config src/Client/webpack.config.js -p" clientPath
87+
)
88+
89+
Target.create "Run" (fun _ ->
90+
let server = async {
91+
runDotNet "watch run" serverPath
92+
}
93+
let piServer = async {
94+
runDotNet "watch run" piServerPath
95+
}
96+
let client = async {
97+
runDotNet "fable webpack-dev-server -- --config src/Client/webpack.config.js" clientPath
98+
}
99+
let browser = async {
100+
do! Async.Sleep 5000
101+
openBrowser "http://localhost:8080"
102+
}
103+
104+
[ server; piServer; client; browser ]
105+
|> Async.Parallel
106+
|> Async.RunSynchronously
107+
|> ignore
108+
)
109+
110+
111+
open Fake.Core.TargetOperators
112+
113+
"Clean"
114+
==> "InstallClient"
115+
==> "Build"
116+
117+
"Clean"
118+
==> "InstallClient"
119+
==> "RestoreServer"
120+
==> "Run"
121+
122+
Target.runOrDefault "Build"

global.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "sdk": { "version": "2.1.402" } }

package.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"private": true,
3+
"dependencies": {
4+
"@babel/polyfill": "7.0.0",
5+
"@babel/runtime": "7.1.2",
6+
"proj4": "^2.5.0",
7+
"react": "16.5.2",
8+
"react-bootstrap": "0.32.4",
9+
"react-dom": "16.5.2",
10+
"whatwg-fetch": "^3.0.0"
11+
},
12+
"devDependencies": {
13+
"@babel/core": "7.1.2",
14+
"@babel/plugin-transform-runtime": "7.1.0",
15+
"@babel/preset-env": "7.1.0",
16+
"@babel/preset-react": "7.0.0",
17+
"babel-loader": "8.0.4",
18+
"concurrently": "4.0.1",
19+
"fable-loader": "2.0.0",
20+
"fable-utils": "1.2.0",
21+
"node-sass": "4.9.3",
22+
"remotedev": "0.2.7",
23+
"sass-loader": "7.1.0",
24+
"style-loader": "0.23.0",
25+
"terser-webpack-plugin": "^1.1.0",
26+
"webpack": "4.20.2",
27+
"webpack-cli": "^3.1.2",
28+
"webpack-dev-server": "3.1.9"
29+
}
30+
}

paket.dependencies

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
group Server
2+
storage: none
3+
source https://api.nuget.org/v3/index.json
4+
5+
nuget FSharp.Core
6+
nuget Saturn
7+
nuget Microsoft.AspNetCore.NodeServices
8+
9+
group Client
10+
storage: none
11+
source https://api.nuget.org/v3/index.json
12+
13+
nuget Fable.Core
14+
nuget Fable.Elmish.Debugger
15+
nuget Fable.Elmish.React
16+
nuget Fable.Elmish.HMR
17+
nuget Fulma
18+
19+
clitool dotnet-fable
20+
21+
group Build
22+
storage: none
23+
source https://api.nuget.org/v3/index.json
24+
25+
nuget FSharp.Core 4.3.4 // https://github.com/fsharp/FAKE/issues/2001
26+
nuget Fake.Core.Target
27+
nuget Fake.DotNet.Cli
28+
nuget Fake.IO.FileSystem
29+
30+
31+
group Test
32+
storage: none
33+
source https://api.nuget.org/v3/index.json
34+
35+
nuget FSharp.Core
36+
nuget expecto
37+
nuget Expecto.FsCheck

0 commit comments

Comments
 (0)