Skip to content

Commit

Permalink
Add 'examples/Magic/' from commit '2f3d1d063d70429f241bc07856493c35f2…
Browse files Browse the repository at this point in the history
…03f641'

git-subtree-dir: examples/Magic
git-subtree-mainline: 28352eb
git-subtree-split: 2f3d1d0
  • Loading branch information
dbrattli committed Apr 28, 2019
2 parents 28352eb + 2f3d1d0 commit a3164d2
Show file tree
Hide file tree
Showing 24 changed files with 7,957 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/Magic/.editorconfig
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
14 changes: 14 additions & 0 deletions examples/Magic/.gitignore
@@ -0,0 +1,14 @@
.fable/
.fake/
.vs/
obj/
bin/
packages/
paket-files/
node_modules/
src/Client/public/js/
release.cmd
release.sh
.idea/
*.DotSettings.user
deploy
299 changes: 299 additions & 0 deletions examples/Magic/.paket/Paket.Restore.targets

Large diffs are not rendered by default.

Binary file added examples/Magic/.paket/paket.exe
Binary file not shown.
54 changes: 54 additions & 0 deletions examples/Magic/FableReaction.sln
@@ -0,0 +1,54 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E4A4FA1B-EF6E-45D0-AE5E-C49877E8C268}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Server", "src\Server\Server.fsproj", "{268B4EE7-970B-4604-B90C-35F6CC6BD847}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Client", "src\Client\Client.fsproj", "{495FFA44-D120-4F87-92FA-9AC16552F299}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{268B4EE7-970B-4604-B90C-35F6CC6BD847}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{268B4EE7-970B-4604-B90C-35F6CC6BD847}.Debug|Any CPU.Build.0 = Debug|Any CPU
{268B4EE7-970B-4604-B90C-35F6CC6BD847}.Debug|x64.ActiveCfg = Debug|Any CPU
{268B4EE7-970B-4604-B90C-35F6CC6BD847}.Debug|x64.Build.0 = Debug|Any CPU
{268B4EE7-970B-4604-B90C-35F6CC6BD847}.Debug|x86.ActiveCfg = Debug|Any CPU
{268B4EE7-970B-4604-B90C-35F6CC6BD847}.Debug|x86.Build.0 = Debug|Any CPU
{268B4EE7-970B-4604-B90C-35F6CC6BD847}.Release|Any CPU.ActiveCfg = Release|Any CPU
{268B4EE7-970B-4604-B90C-35F6CC6BD847}.Release|Any CPU.Build.0 = Release|Any CPU
{268B4EE7-970B-4604-B90C-35F6CC6BD847}.Release|x64.ActiveCfg = Release|Any CPU
{268B4EE7-970B-4604-B90C-35F6CC6BD847}.Release|x64.Build.0 = Release|Any CPU
{268B4EE7-970B-4604-B90C-35F6CC6BD847}.Release|x86.ActiveCfg = Release|Any CPU
{268B4EE7-970B-4604-B90C-35F6CC6BD847}.Release|x86.Build.0 = Release|Any CPU
{495FFA44-D120-4F87-92FA-9AC16552F299}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{495FFA44-D120-4F87-92FA-9AC16552F299}.Debug|Any CPU.Build.0 = Debug|Any CPU
{495FFA44-D120-4F87-92FA-9AC16552F299}.Debug|x64.ActiveCfg = Debug|Any CPU
{495FFA44-D120-4F87-92FA-9AC16552F299}.Debug|x64.Build.0 = Debug|Any CPU
{495FFA44-D120-4F87-92FA-9AC16552F299}.Debug|x86.ActiveCfg = Debug|Any CPU
{495FFA44-D120-4F87-92FA-9AC16552F299}.Debug|x86.Build.0 = Debug|Any CPU
{495FFA44-D120-4F87-92FA-9AC16552F299}.Release|Any CPU.ActiveCfg = Release|Any CPU
{495FFA44-D120-4F87-92FA-9AC16552F299}.Release|Any CPU.Build.0 = Release|Any CPU
{495FFA44-D120-4F87-92FA-9AC16552F299}.Release|x64.ActiveCfg = Release|Any CPU
{495FFA44-D120-4F87-92FA-9AC16552F299}.Release|x64.Build.0 = Release|Any CPU
{495FFA44-D120-4F87-92FA-9AC16552F299}.Release|x86.ActiveCfg = Release|Any CPU
{495FFA44-D120-4F87-92FA-9AC16552F299}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{268B4EE7-970B-4604-B90C-35F6CC6BD847} = {E4A4FA1B-EF6E-45D0-AE5E-C49877E8C268}
{495FFA44-D120-4F87-92FA-9AC16552F299} = {E4A4FA1B-EF6E-45D0-AE5E-C49877E8C268}
EndGlobalSection
EndGlobal
110 changes: 110 additions & 0 deletions examples/Magic/build.fsx
@@ -0,0 +1,110 @@
#r "paket: groupref build //"
#load "./.fake/build.fsx/intellisense.fsx"

#if !FAKE
#r "netstandard"
#r "Facades/netstandard" // https://github.com/ionide/ionide-vscode-fsharp/issues/839#issuecomment-396296095
#endif

open System

open Fake.Core
open Fake.DotNet
open Fake.IO

let serverPath = Path.getFullName "./src/Server"
let clientPath = Path.getFullName "./src/Client"
let deployDir = Path.getFullName "./deploy"

let platformTool tool winTool =
let tool = if Environment.isUnix then tool else winTool
match Process.tryFindFileOnPath tool with
| Some t -> t
| _ ->
let errorMsg =
tool + " was not found in path. " +
"Please install it and make sure it's available from your path. " +
"See https://safe-stack.github.io/docs/quickstart/#install-pre-requisites for more info"
failwith errorMsg

let nodeTool = platformTool "node" "node.exe"
let yarnTool = platformTool "yarn" "yarn.cmd"

let runTool cmd args workingDir =
let result =
Process.execSimple (fun info ->
{ info with
FileName = cmd
WorkingDirectory = workingDir
Arguments = args })
TimeSpan.MaxValue
if result <> 0 then failwithf "'%s %s' failed" cmd args

let runDotNet cmd workingDir =
let result =
DotNet.exec (DotNet.Options.withWorkingDirectory workingDir) cmd ""
if result.ExitCode <> 0 then failwithf "'dotnet %s' failed in %s" cmd workingDir

let openBrowser url =
let result =
//https://github.com/dotnet/corefx/issues/10361
Process.execSimple (fun info ->
{ info with
FileName = url
UseShellExecute = true })
TimeSpan.MaxValue
if result <> 0 then failwithf "opening browser failed"

Target.create "Clean" (fun _ ->
Shell.cleanDirs [deployDir]
)

Target.create "InstallClient" (fun _ ->
printfn "Node version:"
runTool nodeTool "--version" __SOURCE_DIRECTORY__
printfn "Yarn version:"
runTool yarnTool "--version" __SOURCE_DIRECTORY__
runTool yarnTool "install --frozen-lockfile" __SOURCE_DIRECTORY__
runDotNet "restore" clientPath
)

Target.create "RestoreServer" (fun _ ->
runDotNet "restore" serverPath
)

Target.create "Build" (fun _ ->
runDotNet "build" serverPath
runDotNet "fable webpack-cli -- --config src/Client/webpack.config.js -p" clientPath
)

Target.create "Run" (fun _ ->
let server = async {
runDotNet "watch run" serverPath
}
let client = async {
runDotNet "fable webpack-dev-server -- --config src/Client/webpack.config.js" clientPath
}
let browser = async {
do! Async.Sleep 5000
openBrowser "http://localhost:8080"
}

[ server; client; browser ]
|> Async.Parallel
|> Async.RunSynchronously
|> ignore
)


open Fake.Core.TargetOperators

"Clean"
==> "InstallClient"
==> "Build"

"Clean"
==> "InstallClient"
==> "RestoreServer"
==> "Run"

Target.runOrDefault "Build"
26 changes: 26 additions & 0 deletions examples/Magic/package.json
@@ -0,0 +1,26 @@
{
"private": true,
"dependencies": {
"@babel/polyfill": "^7.0.0",
"@babel/runtime": "^7.0.0",
"bulma": "^0.7.2",
"bulma-switch": "^2.0.0",
"react": "16.5.2",
"react-bootstrap": "0.32.4",
"react-dom": "16.5.2",
"whatwg-fetch": "^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-loader": "^8.0.0",
"concurrently": "4.0.1",
"fable-loader": "^2.0.0",
"remotedev": "0.2.7",
"terser-webpack-plugin": "^1.1.0",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.9"
}
}
40 changes: 40 additions & 0 deletions examples/Magic/paket.dependencies
@@ -0,0 +1,40 @@
source https://www.nuget.org/api/v2

group Server
storage: none
source https://api.nuget.org/v3/index.json

nuget FSharp.Core
nuget Giraffe
nuget Microsoft.AspNetCore
nuget Microsoft.AspNetCore.StaticFiles
nuget Fable.JsonConverter
nuget Reaction.AsyncRx prerelease
nuget Reaction.AspNetCore.Middleware prerelease
nuget Microsoft.AspNetCore.WebSockets
nuget Thoth.Json.Net ~> 2

group Client
storage: none
source https://api.nuget.org/v3/index.json

nuget Fable.Core ~> 2
nuget Fable.Elmish ~> 2
nuget Fable.Elmish.Debugger ~> 2
nuget Fable.Elmish.React ~> 2
nuget Fable.Elmish.HMR ~> 2
nuget Fable.React ~> 4
nuget Fulma ~> 1
nuget Fulma.Extensions
nuget Fable.Elmish.Reaction ~> 2

clitool dotnet-fable ~> 2

group Build
storage: none
source https://api.nuget.org/v3/index.json

nuget FSharp.Core 4.3.4 // https://github.com/fsharp/FAKE/issues/2001
nuget Fake.Core.Target
nuget Fake.DotNet.Cli
nuget Fake.IO.FileSystem

0 comments on commit a3164d2

Please sign in to comment.