shipseal 0.4.0 → 0.4.2

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.md CHANGED
@@ -49,7 +49,7 @@ jobs:
49
49
  steps:
50
50
  - uses: actions/checkout@v7
51
51
  with: { fetch-depth: 0 }
52
- - uses: akii09/shipseal@v0.4.0
52
+ - uses: akii09/shipseal@v0.4.2
53
53
  env: { GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" }
54
54
  ```
55
55
 
package/dist/cli.js CHANGED
@@ -325,6 +325,24 @@ const COPY_LIMITS = {
325
325
  milestoneLine: 48
326
326
  };
327
327
 
328
+ //#endregion
329
+ //#region src/copy/headline.ts
330
+ /** Below this a line is a fragment or a label, not a description of a change. */
331
+ const MIN_WORDS = 3;
332
+ const MIN_CHARS = 12;
333
+ /** Housekeeping prefixes. A chore is not what a release is about. */
334
+ const CHORE = /^(chore|docs?|ci|build|test|refactor|style|revert|bump|deps?|dependencies)\b[:(]?/i;
335
+ /** A line that is only a person's name: "Adam Chmara", "Jane Q. Smith". */
336
+ const PERSON_NAME = /^[A-Z][\p{L}'’-]+(?:\s+[A-Z][.\p{L}'’-]*){1,2}$/u;
337
+ /** Package-ish fragments: "/api", "@scope/pkg", "solid-query.0.0-rc.3", "v1.2.3". */
338
+ const FRAGMENT = /^[@/]|^v?\d+\.\d+|^[\w@/.-]+$/;
339
+ function isHeadlineWorthy(line) {
340
+ const text = line.trim();
341
+ if (text.length < MIN_CHARS || text.split(/\s+/).length < MIN_WORDS) return false;
342
+ if (CHORE.test(text) || PERSON_NAME.test(text) || FRAGMENT.test(text)) return false;
343
+ return !/https?:\/\//.test(text);
344
+ }
345
+
328
346
  //#endregion
329
347
  //#region src/copy/deterministic.ts
330
348
  function deterministicCopy(facts, maxHighlights = 4, displayName) {
@@ -333,7 +351,7 @@ function deterministicCopy(facts, maxHighlights = 4, displayName) {
333
351
  const features = (facts.release?.features ?? []).map((item) => item.value);
334
352
  const fixes = (facts.release?.fixes ?? []).map((item) => item.value);
335
353
  const breaking = (facts.release?.breaking ?? []).map((item) => item.value);
336
- const headlineSource = [...breaking, ...features].map((line) => cleanLine(firstSentence(line))).find((line) => line.length <= HEADLINE_MAX_CHARS);
354
+ const headlineSource = [...breaking, ...features].map((line) => cleanLine(firstSentence(line))).find((line) => line.length <= HEADLINE_MAX_CHARS && isHeadlineWorthy(line));
337
355
  const title = displayName ?? name;
338
356
  const headline = facts.release?.headline?.value ?? headlineSource ?? (version === void 0 ? title : `${title} ${version}`);
339
357
  const tagline = facts.release?.subheadline?.value ?? facts.project.tagline?.value;
@@ -2529,7 +2547,7 @@ function stripBadges(text) {
2529
2547
  /** Markdown escapes a maintainer never meant to see rendered: \[ruff\] becomes [ruff]. */
2530
2548
  const MARKDOWN_ESCAPE = /\\([[\]()*_`~#+\-.!])/g;
2531
2549
  function cleanReleaseLine(item) {
2532
- return item.replace(/^\s*[-*]\s*/, "").replace(/\[`[a-f0-9]{7,40}`]\([^)]+\)/gi, "").replace(/^[a-f0-9]{7,40}:\s*/i, "").replace(/\(#\d+\)/g, "").replace(/\[#\d+]\([^)]+\)/g, "").replace(/#\d+\b/g, "").replace(/Thanks\s+\[@[\w-]+]\([^)]+\)!?\s*-?\s*/gi, "").replace(/\[@[\w-]+]\([^)]+\)/g, "").replace(/\(@[\w-]+\)/g, "").replace(/\s+by\s+@[\w-]+/gi, "").replace(/@[\w-]+/g, "").replace(/^Thanks\s*!?\s*-?\s*/i, "").replaceAll(/!\[[^\]]*\]\([^)]*\)/g, "").replaceAll(/\[([^\]]+)\]\([^)]*\)/g, "$1").replaceAll(/<[^>]*>/g, "").replaceAll(MARKDOWN_ESCAPE, "$1").replaceAll(/[*`]/g, "").replace(/^\s*[-*]\s*/, "").replace(/\s*\(\s*\)/g, "").replace(/\s+([,.;:])/g, "$1").replace(/\s+/g, " ").trim().replace(/[\s,;:-]+$/, "").replace(/\.$/, "");
2550
+ return item.replace(/^\s*[-*]\s*/, "").replace(/\[`[a-f0-9]{7,40}`]\([^)]+\)/gi, "").replace(/^[a-f0-9]{7,40}:\s*/i, "").replace(/\(#\d+\)/g, "").replace(/\[#\d+]\([^)]+\)/g, "").replace(/#\d+\b/g, "").replace(/Thanks\s+\[@[\w-]+]\([^)]+\)!?\s*-?\s*/gi, "").replace(/\[@[\w-]+]\([^)]+\)/g, "").replace(/\(@[\w-]+\)/g, "").replace(/\s+by\s+@[\w-]+/gi, "").replace(/@[\w-]+/g, "").replace(/^Thanks\s*!?\s*-?\s*/i, "").replaceAll(/!\[[^\]]*\]\([^)]*\)/g, "").replaceAll(/\[([^\]]+)\]\([^)]*\)/g, "$1").replaceAll(/<[^>]*>/g, "").replaceAll(MARKDOWN_ESCAPE, "$1").replaceAll(/[*`]/g, "").replaceAll(/\(\s*[a-f0-9]{6,40}\s*\)/gi, "").replace(/^\[[^\]]{1,24}\]\s*/, "").replace(/^\s*[-*]\s*/, "").replace(/\s*\(\s*\)/g, "").replace(/\s+([,.;:])/g, "$1").replace(/\s+/g, " ").trim().replace(/[\s,;:-]+$/, "").replace(/\.$/, "");
2533
2551
  }
2534
2552
 
2535
2553
  //#endregion