@zeropress/build-pages 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ZeroPress
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,184 @@
1
+ # @zeropress/build-pages
2
+
3
+ Build ZeroPress static output for modern hosting platforms.
4
+
5
+ `@zeropress/build-pages` turns a directory of Markdown files and public assets into static ZeroPress output. It discovers Markdown files, converts them to preview-data v0.5, stages public files, and runs `@zeropress/build`.
6
+
7
+ The generated output is plain static files that can be deployed to GitHub Pages, Cloudflare Pages, Netlify, Vercel, or any static hosting provider.
8
+
9
+ ## GitHub Action
10
+
11
+ ```yaml
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/configure-pages@v5
18
+ - name: Build ZeroPress Pages
19
+ uses: zeropress-app/zeropress-build-pages@v0
20
+ with:
21
+ source: ./
22
+ destination: ./_site
23
+ theme: docs
24
+ - uses: actions/upload-pages-artifact@v3
25
+ with:
26
+ path: ./_site
27
+ ```
28
+
29
+ The action builds the static files only. Uploading and deploying are handled by your hosting provider's deployment action or CLI.
30
+
31
+ For GitHub Pages, the generated `destination` directory can be passed to `actions/upload-pages-artifact`. For Cloudflare Pages, Netlify, Vercel, or another static host, pass the same `destination` directory to that provider's deploy step.
32
+
33
+ ## CLI
34
+
35
+ ```bash
36
+ npx @zeropress/build-pages --source ./docs --destination ./_site
37
+ ```
38
+
39
+ Options:
40
+
41
+ | Option | Default | Purpose |
42
+ | --- | --- | --- |
43
+ | `--source <dir>` | `.` | Source directory containing Markdown and public files |
44
+ | `--destination <dir>` | `_site` | Output directory |
45
+ | `--out <dir>` | `_site` | Alias for `--destination` |
46
+ | `--theme docs` | `docs` | Bundled docs theme |
47
+ | `--theme-path <dir>` | none | Custom ZeroPress theme directory |
48
+ | `--config <path>` | `<source>/.zeropress/config.json` | Build Pages config |
49
+ | `--site-url <url>` | config `site.url` | Canonical URL override |
50
+ | `--skip-untitled-markdown` | `false` | Skip Markdown without an H1 |
51
+ | `--check-links` | `true` | Warn about broken internal links |
52
+ | `--no-check-links` | false | Skip link checking |
53
+
54
+ Equivalent environment variables:
55
+
56
+ | Env | Maps to |
57
+ | --- | --- |
58
+ | `ZEROPRESS_PUBLIC_DIR` | `--source` |
59
+ | `ZEROPRESS_OUT_DIR` | `--destination` |
60
+ | `ZEROPRESS_THEME_DIR` | `--theme-path` |
61
+ | `ZEROPRESS_BUILD_PAGES_CONFIG` | `--config` |
62
+ | `ZEROPRESS_SITE_URL` | `--site-url` |
63
+ | `ZEROPRESS_SKIP_UNTITLED_MARKDOWN=true` | `--skip-untitled-markdown` |
64
+
65
+ CLI options take precedence over environment variables.
66
+
67
+ ## Source Tree
68
+
69
+ The source directory is both the Markdown source root and the public passthrough root.
70
+
71
+ ```txt
72
+ docs/
73
+ index.md
74
+ guide.md
75
+ assets/
76
+ .zeropress/
77
+ config.json
78
+ ```
79
+
80
+ Build Pages stages the source tree before calling `@zeropress/build`, so `--source ./` and `--destination ./_site` are supported. Generated ZeroPress output wins over staged public files.
81
+
82
+ Ignored while staging and Markdown discovery:
83
+
84
+ - hidden paths such as `.git`, `.env`, and `.zeropress`
85
+ - `node_modules`
86
+ - `Thumbs.db`
87
+ - `*.key`
88
+ - `*.pem`
89
+ - symlinks
90
+
91
+ Additional Markdown discovery ignores:
92
+
93
+ - path segments starting with `_`
94
+ - path segments starting with `#`
95
+ - path segments ending with `~`
96
+ - `vendor`
97
+
98
+ ## Markdown Discovery
99
+
100
+ - `*.md` files are discovered recursively.
101
+ - Each Markdown page needs an ATX H1 (`# Title`) or Setext H1 (`Title` + `====`).
102
+ - Missing or empty H1 fails the build unless `--skip-untitled-markdown` is used.
103
+ - Root `index.md` becomes the front page when no config is present.
104
+ - Nested `index.md` maps to a directory route, such as `cli/index.md` -> `/cli/`.
105
+ - Other Markdown files map to extensionless routes, such as `cli/tool.md` -> `/cli/tool`.
106
+ - Markdown links to other discovered `.md` files are rewritten to generated public URLs.
107
+ - Original Markdown files remain available as public passthrough files.
108
+
109
+ ## Config
110
+
111
+ Build Pages reads `<source>/.zeropress/config.json` when present. Missing config falls back to defaults.
112
+
113
+ ```json
114
+ {
115
+ "$schema": "../schemas/zeropress-build-pages.config.v0.1.schema.json",
116
+ "version": "0.1",
117
+ "site": {
118
+ "title": "My Docs",
119
+ "description": "Project documentation",
120
+ "url": "https://example.github.io/project",
121
+ "footer": {
122
+ "copyright_text": "Copyright 2026 Example Corp.",
123
+ "attribution": {
124
+ "enabled": true
125
+ }
126
+ }
127
+ },
128
+ "front_page": {
129
+ "type": "markdown"
130
+ },
131
+ "menus": {
132
+ "primary": {
133
+ "name": "Primary Menu",
134
+ "items": [
135
+ { "title": "Home", "url": "/" },
136
+ { "title": "Guide", "url": "/guide" }
137
+ ]
138
+ }
139
+ },
140
+ "custom_html": {
141
+ "head_end": { "file": ".zeropress/head-end.html" },
142
+ "body_end": { "file": ".zeropress/body-end.html" }
143
+ }
144
+ }
145
+ ```
146
+
147
+ `front_page` modes:
148
+
149
+ - `{ "type": "theme_index" }`: render bundled theme home.
150
+ - `{ "type": "markdown" }`: render `index.md` through `page.html`.
151
+ - `{ "type": "html" }`: render `.zeropress/index.html` through `page.html`.
152
+ - `{ "type": "html", "layout": false }`: write trusted standalone HTML directly.
153
+
154
+ HTML front page and `custom_html` files must stay inside `.zeropress/`.
155
+
156
+ `site.footer.copyright_text` is rendered by the bundled docs theme when present. If it is omitted, the bundled docs theme falls back to `site.title`. ZeroPress does not add a copyright symbol automatically.
157
+
158
+ The bundled docs theme shows `Published with ZeroPress.` by default. Set `site.footer.attribution.enabled` to `false` to hide it.
159
+
160
+ Schemas:
161
+
162
+ - `schemas/zeropress-build-pages.config.v0.1.schema.json`
163
+ - `schemas/zeropress-build-pages.config.schema.json`
164
+
165
+ ## Generated Files
166
+
167
+ Build Pages writes:
168
+
169
+ ```txt
170
+ .zeropress/
171
+ preview-data.json
172
+ prebuild-report.json
173
+ build-pages-public/
174
+ ```
175
+
176
+ `preview-data.json` is the generated preview-data v0.5 input passed to `@zeropress/build`.
177
+
178
+ ## Development
179
+
180
+ ```bash
181
+ npm install
182
+ npm run build:action
183
+ npm test
184
+ ```
package/action.yml ADDED
@@ -0,0 +1,39 @@
1
+ name: Build ZeroPress Pages
2
+ description: Build ZeroPress static output for GitHub Pages, Cloudflare Pages, Netlify, Vercel, and other static hosts.
3
+ author: ZeroPress
4
+ branding:
5
+ icon: book-open
6
+ color: blue
7
+ inputs:
8
+ source:
9
+ description: Source directory containing Markdown files and optional .zeropress/config.json.
10
+ required: false
11
+ default: ./
12
+ destination:
13
+ description: Output directory for the generated static site.
14
+ required: false
15
+ default: ./_site
16
+ theme:
17
+ description: Bundled theme name. Currently supports "docs".
18
+ required: false
19
+ default: docs
20
+ theme-path:
21
+ description: Custom ZeroPress theme directory. Takes precedence over theme.
22
+ required: false
23
+ config:
24
+ description: Config file path. Defaults to <source>/.zeropress/config.json.
25
+ required: false
26
+ site-url:
27
+ description: Canonical site URL override.
28
+ required: false
29
+ skip-untitled-markdown:
30
+ description: Skip Markdown files without an H1 instead of failing.
31
+ required: false
32
+ default: "false"
33
+ check-links:
34
+ description: Warn about broken internal links after build.
35
+ required: false
36
+ default: "true"
37
+ runs:
38
+ using: node24
39
+ main: dist/action.js
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { runCli } from '../src/index.js';
3
+
4
+ runCli(process.argv.slice(2));