Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fable compatibility #36

Merged
merged 19 commits into from
Oct 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
bin/Release
bin/Debug
bin/Fable
bin/Fable.Splitter
*.swp
*.userprefs
**/obj
Expand All @@ -16,4 +18,6 @@ bin/Debug
*.trx
symbolCache.db
*.suo
/docs/output
/docs/output
/node_modules
/.fable
13 changes: 12 additions & 1 deletion FSharp.Data.Adaptive.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.Adaptive", "src
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.Adaptive.Tests", "src\FSharp.Data.Adaptive.Tests\FSharp.Data.Adaptive.Tests.fsproj", "{8D70969B-D38F-43D7-8E68-A0DE731B8C28}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Data.Adaptive.Reference", "src\FSharp.Data.Adaptive.Reference\FSharp.Data.Adaptive.Reference.fsproj", "{5D252EE8-6739-4CAA-A1D1-050DEAFDC5B1}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.Adaptive.Reference", "src\FSharp.Data.Adaptive.Reference\FSharp.Data.Adaptive.Reference.fsproj", "{5D252EE8-6739-4CAA-A1D1-050DEAFDC5B1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Demo", "Demo", "{B5A29D79-4C76-4148-A69F-814ED1BEEFCE}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fable", "src\Demo\Fable\Fable.fsproj", "{03B1322E-F6C8-4CF2-84DD-8996A2373479}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -26,10 +30,17 @@ Global
{5D252EE8-6739-4CAA-A1D1-050DEAFDC5B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5D252EE8-6739-4CAA-A1D1-050DEAFDC5B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5D252EE8-6739-4CAA-A1D1-050DEAFDC5B1}.Release|Any CPU.Build.0 = Release|Any CPU
{03B1322E-F6C8-4CF2-84DD-8996A2373479}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{03B1322E-F6C8-4CF2-84DD-8996A2373479}.Debug|Any CPU.Build.0 = Debug|Any CPU
{03B1322E-F6C8-4CF2-84DD-8996A2373479}.Release|Any CPU.ActiveCfg = Release|Any CPU
{03B1322E-F6C8-4CF2-84DD-8996A2373479}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{03B1322E-F6C8-4CF2-84DD-8996A2373479} = {B5A29D79-4C76-4148-A69F-814ED1BEEFCE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0E91AEEA-75F2-484D-8E5E-E3322D13C65A}
EndGlobalSection
Expand Down
61 changes: 61 additions & 0 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ do Environment.CurrentDirectory <- __SOURCE_DIRECTORY__

let notes = ReleaseNotes.load "RELEASE_NOTES.md"

let isWindows =
Environment.OSVersion.Platform <> PlatformID.Unix && Environment.OSVersion.Platform <> PlatformID.MacOSX

Target.create "Clean" (fun _ ->
if Directory.Exists "bin/Debug" then
Trace.trace "deleting bin/Debug"
Expand Down Expand Up @@ -63,6 +66,60 @@ Target.create "Compile" (fun _ ->
DotNet.build options "FSharp.Data.Adaptive.sln"
)

Target.create "NpmInstall" (fun _ ->
let modules = "node_modules" |> Path.GetFullPath

if not (Directory.Exists modules) then
Trace.trace "running `npm install`"

let npm =
if isWindows then CreateProcess.fromRawCommand "cmd" ["/C"; "npm"; "install"]
else CreateProcess.fromRawCommand "npm" ["install"]

npm
|> CreateProcess.withWorkingDirectory Environment.CurrentDirectory
|> CreateProcess.withStandardError StreamSpecification.Inherit
|> CreateProcess.withStandardOutput StreamSpecification.Inherit
|> Proc.run
|> ignore

)

Target.create "CompileFable" (fun _ ->
let npx = "node_modules/npx/index.js" |> Path.GetFullPath
let proj = "src/FSharp.Data.Adaptive/FSharp.Data.Adaptive.fsproj" |> Path.GetFullPath
let outDir = "bin/Fable.Splitter" |> Path.GetFullPath

let old = Environment.CurrentDirectory
Environment.CurrentDirectory <- Path.GetDirectoryName proj
try
CreateProcess.fromRawCommand "node" [npx; "fable-splitter"; proj; "-o"; outDir]
|> CreateProcess.withWorkingDirectory Environment.CurrentDirectory
|> CreateProcess.withStandardError StreamSpecification.Inherit
|> CreateProcess.withStandardOutput StreamSpecification.Inherit
|> CreateProcess.ensureExitCode
|> Proc.run
|> ignore

finally
Environment.CurrentDirectory <- old
)

Target.create "WatchFable" (fun _ ->
let npx = "node_modules/npx/index.js" |> Path.GetFullPath
CreateProcess.fromRawCommand "node" [npx; "webpack-dev-server"]
|> CreateProcess.withWorkingDirectory Environment.CurrentDirectory
|> CreateProcess.withStandardError StreamSpecification.Inherit
|> CreateProcess.withStandardOutput StreamSpecification.Inherit
|> CreateProcess.ensureExitCode
|> Proc.run
|> ignore


)



Target.create "Pack" (fun _ ->

Paket.pack (fun o ->
Expand Down Expand Up @@ -234,6 +291,9 @@ Target.create "ReleaseDocs" (fun _ ->
reallyDelete 5
)

"NpmInstall" ==> "CompileFable"
"NpmInstall" ==> "WatchFable"

"Compile" ==>
"Docs"

Expand All @@ -242,6 +302,7 @@ Target.create "ReleaseDocs" (fun _ ->
"ReleaseDocs"

"RunTest" ==> "Test"
"CompileFable" ==> "Test"

"Compile" ==>
"Test" ==>
Expand Down
Loading