@arc-e-tect/api-only-publisher 0.19.0 → 0.19.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/README.adoc CHANGED
@@ -6,7 +6,7 @@
6
6
  :source-highlighter: rouge
7
7
  // The released version of this component: its snippets use it. The release
8
8
  // workflow updates it; do not change it by hand.
9
- :api-only-publisher-version: 0.19.0
9
+ :api-only-publisher-version: 0.19.1
10
10
 
11
11
  [NOTE]
12
12
  .About this documentation
@@ -490,6 +490,7 @@ Below 1.0 each moves one place down: a major becomes a minor, a minor a patch.
490
490
  It is a hint, not a compatibility analysis: it may call a compatible change a major, and the version you choose is yours.
491
491
 
492
492
  The baseline is built with its own `apionly.yaml` and its own toolchain pin, so it is the document that was released.
493
+ Its `versioning` section is not read: it does not shape a document, the guard takes it from today's `apionly.yaml`, and a key renamed since -- `mainBranch`, now `baseBranch` -- would otherwise stop the baseline from being read at all.
493
494
  When that pin cannot be had -- a sealed image carries only today's bundler, and downloading is off -- the baseline is built with today's pin instead, and the reason says so.
494
495
  A baseline that cannot be built at all leaves the target `undecided`, saying why.
495
496
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arc-e-tect/api-only-publisher",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "description": "Builds, packs and publishes API description documents from a library of reusable fragments.",
5
5
  "license": "MIT",
6
6
  "author": "Arc-E-Tect",
package/src/documents.js CHANGED
@@ -72,6 +72,21 @@ function exportRef(repoRoot, ref, libRel, into) {
72
72
  execFileSync("tar", ["-x", "-f", "-", "-C", into], { input: archive, stdio: ["pipe", "ignore", "pipe"] });
73
73
  }
74
74
 
75
+ /**
76
+ * Drop the `versioning` section from a baseline's copy of apionly.yaml.
77
+ *
78
+ * It does not shape a document: it only tells the guard where to look, and the guard
79
+ * reads it from today's configuration. A baseline from before a key in it was renamed
80
+ * -- `mainBranch`, `baseBranch` since 0.18.5 -- could otherwise not be read at all, and
81
+ * every target would be left undecided (#123).
82
+ */
83
+ function withoutVersioning(file) {
84
+ const document = YAML.parseDocument(fs.readFileSync(file, "utf8"));
85
+ if (!YAML.isMap(document.contents) || !document.contents.has("versioning")) return;
86
+ document.contents.delete("versioning");
87
+ fs.writeFileSync(file, document.toString());
88
+ }
89
+
75
90
  /**
76
91
  * Pin each tool of the copy's configuration to what this installation can run: its own
77
92
  * pin when that can be had, otherwise the one `current` pins. A baseline released with an
@@ -121,7 +136,9 @@ function targetDocuments(config, targets, { ref = null, repoRoot }) {
121
136
  try {
122
137
  if (ref === null) exportWorkingTree(repoRoot, libRel, scratch);
123
138
  else exportRef(repoRoot, ref, libRel, scratch);
124
- copy = load(path.join(scratch, libRel, configRel));
139
+ const configFile = path.join(scratch, libRel, configRel);
140
+ if (ref !== null) withoutVersioning(configFile);
141
+ copy = load(configFile);
125
142
  notes = usableToolchain(copy, config, ["openapi", "asyncapi"]);
126
143
  } catch (error) {
127
144
  for (const target of targets) documents.set(target, { error });