@heroiclands/package-build 3.1.0 → 3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @heroiclands/package-build
2
2
 
3
+ ## 3.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a5f07a3: Let a system-agnostic module stamp no system version.
8
+
9
+ #40 made `stats.systemId` optional. `stats.systemVersion` stayed mandatory and
10
+ derived — from the `compatibility.verified` of a declared system relationship,
11
+ throwing when there is none — and a data configuration may not declare it
12
+ directly. A module that deliberately targets no system therefore could not be
13
+ configured at all.
14
+
15
+ Declaring the relationship is not an escape. Foundry's `_testSupportedSystems`
16
+ returns true when a package declares no systems, but returns false when it
17
+ declares some and none of them is installed. Naming `hm3` and `sohl` would make
18
+ such a module unavailable to a world running anything else — the opposite of
19
+ what a system-agnostic package is for.
20
+
21
+ `shippedSystemVersion` now returns `null` when a module names **neither** a
22
+ `stats.systemId` **nor** any `relationships.systems`, and `stats.systemVersion`
23
+ is optional alongside it. Every other case is unchanged: a module that names a
24
+ system but declares no usable relationship still throws, because that is the
25
+ mistake #1548 added the guard for. The two signals together are what separate
26
+ system-agnostic on purpose from a forgotten declaration.
27
+
3
28
  ## 3.1.0
4
29
 
5
30
  ### Minor Changes
@@ -816,10 +816,15 @@ function normalizeStats(value) {
816
816
  input.systemId === undefined || input.systemId === null ?
817
817
  null
818
818
  : requireNonEmptyString(input.systemId, "stats.systemId"),
819
- systemVersion: requireNonEmptyString(
820
- input.systemVersion,
821
- "stats.systemVersion",
822
- ),
819
+ // Optional for the same reason as `systemId`: a system-agnostic module
820
+ // is not built against a system, so it has no version of one to stamp.
821
+ systemVersion:
822
+ input.systemVersion === undefined || input.systemVersion === null ?
823
+ null
824
+ : requireNonEmptyString(
825
+ input.systemVersion,
826
+ "stats.systemVersion",
827
+ ),
823
828
  lastModifiedBy: requireNonEmptyString(
824
829
  input.lastModifiedBy,
825
830
  "stats.lastModifiedBy",
@@ -272,6 +272,23 @@ function shippedSystemVersion(rootDir, input) {
272
272
 
273
273
  const systemId = /** @type {Record<string, unknown>} */ (input.stats ?? {})
274
274
  .systemId;
275
+ const declaredSystems = /** @type {Record<string, unknown>} */ (
276
+ input.relationships ?? {}
277
+ ).systems;
278
+
279
+ // A module that names neither a system nor a relationship with one is
280
+ // system-agnostic on purpose: its packs are core document types carrying no
281
+ // system data, and it installs under any system. There is no version to
282
+ // stamp, and inventing one would be the very thing the throw below guards
283
+ // against. The two signals together are what separate this from a module
284
+ // that simply forgot to declare its system (#43).
285
+ if (
286
+ (systemId === undefined || systemId === null) &&
287
+ !(Array.isArray(declaredSystems) && declaredSystems.length)
288
+ ) {
289
+ return null;
290
+ }
291
+
275
292
  const systems =
276
293
  /** @type {{id?: string, compatibility?: {verified?: string}}[]} */ (
277
294
  /** @type {Record<string, unknown>} */ (input.relationships ?? {})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heroiclands/package-build",
3
- "version": "3.1.0",
3
+ "version": "3.2.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",