@rightkit/git 0.2.9 → 0.2.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/git",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Public-repo-only GitHub Actions workflow layer: templates, visibility gate, sync/drift/adopt/uninstall for right-git.",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "type": "module",
package/render.mjs CHANGED
@@ -31,5 +31,8 @@ export function renderTemplate(templateText, context) {
31
31
  if (leftover) {
32
32
  throw new Error(`render: unresolved placeholder ${leftover[0]} remained after substitution`);
33
33
  }
34
- return rendered;
34
+ // Optional final job fragments may expand to an empty string. Normalize
35
+ // template EOF after substitution so managed workflows remain byte-stable
36
+ // with exactly one terminating newline.
37
+ return `${rendered.replace(/(?:\r\n|\r|\n)+$/, "")}\n`;
35
38
  }
package/render.test.mjs CHANGED
@@ -320,3 +320,9 @@ test("renderTemplate never substitutes inside GitHub Actions double-brace expres
320
320
  const out = renderTemplate("run: echo ${{ github.repository }}\nname: ${TEMPLATE_VERSION}\n", { TEMPLATE_VERSION: "1.0.0" });
321
321
  assert.equal(out, "run: echo ${{ github.repository }}\nname: 1.0.0\n");
322
322
  });
323
+
324
+ test("renderTemplate normalizes an empty final release-chain fragment to one newline", () => {
325
+ const out = renderTemplate("jobs:\n${RELEASE_CHAIN_JOBS}\n", { RELEASE_CHAIN_JOBS: "" });
326
+ assert.equal(out, "jobs:\n");
327
+ assert.equal((out.match(/\n/g) ?? []).length, 1);
328
+ });