Skip to content

Commit b526ce9

Browse files
committed
Move documentation to Nacara
1 parent 2c43ce5 commit b526ce9

27 files changed

+41607
-420
lines changed

.github/workflows/publish.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish
2+
on:
3+
push:
4+
branches:
5+
- $default-branch
6+
workflow_dispatch:
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Setup .NET
13+
uses: actions/setup-dotnet@v1
14+
with:
15+
dotnet-version: '6.0.x'
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: '16'
20+
- name: Install and use custom npm version
21+
run: npm i -g npm@7
22+
- name: Install NPM dependencies
23+
run: npm install
24+
- name: Restore tools
25+
run: dotnet tool restore
26+
- name: Build site
27+
run: dotnet fake build -t GenerateDocs
28+
- name: Deploy site
29+
uses: peaceiris/actions-gh-pages@v3
30+
with:
31+
personal_token: ${{ secrets.GITHUB_TOKEN }}
32+
publish_dir: ./docs_deploy

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ docs/output
3535
temp
3636
paket-files
3737
.ionide
38+
39+
.nacara
40+
docs_deploy

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engine-strict=true

RELEASE_NOTES.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,102 @@
1-
### 4.0.0-beta-1
1+
## 4.0.0-beta-1
22

33
* Support for elmish v4
44

5-
### 3.0.1
5+
## 3.0.1
66

77
* Releasing 3.0
88

9-
### 3.0.0-beta-5
9+
## 3.0.0-beta-5
1010

1111
* Update to latest Fable.React (beta-009)
1212

13-
### 3.0.0-beta-4
13+
## 3.0.0-beta-4
1414

1515
* Update to latest Elmish (beta-7) and opaque `Program`
1616

17-
### 3.0.0-beta-3
17+
## 3.0.0-beta-3
1818

1919
* Update to latest Elmish (beta-5) to make `withConsoleTrace` work in latest Fable 3
2020

21-
### 3.0.0-beta-2
21+
## 3.0.0-beta-2
2222

2323
* Fable 3 support courtesy of Alfonso
2424

25-
### 3.0.0-beta-1
25+
## 3.0.0-beta-1
2626

2727
* Elmish 3.0 compat
2828

29-
### 2.2.0
29+
## 2.2.0
3030

3131
* Fix `withReactNative` for Fable 2
3232

33-
### 2.1.0
33+
## 2.1.0
3434

3535
* Rework internal implementation to help HMR support
3636

37-
### 2.0.0
37+
## 2.0.0
3838
* Release stable for Fable2
3939

40-
### 2.0.0-beta-4
40+
## 2.0.0-beta-4
4141

4242
* Re-releasing v1 for Fable2
4343

44-
### 1.0.3
44+
## 1.0.3
4545

4646
* Add doc xml
4747

48-
### 1.0.2
48+
## 1.0.2
4949

5050
* Adding support for SSR, credit: @zaaack
5151

52-
### 1.0.1
52+
## 1.0.1
5353

5454
* Use new React bindings, various text input jumping cursor workarounds
5555

56-
### 0.9.0
56+
## 0.9.0
5757

5858
* Stable fable 1.x release
5959

60-
### 0.9.0-beta-4
60+
## 0.9.0-beta-4
6161

6262
* Fable 1.x
6363

64-
### 0.8.3
64+
## 0.8.3
6565

6666
* Optimizing rendering #41
6767

68-
### 0.8.2
68+
## 0.8.2
6969

7070
* Fixed relative path to elmish
7171

72-
### 0.8.1
72+
## 0.8.1
7373

7474
* Updated React native root to pass (unused) `props`
7575

76-
### 0.8.0
76+
## 0.8.0
7777

7878
* Lookup placeholdId by Id, instead of class
7979

80-
### 0.7.2
80+
## 0.7.2
8181

8282
* Fix dependencies
8383

84-
### 0.7.1
84+
## 0.7.1
8585

8686
* Handling unmounted properly
8787

88-
### 0.7.1-alpha.5
88+
## 0.7.1-alpha.5
8989

9090
* Working around deprecated RN API
9191

92-
### 0.7.1-alpha.3
92+
## 0.7.1-alpha.3
9393

9494
* Update dependencies
9595

96-
### 0.7.1-alpha.2
96+
## 0.7.1-alpha.2
9797

9898
* Support for new `Program` API
9999

100-
### 0.7.0-alpha.1
100+
## 0.7.0-alpha.1
101101

102102
* Migrate to Fable 0.7

babel.config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": [
3+
"@babel/preset-react"
4+
]
5+
}

build.fsx

Lines changed: 13 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ nuget Fake.IO.FileSystem
55
nuget Fake.DotNet.Cli
66
nuget Fake.Core.Target
77
nuget Fake.Core.ReleaseNotes
8-
nuget Fake.Tools.Git
9-
nuget Fake.DotNet.FSFormatting //"
8+
nuget Fake.Tools.Git //"
109
#if !FAKE
1110
#load ".fake/build.fsx/intellisense.fsx"
1211
#r "Facades/netstandard"
@@ -92,71 +91,28 @@ Target.create "PublishNuget" (fun _ ->
9291

9392
// --------------------------------------------------------------------------------------
9493
// Generate the documentation
95-
let docs_out = "docs/output"
96-
let docsHome = "https://elmish.github.io/react"
97-
98-
let copyFiles() =
99-
let header =
100-
Fake.Core.String.splitStr "\n" """(*** hide ***)
101-
#I "../../src/bin/Release/netstandard2.0"
102-
#r "Fable.Core.dll"
103-
#r "Fable.Elmish.dll"
104-
#r "Fable.Elmish.React.dll"
105-
106-
(**
107-
*)"""
108-
109-
!!"src/*.fs"
110-
|> Seq.map (fun fn -> File.read fn |> Seq.append header, fn)
111-
|> Seq.iter (fun (lines,fn) ->
112-
let fsx = Path.Combine("docs/content",Path.ChangeExtension(fn |> Path.GetFileName, "fsx"))
113-
lines |> File.writeNew fsx)
114-
115-
let generateDocs _ =
116-
copyFiles()
117-
let info =
118-
[ "project-name", "elmish-react"
119-
"project-author", "Eugene Tolmachev"
120-
"project-summary", "Elmish React extensions"
121-
"project-github", sprintf "%s/%s" gitHome gitName
122-
"project-nuget", "http://nuget.org/packages/Fable.Elmish.React" ]
123-
124-
FSFormatting.createDocs (fun args ->
125-
{ args with
126-
Source = "docs/content"
127-
OutputDirectory = docs_out
128-
LayoutRoots = [ "docs/tools/templates"
129-
".fake/build.fsx/packages/FSharp.Formatting/templates" ]
130-
ProjectParameters = ("root", docsHome)::info
131-
Template = "docpage.cshtml" } )
132-
133-
Target.create "GenerateDocs" generateDocs
94+
Target.create "GenerateDocs" (fun _ ->
95+
let res = Shell.Exec("npm", "run docs:build")
13496

97+
if res <> 0 then
98+
failwithf "Failed to generate docs"
99+
)
135100

136101
Target.create "WatchDocs" (fun _ ->
137-
use watcher =
138-
(!! "docs/content/**/*.*")
139-
|> ChangeWatcher.run generateDocs
140-
141-
Trace.traceImportant "Waiting for help edits. Press any key to stop."
102+
let res = Shell.Exec("npm", "run docs:watch")
142103

143-
System.Console.ReadKey() |> ignore
144-
145-
watcher.Dispose()
104+
if res <> 0 then
105+
failwithf "Failed to watch docs: %d" res
146106
)
147107

148108
// --------------------------------------------------------------------------------------
149109
// Release Scripts
150110

151111
Target.create "ReleaseDocs" (fun _ ->
152-
let tempDocsDir = "temp/gh-pages"
153-
Shell.cleanDir tempDocsDir
154-
Git.Repository.cloneSingleBranch "" gitRepo "gh-pages" tempDocsDir
155-
156-
Shell.copyRecursive docs_out tempDocsDir true |> Trace.tracefn "%A"
157-
Git.Staging.stageAll tempDocsDir
158-
Git.Commit.exec tempDocsDir (sprintf "Update generated documentation for version %s" release.NugetVersion)
159-
Git.Branches.push tempDocsDir
112+
let res = Shell.Exec("npm", "run docs:publish")
113+
114+
if res <> 0 then
115+
failwithf "Failed to publish docs: %d" res
160116
)
161117

162118
Target.create "Publish" ignore

docs/_partials/footer.jsx

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import React from 'react';
2+
3+
const SitemapSection = ({ title, children }) => (
4+
<div className="sitemap-section">
5+
<div className="sitemap-section-title">
6+
{title}
7+
</div>
8+
<ul className="sitemap-section-list">
9+
{children}
10+
</ul>
11+
</div>
12+
)
13+
14+
const SitemapSectionItem = ({ text, icon, url }) => (
15+
<li>
16+
<a href={url} className="icon-text sitemap-section-list-item">
17+
<span className="icon">
18+
<i className={icon}></i>
19+
</span>
20+
<span className="sitemap-section-list-item-text">
21+
{text}
22+
</span>
23+
</a>
24+
</li>
25+
)
26+
27+
const CopyrightScript = () => (
28+
<script dangerouslySetInnerHTML={{
29+
__html: `
30+
const year = new Date().getFullYear();
31+
document.getElementById('copyright-end-year').innerHTML = year;
32+
`
33+
}} />
34+
)
35+
36+
export default (
37+
<div className="is-size-5">
38+
<div className="sitemap">
39+
<SitemapSection title="Project ressources">
40+
<SitemapSectionItem
41+
text="Repository"
42+
icon="fas fa-file-code"
43+
url="https://github.com/elmish/react" />
44+
45+
<SitemapSectionItem
46+
text="Release notes"
47+
icon="fas fa-list"
48+
url="/react/release_notes.html" />
49+
50+
<SitemapSectionItem
51+
text="License"
52+
icon="fas fa-id-card"
53+
url="https://github.com/elmish/react/blob/v4.x/LICENSE.md" />
54+
</SitemapSection>
55+
56+
<SitemapSection title="Elmish modules">
57+
<SitemapSectionItem
58+
text="Fable.Elmish"
59+
icon="fa fa-book"
60+
url="https://elmish.github.io/elmish/" />
61+
62+
<SitemapSectionItem
63+
text="Fable.Elmish.Browser"
64+
icon="fa fa-book"
65+
url="https://elmish.github.io/browser/" />
66+
67+
<SitemapSectionItem
68+
text="Fable.Elmish.UrlParser"
69+
icon="fa fa-book"
70+
url="https://elmish.github.io/urlParser/" />
71+
72+
<SitemapSectionItem
73+
text="Fable.Elmish.Debugger"
74+
icon="fa fa-book"
75+
url="https://elmish.github.io/debugger/" />
76+
77+
<SitemapSectionItem
78+
text="Fable.Elmish.React"
79+
icon="fa fa-book"
80+
url="https://elmish.github.io/react/" />
81+
82+
<SitemapSectionItem
83+
text="Fable.Elmish.HMR"
84+
icon="fa fa-book"
85+
url="https://elmish.github.io/hmr/" />
86+
</SitemapSection>
87+
88+
<SitemapSection title="Other Links">
89+
<SitemapSectionItem
90+
text="Fable"
91+
icon="faf faf-fable"
92+
url="https://fable.io" />
93+
94+
<SitemapSectionItem
95+
text="Fable Gitter"
96+
icon="fab fa-gitter"
97+
url="https://gitter.im/fable-compiler/Fable" />
98+
99+
<SitemapSectionItem
100+
text="F# Slack"
101+
icon="fab fa-slack"
102+
url="https://fsharp.org/guides/slack/" />
103+
104+
<SitemapSectionItem
105+
text="F# Software Foundation"
106+
icon="faf faf-fsharp-org"
107+
url="https://fsharp.org/" />
108+
</SitemapSection>
109+
110+
</div>
111+
<p className="has-text-centered">
112+
Built with <a className="is-underlined" href="https://mangelmaxime.github.io/Nacara/">Nacara</a>
113+
</p>
114+
<p className="has-text-centered mt-2">
115+
Copyright © 2021-<span id="copyright-end-year"/> Elmish contributors.
116+
</p>
117+
<CopyrightScript />
118+
</div>
119+
)

0 commit comments

Comments
 (0)