Skip to content

Commit d098a72

Browse files
Bump version to 1.3.0-beta-001
1 parent 0e36a12 commit d098a72

File tree

5 files changed

+49
-108
lines changed

5 files changed

+49
-108
lines changed

build.fsx

Lines changed: 32 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,49 @@
1+
open Octokit
12
// include Fake libs
23
#r "./packages/build/FAKE/tools/FakeLib.dll"
34
#r "System.IO.Compression.FileSystem"
5+
#load "paket-files/build/fsharp/FAKE/modules/Octokit/Octokit.fsx"
6+
#load "paket-files/build/fable-compiler/fake-helpers/Fable.FakeHelpers.fs"
47

5-
open System
6-
open System.IO
7-
open System.Text.RegularExpressions
88
open Fake
9-
open Fake.NpmHelper
10-
open Fake.ReleaseNotesHelper
11-
open Fake.Git
12-
open Fake.YarnHelper
9+
open Fable.FakeHelpers
1310

14-
module Util =
11+
#if MONO
12+
// prevent incorrect output encoding (e.g. https://github.com/fsharp/FAKE/issues/1196)
13+
System.Console.OutputEncoding <- System.Text.Encoding.UTF8
14+
#endif
1515

16-
let visitFile (visitor: string->string) (fileName : string) =
17-
File.ReadAllLines(fileName)
18-
|> Array.map (visitor)
19-
|> fun lines -> File.WriteAllLines(fileName, lines)
16+
let project = "fable-react"
17+
let gitOwner = "fable-compiler"
2018

21-
let replaceLines (replacer: string->Match->string option) (reg: Regex) (fileName: string) =
22-
fileName |> visitFile (fun line ->
23-
let m = reg.Match(line)
24-
if not m.Success
25-
then line
26-
else
27-
match replacer line m with
28-
| None -> line
29-
| Some newLine -> newLine)
19+
let dotnetcliVersion = "2.0.3"
20+
let mutable dotnetExePath = environVarOrDefault "DOTNET" "dotnet"
3021

31-
let mutable dotnetExePath = "dotnet"
32-
33-
let runDotnet dir =
34-
DotNetCli.RunCommand (fun p -> { p with ToolPath = dotnetExePath
35-
WorkingDir = dir
36-
TimeOut = TimeSpan.FromHours 12. } )
37-
// Extra timeout allow us to run watch mode
38-
// Otherwise, the process is stopped every 30 minutes by default
39-
40-
Target "Clean" (fun _ ->
41-
!! "src/**/bin"
42-
++ "src/**/obj"
43-
|> Seq.iter(CleanDir)
44-
)
45-
46-
Target "Restore" (fun _ ->
47-
!! "src/**/*.fsproj"
48-
|> Seq.iter (fun s ->
49-
let dir = IO.Path.GetDirectoryName s
50-
runDotnet dir "restore")
22+
// Clean and install dotnet SDK
23+
Target "Bootstrap" (fun () ->
24+
!! "src/**/bin" ++ "src/**/obj" |> CleanDirs
25+
dotnetExePath <- DotNetCli.InstallDotNetSDK dotnetcliVersion
5126
)
5227

53-
Target "Build" (fun _ ->
54-
!! "src/**/*.fsproj"
55-
|> Seq.iter (fun s ->
56-
let dir = IO.Path.GetDirectoryName s
57-
runDotnet dir "build")
28+
Target "PublishPackages" (fun () ->
29+
[ "src/Fable.React/Fable.React.fsproj"
30+
"src/Fable.ReactLeaflet/Fable.ReactLeaflet.fsproj"]
31+
|> publishPackages __SOURCE_DIRECTORY__ dotnetExePath
5832
)
5933

60-
// --------------------------------------------------------------------------------------
61-
// Build a NuGet package
62-
let needsPublishing (versionRegex: Regex) (releaseNotes: ReleaseNotes) projFile =
63-
printfn "Project: %s" projFile
64-
if releaseNotes.NugetVersion.ToUpper().EndsWith("NEXT")
65-
then
66-
printfn "Version in Release Notes ends with NEXT, don't publish yet."
67-
false
68-
else
69-
File.ReadLines(projFile)
70-
|> Seq.tryPick (fun line ->
71-
let m = versionRegex.Match(line)
72-
if m.Success then Some m else None)
73-
|> function
74-
| None -> failwith "Couldn't find version in project file"
75-
| Some m ->
76-
let sameVersion = m.Groups.[1].Value = releaseNotes.NugetVersion
77-
if sameVersion then
78-
printfn "Already version %s, no need to publish." releaseNotes.NugetVersion
79-
not sameVersion
80-
81-
let toPackageReleaseNotes (notes: string list) =
82-
"* " + String.Join("\n * ", notes)
83-
|> (fun txt -> txt.Replace("\"", "\\\""))
84-
85-
let pushNuget (releaseNotes: ReleaseNotes) (projFile: string) =
86-
let versionRegex = Regex("<Version>(.*?)</Version>", RegexOptions.IgnoreCase)
87-
88-
if needsPublishing versionRegex releaseNotes projFile then
89-
let projDir = Path.GetDirectoryName(projFile)
90-
let nugetKey =
91-
match environVarOrNone "NUGET_KEY" with
92-
| Some nugetKey -> nugetKey
93-
| None -> failwith "The Nuget API key must be set in a NUGET_KEY environmental variable"
94-
runDotnet projDir (sprintf "pack -c Release /p:Version=%s /p:PackageReleaseNotes=\"%s\"" releaseNotes.NugetVersion (toPackageReleaseNotes releaseNotes.Notes))
95-
Directory.GetFiles(projDir </> "bin" </> "Release", "*.nupkg")
96-
|> Array.find (fun nupkg -> nupkg.Contains(releaseNotes.NugetVersion))
97-
|> (fun nupkg ->
98-
(Path.GetFullPath nupkg, nugetKey)
99-
||> sprintf "nuget push %s -s nuget.org -k %s"
100-
|> DotNetCli.RunCommand id)
101-
// After successful publishing, update the project file
102-
(versionRegex, projFile)
103-
||> Util.replaceLines (fun line _ ->
104-
versionRegex.Replace(line, "<Version>"+releaseNotes.NugetVersion+"</Version>") |> Some)
105-
106-
Target "PublishNugets" (fun _ ->
107-
!! "src/Fable.React/Fable.React.fsproj"
108-
++ "src/Fable.ReactLeaflet/Fable.ReactLeaflet.fsproj"
109-
|> Seq.iter(fun s ->
110-
let projFile = s
111-
let projDir = IO.Path.GetDirectoryName(projFile)
112-
let release = projDir </> "RELEASE_NOTES.md" |> ReleaseNotesHelper.LoadReleaseNotes
113-
pushNuget release projFile
34+
Target "GitHubRelease" (fun () ->
35+
let releasePath = __SOURCE_DIRECTORY__ </> "src/Fable.React/RELEASE_NOTES.md"
36+
githubRelease releasePath gitOwner project (fun user pw release ->
37+
createClient user pw
38+
|> createDraft gitOwner project release.NugetVersion
39+
(release.SemVer.PreRelease <> None) release.Notes
40+
|> releaseDraft
41+
|> Async.RunSynchronously
11442
)
11543
)
11644

117-
// Build order
118-
"Clean"
119-
==> "Restore"
120-
==> "Build"
121-
==> "PublishNugets"
45+
"Bootstrap"
46+
==> "PublishPackages"
47+
==> "GitHubRelease"
12248

123-
// start build
124-
RunTargetOrDefault "Build"
49+
RunTargetOrDefault "Bootstrap"

paket.dependencies

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ framework: net46
1010
source https://nuget.org/api/v2
1111
nuget FSharp.Core redirects:force, content:none
1212
nuget FAKE
13+
github fsharp/FAKE modules/Octokit/Octokit.fsx
14+
github fable-compiler/fake-helpers Fable.FakeHelpers.fs

paket.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,3 +575,10 @@ NUGET
575575
remote: https://www.nuget.org/api/v2
576576
FAKE (4.63.2)
577577
FSharp.Core (4.2.3) - content: none, redirects: force
578+
Octokit (0.28)
579+
GITHUB
580+
remote: fsharp/FAKE
581+
modules/Octokit/Octokit.fsx (0341a2e614eb2a7f34607cec914eb0ed83ce9add)
582+
Octokit (>= 0.20)
583+
remote: fable-compiler/fake-helpers
584+
Fable.FakeHelpers.fs (ac8d3f6677366c381350023977dbe91adc9aa8a0)

src/Fable.React/Fable.React.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
4-
<Version>1.2.2</Version>
4+
<Version>1.3.0-beta-001</Version>
55
<TargetFramework>netstandard1.6</TargetFramework>
66
</PropertyGroup>
77
<ItemGroup>

src/Fable.React/RELEASE_NOTES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
### 1.3.0-beta-001
2+
3+
* Add `reactiveCom` helper (stateful mini-Elmish component)
4+
* Add `mountById` and `mountBySelectors`
5+
* Add abstract methods to `React.Component` so users have autocompletion and docs when overriding
6+
* Uniform helpers API: ofType, ofFunction, ofImport, ofOption, ofArray...
7+
18
### 1.2.2
29

310
* Add Height to SVGProp

0 commit comments

Comments
 (0)