@heroiclands/package-build 23.1.0 → 23.2.0

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.
Files changed (248) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/bin/content-commands.mjs +68 -149
  3. package/bin/package-build.mjs +56 -10
  4. package/ci/check-banners.mjs +42 -6
  5. package/ci/confirm-npm-version.mjs +135 -0
  6. package/ci/content-format-reference.mjs +14 -5
  7. package/config.mjs +1 -0
  8. package/container.mjs +185 -4
  9. package/content-config.mjs +333 -210
  10. package/deploy.mjs +116 -10
  11. package/docs/api.md +238 -246
  12. package/docs/authoring/assets.md +11 -5
  13. package/docs/authoring/frontmatter.md +1 -1
  14. package/docs/authoring/links-and-markup.md +87 -0
  15. package/docs/commands.md +138 -99
  16. package/docs/configuration.md +277 -125
  17. package/docs/content-format.md +2 -0
  18. package/docs/diagnostics.md +48 -13
  19. package/docs/guides/book.md +341 -21
  20. package/docs/guides/e2e.md +13 -2
  21. package/docs/guides/icons.md +14 -4
  22. package/docs/guides/module-project.md +18 -8
  23. package/docs/guides/release-and-deploy.md +54 -6
  24. package/docs/guides/site.md +5 -2
  25. package/docs/project-setup.md +30 -10
  26. package/docs/reference/format-details.md +373 -170
  27. package/docs/reference/note-types.md +128 -109
  28. package/docs/reference/theme-pages.md +31 -6
  29. package/e2e.mjs +140 -28
  30. package/engine/actor-compiler.mjs +22 -31
  31. package/engine/address-charset.mjs +4 -17
  32. package/engine/address-fields.mjs +1 -1
  33. package/engine/address-render.mjs +12 -1
  34. package/engine/address-values.mjs +6 -0
  35. package/engine/address.mjs +46 -33
  36. package/engine/art-fields.mjs +30 -5
  37. package/engine/art-slots.mjs +10 -1
  38. package/engine/asset-bindings.mjs +12 -1
  39. package/engine/base-compiler.mjs +34 -65
  40. package/engine/being-age.mjs +2 -7
  41. package/engine/being-measurements.mjs +12 -1
  42. package/engine/calendar-artifacts.mjs +6 -0
  43. package/engine/calendar-choice.mjs +12 -1
  44. package/engine/calendar-format.mjs +12 -1
  45. package/engine/calendar-human.mjs +12 -1
  46. package/engine/compile-corpus.mjs +3 -1
  47. package/engine/content-address.mjs +9 -12
  48. package/engine/content-alerts.mjs +13 -1
  49. package/engine/content-blocks.mjs +14 -3
  50. package/engine/content-embeds.mjs +11 -3
  51. package/engine/content-figures.mjs +9 -0
  52. package/engine/content-footnotes.mjs +12 -1
  53. package/engine/content-format-check.mjs +11 -262
  54. package/engine/content-format.yaml +5 -2
  55. package/engine/content-images.mjs +3 -0
  56. package/engine/content-index.mjs +443 -20
  57. package/engine/content-links.mjs +29 -35
  58. package/engine/content-lint.mjs +2 -3
  59. package/engine/content-poetry.mjs +12 -1
  60. package/engine/content-slug.mjs +2 -14
  61. package/engine/content-spans.mjs +13 -1
  62. package/engine/content-tables.mjs +12 -1
  63. package/engine/culture-choice.mjs +210 -13
  64. package/engine/data-keys.mjs +19 -16
  65. package/engine/date-conversion.mjs +12 -1
  66. package/engine/declaration-check.mjs +9 -0
  67. package/engine/derived-fields.mjs +6 -7
  68. package/engine/diagnostics.mjs +34 -4
  69. package/engine/docs-checks.mjs +9 -0
  70. package/engine/document-subtypes.mjs +47 -34
  71. package/engine/event-views.mjs +139 -14
  72. package/engine/exported-scene.mjs +92 -28
  73. package/engine/extension-attributes.mjs +12 -1
  74. package/engine/field-spec.mjs +11 -102
  75. package/engine/folder-notes.mjs +0 -64
  76. package/engine/foreign-catalog.mjs +2 -1
  77. package/engine/format-generated.mjs +9 -0
  78. package/engine/foundry-entries.mjs +10 -28
  79. package/engine/frontmatter-lint.mjs +83 -392
  80. package/engine/frontmatter.mjs +20 -70
  81. package/engine/generate.mjs +10 -15
  82. package/engine/heading-attributes.mjs +12 -1
  83. package/engine/helpers.mjs +41 -102
  84. package/engine/holdings.mjs +1 -1
  85. package/engine/homepage.mjs +3 -10
  86. package/engine/ids.mjs +1 -167
  87. package/engine/index-records.mjs +6 -4
  88. package/engine/index.mjs +0 -3
  89. package/engine/infobox-render.mjs +15 -3
  90. package/engine/infobox.mjs +13 -14
  91. package/engine/item-compiler.mjs +4 -10
  92. package/engine/item-docs.mjs +3 -5
  93. package/engine/item-registry.mjs +2 -10
  94. package/engine/journals.mjs +1 -5
  95. package/engine/literature-notes.mjs +4 -12
  96. package/engine/macros.mjs +1 -2
  97. package/engine/map-graphviz.mjs +12 -1
  98. package/engine/markdown-expressions.mjs +12 -1
  99. package/engine/markdownlint-run.mjs +567 -0
  100. package/engine/metadata-index.mjs +42 -12
  101. package/engine/note-addresses.mjs +143 -35
  102. package/engine/note-claims.mjs +14 -28
  103. package/engine/note-dates.mjs +3 -3
  104. package/engine/note-frontmatter.mjs +6 -0
  105. package/engine/note-ids.mjs +8 -14
  106. package/engine/note-package.mjs +8 -25
  107. package/engine/note-state.mjs +1 -3
  108. package/engine/note-vocabulary.mjs +148 -84
  109. package/engine/number-words.mjs +12 -1
  110. package/engine/pack-config.mjs +15 -25
  111. package/engine/pack-router.mjs +10 -16
  112. package/engine/pathnames.mjs +8 -22
  113. package/engine/pdf-build.mjs +773 -121
  114. package/engine/pdf-coverage.mjs +188 -0
  115. package/engine/pdf-index.mjs +54 -7
  116. package/engine/pdf-pages.mjs +247 -0
  117. package/engine/pdf-render.mjs +114 -4
  118. package/engine/pdf-toc.mjs +29 -32
  119. package/engine/project-init.mjs +46 -6
  120. package/engine/prose-config.mjs +1 -1
  121. package/engine/prose-lint.mjs +52 -88
  122. package/engine/readability-lint.mjs +9 -0
  123. package/engine/reckoning-markers.mjs +12 -1
  124. package/engine/reference-targets.mjs +7 -0
  125. package/engine/runtime-only-fields.mjs +5 -8
  126. package/engine/scene-levels.mjs +2 -2
  127. package/engine/scenes.mjs +1 -1
  128. package/engine/shortcode-references.mjs +7 -0
  129. package/engine/site-build.mjs +30 -16
  130. package/engine/site-index.mjs +10 -16
  131. package/engine/site-preview.mjs +6 -0
  132. package/engine/site-root.mjs +8 -1
  133. package/engine/social-tie-terms.mjs +12 -1
  134. package/engine/social-ties.mjs +3 -0
  135. package/engine/sql-tables.mjs +56 -20
  136. package/engine/standing-terms.mjs +11 -1
  137. package/engine/standings.mjs +11 -27
  138. package/engine/system-block.mjs +39 -141
  139. package/engine/system-vocabulary.mjs +6 -0
  140. package/engine/walk-files.mjs +69 -0
  141. package/engine/web-wikilinks.mjs +23 -3
  142. package/engine/wikilink-syntax.mjs +32 -21
  143. package/engine/wikilinks.mjs +27 -16
  144. package/engine/yaml-lint.mjs +7 -4
  145. package/githooks/attribution.mjs +8 -0
  146. package/githooks/commit-message.mjs +9 -0
  147. package/hm3/actors.mjs +9 -48
  148. package/hm3/default-item-art.mjs +9 -9
  149. package/hm3/item-fields.mjs +2 -9
  150. package/hm3/template-priority.mjs +6 -7
  151. package/hugo-theme/data/banner-kinds.yaml +78 -0
  152. package/hugo-theme/data/banners.yaml +2 -3
  153. package/hugo-theme/layouts/404.html +3 -3
  154. package/hugo-theme/layouts/partials/banner-url.html +31 -7
  155. package/hugo-theme/layouts/partials/hero-banner.html +13 -14
  156. package/hugo-theme/layouts/partials/related.html +1 -1
  157. package/hugo-theme/layouts/partials/warn-missing-banner.html +1 -1
  158. package/hugo-theme/static/css/style.css +1 -1
  159. package/manifest.mjs +11 -4
  160. package/markdownlint-config.mjs +1 -1
  161. package/package.json +6 -3
  162. package/release.mjs +83 -18
  163. package/sohl/actors.mjs +16 -27
  164. package/sohl/default-item-art.mjs +3 -3
  165. package/sohl/document-subtypes.mjs +1 -16
  166. package/sohl/infobox.mjs +2 -3
  167. package/sohl/item-builders.mjs +5 -8
  168. package/sohl/item-fields.mjs +5 -35
  169. package/sohl/items.mjs +0 -4
  170. package/sohl/kb-passes.mjs +3 -3
  171. package/types/container.d.mts +116 -5
  172. package/types/content-config.d.mts +83 -35
  173. package/types/deploy.d.mts +42 -6
  174. package/types/e2e.d.mts +35 -3
  175. package/types/engine/address-charset.d.mts +4 -17
  176. package/types/engine/address.d.mts +17 -8
  177. package/types/engine/art-fields.d.mts +7 -4
  178. package/types/engine/art-slots.d.mts +6 -0
  179. package/types/engine/base-compiler.d.mts +15 -17
  180. package/types/engine/content-address.d.mts +9 -12
  181. package/types/engine/content-embeds.d.mts +4 -2
  182. package/types/engine/content-format-check.d.mts +0 -64
  183. package/types/engine/content-index.d.mts +82 -3
  184. package/types/engine/content-links.d.mts +2 -4
  185. package/types/engine/culture-choice.d.mts +51 -8
  186. package/types/engine/data-keys.d.mts +2 -2
  187. package/types/engine/derived-fields.d.mts +1 -2
  188. package/types/engine/diagnostics.d.mts +27 -4
  189. package/types/engine/document-subtypes.d.mts +12 -31
  190. package/types/engine/event-views.d.mts +14 -2
  191. package/types/engine/exported-scene.d.mts +3 -2
  192. package/types/engine/field-spec.d.mts +13 -122
  193. package/types/engine/folder-notes.d.mts +0 -39
  194. package/types/engine/foreign-catalog.d.mts +2 -1
  195. package/types/engine/foundry-entries.d.mts +4 -5
  196. package/types/engine/frontmatter-lint.d.mts +2 -2
  197. package/types/engine/frontmatter.d.mts +19 -45
  198. package/types/engine/generate.d.mts +1 -1
  199. package/types/engine/helpers.d.mts +25 -42
  200. package/types/engine/homepage.d.mts +3 -10
  201. package/types/engine/ids.d.mts +0 -114
  202. package/types/engine/index-records.d.mts +6 -4
  203. package/types/engine/index.d.mts +0 -1
  204. package/types/engine/infobox-render.d.mts +7 -1
  205. package/types/engine/infobox.d.mts +3 -2
  206. package/types/engine/item-docs.d.mts +1 -1
  207. package/types/engine/item-registry.d.mts +2 -4
  208. package/types/engine/literature-notes.d.mts +1 -1
  209. package/types/engine/markdownlint-run.d.mts +40 -0
  210. package/types/engine/metadata-index.d.mts +9 -1
  211. package/types/engine/note-addresses.d.mts +27 -2
  212. package/types/engine/note-claims.d.mts +3 -5
  213. package/types/engine/note-ids.d.mts +2 -4
  214. package/types/engine/note-package.d.mts +1 -1
  215. package/types/engine/note-state.d.mts +1 -3
  216. package/types/engine/note-vocabulary.d.mts +28 -21
  217. package/types/engine/pack-config.d.mts +2 -6
  218. package/types/engine/pack-router.d.mts +4 -4
  219. package/types/engine/pathnames.d.mts +3 -3
  220. package/types/engine/pdf-build.d.mts +98 -12
  221. package/types/engine/pdf-coverage.d.mts +60 -0
  222. package/types/engine/pdf-index.d.mts +34 -5
  223. package/types/engine/pdf-pages.d.mts +143 -0
  224. package/types/engine/pdf-render.d.mts +45 -1
  225. package/types/engine/pdf-toc.d.mts +12 -14
  226. package/types/engine/prose-config.d.mts +1 -1
  227. package/types/engine/prose-lint.d.mts +11 -10
  228. package/types/engine/runtime-only-fields.d.mts +2 -2
  229. package/types/engine/site-build.d.mts +9 -5
  230. package/types/engine/site-index.d.mts +4 -5
  231. package/types/engine/site-root.d.mts +1 -1
  232. package/types/engine/sql-tables.d.mts +31 -2
  233. package/types/engine/standing-terms.d.mts +2 -1
  234. package/types/engine/standings.d.mts +7 -9
  235. package/types/engine/system-block.d.mts +10 -44
  236. package/types/engine/walk-files.d.mts +15 -0
  237. package/types/engine/wikilink-syntax.d.mts +18 -19
  238. package/types/engine/yaml-lint.d.mts +5 -4
  239. package/types/hm3/actors.d.mts +1 -2
  240. package/types/hm3/item-fields.d.mts +2 -4
  241. package/types/hm3/template-priority.d.mts +6 -7
  242. package/types/manifest.d.mts +3 -2
  243. package/types/release.d.mts +12 -7
  244. package/types/sohl/actors.d.mts +2 -1
  245. package/types/sohl/document-subtypes.d.mts +1 -2
  246. package/types/sohl/item-fields.d.mts +3 -7
  247. package/engine/retired-fields.mjs +0 -631
  248. package/types/engine/retired-fields.d.mts +0 -354
@@ -54,6 +54,33 @@ also builds a PDF beside the archive. Book findings are reported without
54
54
  discarding the installable archive. `package-build release --no-pdf` skips the
55
55
  book step. The [book guide](book.md) covers selecting and checking its pages.
56
56
 
57
+ ### Release assets
58
+
59
+ A package that declares several books in `pdf.books` publishes all of them
60
+ with its release. Each book is its own PDF in `pdf.out` (default
61
+ `build/dist`), named `<out stem>-<version>.pdf`: the stem is the book's `out`, which defaults to
62
+ `<contentPackage>-<id>`, and the version is the package version. A package
63
+ declaring `core` and `vedyara` under the content package `thalorna` releases
64
+ `thalorna-core-1.4.0.pdf` and `thalorna-vedyara-1.4.0.pdf`, beside the Foundry
65
+ archive and manifest. The release workflow attaches exactly the files
66
+ `package-build pdf --list-assets` names. A declared book whose file is missing
67
+ or empty fails the release; a package with one book attaches one.
68
+
69
+ The release notes are the top section of `CHANGELOG.md`. When the package
70
+ declares books, they end with a **Books** section: one line per book, in
71
+ `pdf.books` order, giving its title and the file attached for it.
72
+
73
+ ```markdown
74
+ **Books**
75
+
76
+ - The World of Thalorna: `thalorna-core-1.4.0.pdf`
77
+ - Vedyara: `thalorna-vedyara-1.4.0.pdf`
78
+ ```
79
+
80
+ `package-build pdf --list-assets --book-version <version>` prints each book's
81
+ `id`, `title` and output path as JSON without building anything, which is how
82
+ the workflow derives both the attachments and the lines. A package with no books gets no Books section.
83
+
57
84
  The repository's build scripts decide how the staged tree is assembled. A
58
85
  typical content build runs `package-build content-index`,
59
86
  `package-build assets`, `package-build package compile`, and
@@ -89,6 +116,11 @@ for the package. Paths in `.env.local` are literal: `~` and shell variables
89
116
  are not expanded. Keep stage paths pointed at distinct Foundry data roots.
90
117
  The deploy command stages a complete copy beside the installed package and
91
118
  swaps it into place, so it does not rewrite open LevelDB files one by one.
119
+ It then removes the previous tree, and any an earlier deploy left behind;
120
+ files Foundry's container wrote there are
121
+ removed through a throwaway container of the stage's image, and a tree that
122
+ still cannot be removed is reported as a warning naming it, without failing the
123
+ deploy.
92
124
  For a remote destination it uses the SSH agent unless the stage names an
93
125
  explicit key. The `container` command manages the Foundry Docker instance for
94
126
  the same stage;
@@ -105,12 +137,28 @@ change is minor; an optional command, flag, or key is patch. A major bump
105
137
  requires the maintainer's direct decision. `package-build changelog check`
106
138
  checks the quality of any pending changeset.
107
139
 
108
- Merging a changeset to `main` makes the **Version Packages** pull request. Its
109
- generated changelog section is reviewed as the release note. Merging that
110
- pull request runs the **Publish to npm** workflow: npm Trusted Publishing
111
- publishes the version, and the workflow creates its version tag and GitHub
112
- Release. The workflow's manual dispatch can retry publishing a version already
113
- merged to `main`. The [npm package page](https://www.npmjs.com/package/@heroiclands/package-build)
140
+ The repository's primary forge is Gitea, and GitHub is its push mirror. The
141
+ release runs in two halves, one on each:
142
+
143
+ 1. **Version, on Gitea.** Merging a changeset to `main` runs
144
+ `.gitea/workflows/release.yml`, which opens or updates the **Version
145
+ Packages** pull request. Its generated changelog section is reviewed as the
146
+ release note. Merging that pull request runs the same workflow again, which
147
+ pushes the tag `v<version>` at the merged version commit. Releasing from
148
+ Gitea is switched on by the repository variable `HL_RELEASE_ENABLED`.
149
+ 2. **Publish, on GitHub.** The push mirror carries the tag to GitHub, where it
150
+ starts the **Publish to npm** workflow, `.github/workflows/release.yml`. It
151
+ refuses a tag that names a commit outside `main` or that is not
152
+ `v<version>` of the tagged `package.json`. When npm does not have the
153
+ version yet, it runs the tests and publishes through npm Trusted Publishing
154
+ with provenance. It then creates the GitHub Release from the version's
155
+ changelog section, unless one exists.
156
+
157
+ Nothing on Gitea publishes to npm, and nothing on GitHub runs for a branch
158
+ push. Every step of the GitHub half is safe to repeat: re-running it, or
159
+ dispatching it with the tag as its ref, finishes a release whose publish or
160
+ Release step failed and changes nothing for one that completed. The
161
+ [npm package page](https://www.npmjs.com/package/@heroiclands/package-build)
114
162
  shows the published version and README.
115
163
 
116
164
  Two scripts in this repository's own `package.json` run the same steps at a
@@ -153,7 +153,7 @@ tree rather than about one note, so the build replaces whatever a note wrote.
153
153
 
154
154
  Artwork addresses are rewritten in place under `data`. A page's `data.icon`,
155
155
  `data.tokenIcon` and `data.banner` carry the URLs the site serves rather than the
156
- addresses the note authored, and there are four cases to tell apart:
156
+ addresses the note authored, and there are five cases to tell apart:
157
157
 
158
158
  | The note writes | The page carries |
159
159
  | ---------------------------- | ---------------- |
@@ -161,12 +161,15 @@ addresses the note authored, and there are four cases to tell apart:
161
161
  | an address nothing answers | no key at all |
162
162
  | `null` | `null` |
163
163
  | `""` | `""` |
164
+ | `data.banner: none` | `""` |
164
165
 
165
166
  An address nothing answers is deleted rather than written through, so an absent
166
167
  key is the ordinary case for a theme to render nothing against, and no page
167
168
  reaches a reader carrying a broken image source. The two empties are distinct
168
169
  and both survive: `null` is a note naming no art, where a default may apply,
169
- and `""` is a note refusing art, where no default may replace it.
170
+ and `""` is a note refusing art, where no default may replace it. A note
171
+ writes `none` to refuse a hero image, since `""` is an error in authored
172
+ frontmatter.
170
173
 
171
174
  The build writes these keys; [what the theme draws](../reference/theme-pages.md)
172
175
  describes the panel each one feeds — the infobox, the hero band, the related
@@ -229,7 +229,7 @@ git worktree where `node_modules` is already correct.
229
229
 
230
230
  `build:stage-reset` clears only the assembled Foundry package. Keep it before
231
231
  every stage writer, including a repository's own code or stylesheet bundle
232
- step. This keeps renamed and deleted files out of the next package while
232
+ step. This keeps moved and deleted files out of the next package while
233
233
  preserving the content index and other generated outputs.
234
234
 
235
235
  Within the chain, two orderings are real:
@@ -349,15 +349,35 @@ options the toolchain applies — without it they fall back to Prettier's own
349
349
  defaults, and a print width that differs from the project's turns every
350
350
  save into a diff the lint chain reverts.
351
351
 
352
- `package-build markdown` needs no equivalent file: it hands the shared rule set
353
- to markdownlint directly, and a repository that declares nothing gets it. A
354
- `.markdownlint-cli2.jsonc` is for the editor's markdownlint extension, and
355
- [`@heroiclands/package-build/markdownlint`](api.md) is the export it re-uses —
356
- with one trap worth knowing before writing one. A consumer file overrides the
357
- shared configuration **key by key, and each key wholesale**: declaring only
358
- `ignores` keeps every rule intact but _replaces_ the shared ignore list rather
359
- than extending it, so such a file must restate `CHANGELOG.md` if it still wants
360
- that file excluded. The command always excludes `node_modules`.
352
+ `package-build markdown` needs no equivalent file: it applies the shared rule
353
+ set through the markdownlint library, and a repository that declares nothing
354
+ gets it. A `.markdownlint-cli2.jsonc` (or `.yaml`, `.cjs`, `.mjs`) at the
355
+ repository root overrides it and is what the editor's markdownlint extension
356
+ reads, and [`@heroiclands/package-build/markdownlint`](api.md) is the export it
357
+ re-uses — with one trap worth knowing before writing one. A consumer file
358
+ overrides the shared configuration **key by key, and each key wholesale**:
359
+ declaring only `ignores` keeps every rule intact but _replaces_ the shared ignore
360
+ list rather than extending it, so such a file must restate `CHANGELOG.md` if it
361
+ still wants that file excluded. The command always excludes `node_modules` and
362
+ `.git`.
363
+
364
+ The options file accepts a closed set of keys, and any other key is refused with
365
+ a located diagnostic:
366
+
367
+ | Key | Where | Meaning |
368
+ | ---------------- | -------------------- | ------------------------------------------------------------------------- |
369
+ | `config` | any directory | Rule settings, merged rule by rule over the settings above it. |
370
+ | `customRules` | any directory | Module ids (resolved from that directory) or rule objects to add. |
371
+ | `frontMatter` | any directory | Regular expression source matching a front matter block. |
372
+ | `ignores` | any directory | Globs, relative to that directory, whose files are skipped. |
373
+ | `noInlineConfig` | any directory | `true` to disregard `<!-- markdownlint-... -->` comments. |
374
+ | `globs` | repository root only | Globs of files to lint, in addition to `**/*.md` when no paths are named. |
375
+ | `gitignore` | repository root only | `false` to lint files that `.gitignore` files exclude; `true` by default. |
376
+
377
+ An options file in a subdirectory applies to that directory and below, merged
378
+ over the root's. A `.markdownlint.jsonc`, `.json`, `.yaml`, `.yml`, `.cjs` or
379
+ `.mjs` file holds a rule `config` directly and replaces the merged `config` for
380
+ its directory.
361
381
 
362
382
  ## `.prettierignore`
363
383