Skip to content

Commit e8a0d07

Browse files
authored
Merge pull request #4254 from ralfhandl/dev-build-src
dev: build HTML from src/oas.md
2 parents 984ee11 + 8a2bb17 commit e8a0d07

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ target
66
atlassian-ide-plugin.xml
77
node_modules/
88
deploy/
9+
deploy-preview/
910
coverage/
1011
history
1112
Gemfile.lock

CONTRIBUTING.md

+15
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,21 @@ This might apply to, for example, Markdown files, automation, and scripts.
163163
For all pull requests, if they should not be merged yet for any reason (they depend on something else, you would like feedback from a specific reviewer), mark them as draft and they will not be merged while in that state.
164164
Draft pull requests can still be reviewed while in draft state.
165165

166+
### Preview specification HTML locally
167+
168+
The markdown source files are converted to HTML before publishing.
169+
To do this locally, please
170+
171+
1. Install [Node.js](https://nodejs.org/)
172+
2. Check out this repo, go to the repo root, and switch to a development branch
173+
3. Execute `npm install` (once, repeat after merging upstream changes)
174+
4. Execute `npm run build-src` after changing `src/oas.md`
175+
5. Open output file `deploy-preview/oas.html` with a browser
176+
177+
Before creating a pull request or marking a draft pull request as ready for review, please
178+
179+
6. Execute `npm run validate-markdown` and fix any reported problems in `src/oas.md`
180+
166181
## Reviewers
167182

168183
> [!NOTE]

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"license": "Apache-2.0",
1515
"scripts": {
1616
"build": "bash ./scripts/md2html/build.sh",
17+
"build-src": "bash ./scripts/md2html/build-src.sh",
1718
"test": "c8 --100 vitest --watch=false && bash scripts/schema-test-coverage.sh",
1819
"validate-markdown": "npx mdv src/oas.md && npx markdownlint-cli src/oas.md"
1920
},

scripts/md2html/build-src.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
# Author: @ralfhandl
4+
5+
# run this script from the root of the repo
6+
7+
mkdir -p deploy-preview/temp
8+
mkdir -p deploy-preview/js
9+
10+
cp -p node_modules/respec/builds/respec-w3c.* deploy-preview/js/
11+
12+
cd scripts/md2html
13+
14+
filename=src/oas.md
15+
tempfile=../../deploy-preview/temp/oas.html
16+
echo "=== ${filename} ==="
17+
18+
node md2html.js --maintainers ../../EDITORS.md ../../${filename} > $tempfile
19+
npx respec --use-local --src $tempfile --out ../../deploy-preview/oas.html
20+
rm $tempfile
21+
22+
echo Built deploy-preview/oas.html
23+
echo
24+
25+
rm -r ../../deploy-preview/js
26+
rmdir ../../deploy-preview/temp

0 commit comments

Comments
 (0)