shipseal 0.0.4 → 0.0.6
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/dist/cli.js +25 -18
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -307,23 +307,21 @@ function deterministicCopy(facts, maxHighlights = 4) {
|
|
|
307
307
|
const features = (facts.release?.features ?? []).map((item) => item.value);
|
|
308
308
|
const fixes = (facts.release?.fixes ?? []).map((item) => item.value);
|
|
309
309
|
const breaking = (facts.release?.breaking ?? []).map((item) => item.value);
|
|
310
|
-
const
|
|
311
|
-
|
|
310
|
+
const headline = [
|
|
311
|
+
...breaking,
|
|
312
|
+
...features,
|
|
313
|
+
...fixes
|
|
314
|
+
].map((line) => cleanLine(firstSentence(line))).find((line) => line.length <= HEADLINE_MAX_CHARS) ?? (version === void 0 ? name : `${name} ${version}`);
|
|
312
315
|
const tagline = facts.project.tagline?.value;
|
|
313
316
|
const subheadline = tagline !== void 0 && tagline.length > 0 ? cleanLine(tagline) : cleanLine(features[1] ?? fixes[1] ?? fixes[0] ?? `What's new in ${version ?? name}`);
|
|
314
317
|
const highlights = [];
|
|
315
|
-
|
|
316
|
-
if (highlights.length >= maxHighlights)
|
|
317
|
-
highlights.push(cleanLine(line));
|
|
318
|
-
}
|
|
319
|
-
for (const line of
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}
|
|
323
|
-
for (const line of breaking) {
|
|
324
|
-
if (highlights.length >= maxHighlights) break;
|
|
325
|
-
highlights.push(`Breaking: ${cleanLine(line)}`);
|
|
326
|
-
}
|
|
318
|
+
const addHighlight = (line, prefix = "") => {
|
|
319
|
+
if (highlights.length >= maxHighlights) return;
|
|
320
|
+
highlights.push(`${prefix}${cleanLine(firstSentence(line))}`);
|
|
321
|
+
};
|
|
322
|
+
for (const line of breaking) addHighlight(line, "Breaking: ");
|
|
323
|
+
for (const line of features) addHighlight(line);
|
|
324
|
+
for (const line of fixes) addHighlight(line);
|
|
327
325
|
return {
|
|
328
326
|
headline,
|
|
329
327
|
subheadline,
|
|
@@ -368,6 +366,12 @@ function firstSentence(text) {
|
|
|
368
366
|
const collapsed = text.replace(/\s+/g, " ").trim();
|
|
369
367
|
return /^(.+?[.?!])\s+[A-Z]/.exec(collapsed)?.[1] ?? collapsed;
|
|
370
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* Longest headline that fits two lines at the minimum font size on a 1200 wide card.
|
|
371
|
+
* Measured rather than guessed: §13.1 originally said 48, which rejects most real changelog
|
|
372
|
+
* sentences, and the fitting pass comfortably handles more.
|
|
373
|
+
*/
|
|
374
|
+
const HEADLINE_MAX_CHARS = 72;
|
|
371
375
|
function cleanLine(text) {
|
|
372
376
|
const stripped = text.replace(/\s*\u2014\s*/g, ": ").replace(/\s+\u2013\s+/g, ", ").replaceAll("–", "-").replaceAll("!", ".").replace(/\s+/g, " ").trim();
|
|
373
377
|
const noTrail = stripped.endsWith(".") ? stripped.slice(0, -1) : stripped;
|
|
@@ -1465,7 +1469,9 @@ const releaseHighlights = {
|
|
|
1465
1469
|
style: {
|
|
1466
1470
|
display: "flex",
|
|
1467
1471
|
flexDirection: "column",
|
|
1468
|
-
|
|
1472
|
+
flexGrow: 1,
|
|
1473
|
+
justifyContent: props.highlights.length > 2 ? "flex-start" : "center",
|
|
1474
|
+
gap: props.highlights.length > 2 ? 16 : 20
|
|
1469
1475
|
},
|
|
1470
1476
|
children: props.highlights.map((line, index) => {
|
|
1471
1477
|
const fitted = ctx.fitted[`highlight-${String(index)}`];
|
|
@@ -1965,7 +1971,7 @@ function listItems(block) {
|
|
|
1965
1971
|
let current;
|
|
1966
1972
|
for (const raw of block.split("\n")) {
|
|
1967
1973
|
const trimmed = raw.trim();
|
|
1968
|
-
if (trimmed.startsWith("- ") || trimmed.startsWith("* ")) {
|
|
1974
|
+
if (!/^\s+/.test(raw) && (trimmed.startsWith("- ") || trimmed.startsWith("* "))) {
|
|
1969
1975
|
if (current !== void 0) items.push(current);
|
|
1970
1976
|
current = trimmed;
|
|
1971
1977
|
continue;
|
|
@@ -2348,9 +2354,10 @@ async function collectPackageJson(cwd, packagePath = "package.json") {
|
|
|
2348
2354
|
const pkg = pkgSchema.safeParse(parsed);
|
|
2349
2355
|
if (!pkg.success) return {};
|
|
2350
2356
|
const fetchedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
2351
|
-
const
|
|
2357
|
+
const rawName = pkg.data.private === true ? void 0 : pkg.data.name;
|
|
2358
|
+
const project = { name: fact(stripScope$1(rawName ?? basenameFromPath(cwd)), {
|
|
2352
2359
|
source: "package-json",
|
|
2353
|
-
ref: `${packagePath}#name`,
|
|
2360
|
+
ref: rawName === void 0 ? `${packagePath} directory name` : `${packagePath}#name`,
|
|
2354
2361
|
fetchedAt
|
|
2355
2362
|
}) };
|
|
2356
2363
|
if (pkg.data.description !== void 0 && pkg.data.description.length > 0) project.tagline = fact(pkg.data.description, {
|