@heroiclands/package-build 3.3.0 → 3.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,84 @@
1
1
  # @heroiclands/package-build
2
2
 
3
+ ## 3.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 19df269: Stop emitting `assocMysteryCode` on a compiled mystical ability (#35).
8
+
9
+ The `mysticalability` declaration named a field no SoHL DataModel receives.
10
+ `MysticalAbilityDataModel` declares `subType`, `assocSkillCode`,
11
+ `assocAffiliationCode`, `masteryLevelBase`, `improveFlag`, `levelBase` and
12
+ `charges`, and nothing else — Foundry discards the extra key when the document
13
+ is constructed, so every mystical ability in every consuming pack shipped a
14
+ value that was thrown away at load, with nothing at compile or load time saying
15
+ so.
16
+
17
+ This is the exact inverse of #3 and has the same root cause: nothing compares a
18
+ builder's emitted `system` block against the DataModel that receives it. #3 was a
19
+ declared field the builder failed to emit; this is an emitted field the DataModel
20
+ never declares. Both compile clean, both lose data silently, and an author cannot
21
+ tell either from a correct build. The general check is #60.
22
+
23
+ **The field was retired, not renamed.**
24
+ Song-of-Heroic-Lands-FoundryVTT#973 deleted `assocMysteryCode` because nothing in
25
+ production read the mystery it resolved to; #1012 later added
26
+ `assocAffiliationCode` as a separate concept — the faction whose standing confers
27
+ the ability. They look alike and mean different things, so the declaration is
28
+ dropped rather than retargeted.
29
+
30
+ **This changes emitted documents**, so a consumer wants a rebuild rather than a
31
+ silent upgrade — though nothing downstream can have depended on the value:
32
+
33
+ - `sohl` — nine notes authored the key, all of them blank. Corrected in
34
+ Song-of-Heroic-Lands-FoundryVTT#1747.
35
+ - `sohl-kethira-basic` — no note authors it; all 224 mystical abilities carried
36
+ the builder's own `""`. Recompiling `main` with this change removes exactly
37
+ those 224 lines and touches nothing else.
38
+ - dced8b2: Write the derived package into an emitted page's frontmatter (#65).
39
+
40
+ `content-build site` copied a note's frontmatter to the page verbatim. Since
41
+ 3.3.0 a note need not declare `package:` — it is derived from the configured
42
+ `contentPackage` — and `engine/site-build.mjs` resolved that value one line
43
+ before it built the page, carrying it for the index, the table universe and the
44
+ local-package set. It never reached the page's own frontmatter, so a swept tree
45
+ published pages that said nothing about which package they belong to.
46
+
47
+ **The visible symptom is the breadcrumb.**
48
+ `@heroiclands/hugo-theme`'s `layouts/partials/breadcrumbs.html` reads
49
+ `{{ $pkg := .Params.package | default "" }}` and builds the middle crumb from
50
+ it. With no `package` the section is never resolved and the crumb degrades from
51
+ a linked, labelled section to a bare, unlinked type slug:
52
+
53
+ ```text
54
+ before: Home > SoHL Affliction > Aconite (linked)
55
+ after: Home > affliction > Aconite (bare)
56
+ ```
57
+
58
+ Consumer layouts reading the field directly degrade the same way — a `package`
59
+ column renders blank.
60
+
61
+ The fix is where the value was already known: `pageFrontmatter` spreads
62
+ `package` after the note's own frontmatter, so a note that declares the field
63
+ keeps its authored position and value and an unswept tree emits byte-identically,
64
+ while a swept one regains the line it lost. The alternative — teaching every
65
+ theme and consumer layout to default the package from a site parameter — pushes
66
+ a fact the build already knows out to N consumers, and the theme deliberately
67
+ carries no addresses.
68
+
69
+ **This changes emitted output**, so a consumer wants a rebuild rather than a
70
+ silent upgrade, which is why it is a minor rather than a patch — the same
71
+ reasoning as #35. Verified against the swept `sohl` tree: 1,606 emitted content
72
+ pages differ, none added or removed, and the only diff line class across the
73
+ whole tree is the restored `package: sohl`. Rendering that tree, 1,600 pages
74
+ differ and in exactly two ways — the breadcrumb's middle crumb, and a `package`
75
+ column that was blank.
76
+
77
+ `sohl-thalorna` has the same defect independently, in its own
78
+ `utils/build-site-content.mjs`, and is fixed in that repository
79
+ (sohl-thalorna#79) — two emitters, one behaviour, which is a second argument
80
+ for #36.
81
+
3
82
  ## 3.3.0
4
83
 
5
84
  ### Minor Changes
@@ -367,6 +367,16 @@ export function tableUniverse(pages) {
367
367
  * redirect stub at each name. They are dropped, and this build emits no
368
368
  * redirects of its own.
369
369
  *
370
+ * A content page carries the package the build **derived**, whether or not the
371
+ * note declared one (#65). `package:` became optional in 3.3.0, so a swept tree
372
+ * declares none — and the note's frontmatter alone would then publish a page
373
+ * that does not say which package it belongs to. The emitted page is what a
374
+ * theme reads: `breadcrumbs.html` builds its middle crumb from
375
+ * `.Params.package`, so without it that crumb degrades from a linked, labelled
376
+ * section to a bare type slug. Writing the derived value keeps a page
377
+ * self-describing and makes sweeping the field out of a content tree
378
+ * output-preserving for a site as it already is for the packs.
379
+ *
370
380
  * @param {object} page - The page.
371
381
  * @param {object} options - `{ sections, readmeSections, decorate }`.
372
382
  * @returns {object} The frontmatter to write.
@@ -375,7 +385,17 @@ export function pageFrontmatter(page, { readmeSections = {}, decorate }) {
375
385
  const { fm, name, slug, sec, isReadme } = page;
376
386
  let data;
377
387
  if (page.kind === "content") {
378
- data = { ...fm, slug, title: fm.title ?? name, kbfolder: page.folder };
388
+ data = {
389
+ ...fm,
390
+ // Spread after the note's own frontmatter, so a note that declares
391
+ // the field keeps its authored position and value and an unswept
392
+ // tree emits byte-identically. Guarded because `package: undefined`
393
+ // is not a value YAML can carry.
394
+ ...(page.pkg ? { package: page.pkg } : {}),
395
+ slug,
396
+ title: fm.title ?? name,
397
+ kbfolder: page.folder,
398
+ };
379
399
  if (decorate) decorate(data, page);
380
400
  if (isReadme) {
381
401
  const meta = readmeSections[sec];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heroiclands/package-build",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "Shared toolchain for building and shipping a HeroicLands Foundry VTT package — content compilation, manifest, localization, staging, bundle, release and deployment.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "type": "module",
@@ -598,14 +598,6 @@ export const ITEM_FIELDS = Object.freeze({
598
598
  describe:
599
599
  "Shortcode of the affiliation whose standing confers the ability — a religion, school, or ancestor/totem/spirit.",
600
600
  },
601
- {
602
- name: "assocMysteryCode",
603
- to: "assocMysteryCode",
604
- ref: "mystery",
605
- ...AS_AUTHORED,
606
- default: "",
607
- describe: "Shortcode of the mystery the ability draws on.",
608
- },
609
601
  {
610
602
  name: "masteryLevelBase",
611
603
  to: "masteryLevelBase",
@@ -84,6 +84,16 @@ export function tableUniverse(pages: object[]): Map<string, object[]>;
84
84
  * redirect stub at each name. They are dropped, and this build emits no
85
85
  * redirects of its own.
86
86
  *
87
+ * A content page carries the package the build **derived**, whether or not the
88
+ * note declared one (#65). `package:` became optional in 3.3.0, so a swept tree
89
+ * declares none — and the note's frontmatter alone would then publish a page
90
+ * that does not say which package it belongs to. The emitted page is what a
91
+ * theme reads: `breadcrumbs.html` builds its middle crumb from
92
+ * `.Params.package`, so without it that crumb degrades from a linked, labelled
93
+ * section to a bare type slug. Writing the derived value keeps a page
94
+ * self-describing and makes sweeping the field out of a content tree
95
+ * output-preserving for a site as it already is for the packs.
96
+ *
87
97
  * @param {object} page - The page.
88
98
  * @param {object} options - `{ sections, readmeSections, decorate }`.
89
99
  * @returns {object} The frontmatter to write.