Skip to content

Commit 3748abb

Browse files
reakaleekMpdreamz
andauthored
Set up parceljs (#389)
* Set up parceljs * Fix static file * Add map files * Fix EmbeddedResource * Naming * Remove duplicate sphinx script * Add `./build.sh watch` to integrate all continuous builds. (#390) All continuous builds are now servicable through `dotnet watch` > dotnet watch --project src/docs-builder --no-hot-reload -- serve Will build web assets without recompiling c# or rebooting the server. C# or cshtml changes will rebuild automatically. Markdown files will continue to be server through liverload without a full restart. Co-authored-by: Jan Calanog <[email protected]> --------- Co-authored-by: Martijn Laarman <[email protected]>
1 parent 9f3dc7d commit 3748abb

23 files changed

+3365
-20
lines changed

.github/actions/bootstrap/action.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,11 @@ runs:
3030
echo "Version Number: ${REPO_VERSION}"
3131
echo "REPO_VERSION=${REPO_VERSION}" >> $GITHUB_ENV
3232
echo "full-version=${REPO_VERSION}" >> $GITHUB_OUTPUT
33-
echo "major-version=$(echo ${REPO_VERSION} | cut -d"." -f1)" >> $GITHUB_OUTPUT
33+
echo "major-version=$(echo ${REPO_VERSION} | cut -d"." -f1)" >> $GITHUB_OUTPUT
34+
35+
- uses: actions/setup-node@v4
36+
with:
37+
cache: npm
38+
cache-dependency-path: src/Elastic.Markdown/package-lock.json
39+
node-version-file: .nvmrc
40+

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22.13.1

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,29 @@ To test performance it's best to build the binary and run outside of docker:
137137
For reference here's the `markitpy-doc` docset (50k markdown files) currently takes `14s` vs `several minutes` compared to
138138
existing surveyed tools
139139

140+
# Local Development
141+
142+
## Preqrequisites
143+
144+
- [.NET 9.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/9.0)
145+
- [Node.js 22.13.1 (LTS)](https://nodejs.org/en/blog/release/v22.13.1)
146+
147+
148+
## Continuously build all assets during development.
149+
150+
```shell
151+
./build.sh watch
152+
```
153+
154+
This will monitor code, cshtml template files & static files and reload the application
155+
if any changes.
156+
157+
Web assets are reloaded through `parcel watch` and don't require a recompilation.
158+
159+
Markdown files are refreshed automatically through livereload
160+
161+
Code or layout changes will relaunch the server automatically
162+
140163
# Release Process
141164

142165
This section outlines the process for releasing a new version of this project.

build/CommandLine.fs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ type Build =
1717
| [<CliPrefix(CliPrefix.None);SubCommand>] Test
1818

1919
| [<CliPrefix(CliPrefix.None);SubCommand>] Format
20-
20+
| [<CliPrefix(CliPrefix.None);SubCommand>] Watch
21+
2122
| [<CliPrefix(CliPrefix.None);Hidden;SubCommand>] Lint
2223
| [<CliPrefix(CliPrefix.None);Hidden;SubCommand>] PristineCheck
2324
| [<CliPrefix(CliPrefix.None);Hidden;SubCommand>] ValidateLicenses
@@ -46,7 +47,9 @@ with
4647
| Release -> "runs build, tests, and create and validates the packages shy of publishing them"
4748
| Publish -> "Publishes artifacts"
4849
| Format -> "runs dotnet format"
49-
50+
51+
| Watch -> "runs dotnet watch to continuous build code/templates and web assets on the fly"
52+
5053
// steps
5154
| Lint
5255
| PristineCheck

build/Targets.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ let private version _ =
3535

3636
let private format _ = exec { run "dotnet" "format" "--verbosity" "quiet" }
3737

38+
let private watch _ = exec { run "dotnet" "watch" "--project" "src/docs-builder" "--no-hot-reload" "--" "serve" }
39+
3840
let private lint _ =
3941
match exec {
4042
exit_code_of "dotnet" "format" "--verify-no-changes"
@@ -167,6 +169,7 @@ let Setup (parsed:ParseResults<Build>) =
167169
release
168170

169171
| Format -> Build.Step format
172+
| Watch -> Build.Step watch
170173

171174
// steps
172175
| Lint -> Build.Step lint

src/Elastic.Markdown/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.parcel-cache/
2+
node_modules/
3+
_static/main.js
4+
_static/main.js.map
5+
_static/styles.css
6+
_static/styles.css.map

0 commit comments

Comments
 (0)