@zeropress/build-pages 0.5.2 → 0.5.4

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/README.md CHANGED
@@ -138,31 +138,20 @@ The CLI requires explicit input and output paths. The GitHub Action keeps safe d
138
138
 
139
139
  | Option | Default | Purpose |
140
140
  | --- | --- | --- |
141
- | `--source <dir>` | required | Source directory containing Markdown and public files |
141
+ | `--source <dir>` | required | Dedicated source directory containing Markdown and public files |
142
142
  | `--destination <dir>` | required | Output directory |
143
143
  | `--theme docs` | `docs` | Bundled docs theme |
144
144
  | `--theme-path <dir>` | none | Custom ZeroPress theme directory |
145
145
  | `--config <path>` | `<source>/.zeropress/config.json` | Build Pages config |
146
146
  | `--site-url <url>` | config `site.url` | Canonical URL override |
147
147
  | `--skip-untitled-markdown` | `false` | Skip Markdown without a page title |
148
- | `--no-check-links` | false | Skip link checking |
149
-
150
- Equivalent environment variables:
151
-
152
- | Env | Maps to |
153
- | --- | --- |
154
- | `ZEROPRESS_PUBLIC_DIR` | `--source` |
155
- | `ZEROPRESS_OUT_DIR` | `--destination` |
156
- | `ZEROPRESS_THEME_DIR` | `--theme-path` |
157
- | `ZEROPRESS_BUILD_PAGES_CONFIG` | `--config` |
158
- | `ZEROPRESS_SITE_URL` | `--site-url` |
159
- | `ZEROPRESS_SKIP_UNTITLED_MARKDOWN=true` | `--skip-untitled-markdown` |
160
-
161
- CLI options take precedence over environment variables.
148
+ | `--skip-link-check` | `false` | Skip link checking |
162
149
 
163
150
  ## Source Tree
164
151
 
165
- The source directory is both the Markdown source root and the public passthrough root. GitHub Action usage defaults to `./docs`; CLI usage requires `--source` or `ZEROPRESS_PUBLIC_DIR`.
152
+ The source directory is both the Markdown source root and the public passthrough root. GitHub Action usage defaults to `./docs`; CLI usage requires `--source`.
153
+
154
+ Use a dedicated content directory such as `docs/` or `documents/`. Repository root source (`--source ./`) is not supported, because Build Pages uses `.zeropress/` in the current working directory for internal working files.
166
155
 
167
156
  ```txt
168
157
  docs/
@@ -173,7 +162,9 @@ docs/
173
162
  config.json
174
163
  ```
175
164
 
176
- Build Pages stages the source tree before calling `@zeropress/build`, so `--source ./` and `--destination ./_site` are supported when you intentionally want to build from the repository root. Generated ZeroPress output wins over staged public files.
165
+ Build Pages stages the source tree before calling `@zeropress/build`. Generated ZeroPress output wins over staged public files.
166
+
167
+ The source directory must not overlap the destination directory, the selected theme directory, or the internal `.zeropress/` working directory.
177
168
 
178
169
  Ignored while staging and Markdown discovery:
179
170
 
@@ -288,9 +279,9 @@ Schemas:
288
279
  - `schemas/zeropress-build-pages.config.v0.1.schema.json`
289
280
  - `schemas/zeropress-build-pages.config.schema.json`
290
281
 
291
- ## Generated Files
282
+ ## Internal `.zeropress/` Files
292
283
 
293
- Build Pages writes:
284
+ Build Pages writes internal working files to `.zeropress/` in the current working directory. These files are not the final deploy output. The final static site is written to the `destination` directory.
294
285
 
295
286
  ```txt
296
287
  .zeropress/
@@ -300,10 +291,18 @@ Build Pages writes:
300
291
  public-assets/
301
292
  ```
302
293
 
303
- `build-pages-config.json` is the resolved user-facing Build Pages config used for the current run. It combines `.zeropress/config.json`, defaults, and CLI/env overrides where applicable.
294
+ `build-pages-config.json` is the resolved user-facing Build Pages config used for the current run. It combines source config, defaults, and CLI or Action input overrides where applicable.
304
295
 
305
296
  `preview-data.json` is an internal generated build input for the ZeroPress renderer. Most users do not need to edit or understand this file.
306
297
 
298
+ `build-report.json` records discovered Markdown counts, skipped Markdown files, front page resolution, and custom HTML slots.
299
+
300
+ `public-assets/` is a temporary staged public root used before the final ZeroPress render.
301
+
302
+ ## Destination Output
303
+
304
+ The `destination` directory contains the deployable static site. It includes generated ZeroPress HTML, copied public files, and original Markdown files unless they are excluded by the public passthrough rules.
305
+
307
306
  ## Development
308
307
 
309
308
  ```bash
package/action.yml CHANGED
@@ -6,7 +6,7 @@ branding:
6
6
  color: blue
7
7
  inputs:
8
8
  source:
9
- description: Source directory containing Markdown files and optional .zeropress/config.json.
9
+ description: Dedicated source directory containing Markdown files and optional .zeropress/config.json. Repository root source is not supported.
10
10
  required: false
11
11
  default: ./docs
12
12
  destination:
@@ -27,13 +27,13 @@ inputs:
27
27
  description: Canonical site URL override.
28
28
  required: false
29
29
  skip-untitled-markdown:
30
- description: Skip Markdown files without an H1 instead of failing.
30
+ description: Skip Markdown files without a page title instead of failing.
31
31
  required: false
32
32
  default: "false"
33
- check-links:
34
- description: Warn about broken internal links after build.
33
+ skip-link-check:
34
+ description: Skip internal link checking after the site is built.
35
35
  required: false
36
- default: "true"
36
+ default: "false"
37
37
  runs:
38
38
  using: node24
39
39
  main: dist/action.js
package/dist/action.js CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env node
2
+ import { createRequire as __zeropressCreateRequire } from "node:module";
3
+ const require = __zeropressCreateRequire(import.meta.url);
2
4
  var __create = Object.create;
3
5
  var __defProp = Object.defineProperty;
4
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -62137,7 +62139,7 @@ async function linkExists(siteDir, link2) {
62137
62139
  // src/index.js
62138
62140
  var __dirname = path3.dirname(fileURLToPath(import.meta.url));
62139
62141
  var packageDir = path3.resolve(__dirname, "..");
62140
- var prebuildScript = path3.join(packageDir, "src", "prebuild.js");
62142
+ var prebuildScript = __dirname === path3.join(packageDir, "dist") ? path3.join(__dirname, "prebuild.js") : path3.join(packageDir, "src", "prebuild.js");
62141
62143
  var PREVIEW_DATA_PATH = ".zeropress/preview-data.json";
62142
62144
  var STAGING_DIR = ".zeropress/public-assets";
62143
62145
  var DEFAULT_THEME = "docs";
@@ -62149,6 +62151,13 @@ async function runBuildPages(options2) {
62149
62151
  const stagingDir = path3.join(cwd, STAGING_DIR);
62150
62152
  const previewDataPath = path3.join(cwd, PREVIEW_DATA_PATH);
62151
62153
  const themeDir = resolveThemeDir(cwd, options2);
62154
+ assertBuildPagesPathLayout({
62155
+ cwd,
62156
+ sourceDir,
62157
+ destinationDir,
62158
+ themeDir,
62159
+ generatedDir
62160
+ });
62152
62161
  await assertDirectory(sourceDir, "Source directory");
62153
62162
  await fs3.rm(generatedDir, { recursive: true, force: true });
62154
62163
  await fs3.mkdir(generatedDir, { recursive: true });
@@ -62195,7 +62204,7 @@ async function runBuildPages(options2) {
62195
62204
  process.env.ZEROPRESS_PUBLIC_DIR = previousPublicDir;
62196
62205
  }
62197
62206
  }
62198
- if (options2.checkLinks) {
62207
+ if (!options2.skipLinkCheck) {
62199
62208
  const result = await checkInternalLinks(destinationDir);
62200
62209
  if (result.brokenLinks.length) {
62201
62210
  console.warn("Warning: broken internal links found:");
@@ -62229,6 +62238,26 @@ async function assertDirectory(dir, label) {
62229
62238
  throw new Error(`${label} is not a directory: ${dir}`);
62230
62239
  }
62231
62240
  }
62241
+ function assertBuildPagesPathLayout({ cwd, sourceDir, destinationDir, themeDir, generatedDir }) {
62242
+ if (samePath(sourceDir, cwd)) {
62243
+ throw new Error(
62244
+ `Source directory must be a dedicated content directory, not the current working directory. Received: ${formatPath(cwd, sourceDir)}`
62245
+ );
62246
+ }
62247
+ assertNoPathOverlap(cwd, "Source directory", sourceDir, "internal .zeropress working directory", generatedDir);
62248
+ assertNoPathOverlap(cwd, "Destination directory", destinationDir, "internal .zeropress working directory", generatedDir);
62249
+ assertNoPathOverlap(cwd, "Theme directory", themeDir, "internal .zeropress working directory", generatedDir);
62250
+ assertNoPathOverlap(cwd, "Source directory", sourceDir, "destination directory", destinationDir);
62251
+ assertNoPathOverlap(cwd, "Source directory", sourceDir, "theme directory", themeDir);
62252
+ }
62253
+ function assertNoPathOverlap(cwd, firstLabel, firstPath, secondLabel, secondPath) {
62254
+ if (!pathsOverlap2(firstPath, secondPath)) {
62255
+ return;
62256
+ }
62257
+ throw new Error(
62258
+ `${firstLabel} must not overlap the ${secondLabel}. ${firstLabel}: ${formatPath(cwd, firstPath)}; ${secondLabel}: ${formatPath(cwd, secondPath)}`
62259
+ );
62260
+ }
62232
62261
  async function copyPublicStaging(sourceDir, targetDir, options2) {
62233
62262
  const entries = await fs3.readdir(sourceDir, { withFileTypes: true });
62234
62263
  for (const entry of entries) {
@@ -62265,6 +62294,9 @@ function pathsOverlap2(firstPath, secondPath) {
62265
62294
  const second = path3.resolve(secondPath);
62266
62295
  return first === second || isPathInside2(first, second) || isPathInside2(second, first);
62267
62296
  }
62297
+ function samePath(firstPath, secondPath) {
62298
+ return path3.resolve(firstPath) === path3.resolve(secondPath);
62299
+ }
62268
62300
  function isPathInside2(parentPath, childPath) {
62269
62301
  const relativePath = path3.relative(parentPath, childPath);
62270
62302
  return Boolean(relativePath) && !relativePath.startsWith("..") && !path3.isAbsolute(relativePath);
@@ -62283,7 +62315,7 @@ var options = {
62283
62315
  config: input("config"),
62284
62316
  siteUrl: input("site-url"),
62285
62317
  skipUntitledMarkdown: booleanInput("skip-untitled-markdown", false),
62286
- checkLinks: booleanInput("check-links", true)
62318
+ skipLinkCheck: booleanInput("skip-link-check", false)
62287
62319
  };
62288
62320
  try {
62289
62321
  await runBuildPages(options);