@mark1russell7/site-pages 0.1.1 → 0.1.3

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
@@ -65,6 +65,13 @@ The pipeline needs the full history for the tags and the commits. Use `fetch-dep
65
65
 
66
66
  For a monorepo with one version for all its packages, give `--group` and the name of one package. Then only its changelog gives the versions, and the dates come from its tags. Without `--group`, each version of each source is a version.
67
67
 
68
+ A repository can have no changelog and no GitHub release. Then each npm version of each package of `--packages` is a release:
69
+
70
+ - The label is the version when there is one package. With more packages, the label is the name without its scope and the version, for example `service@0.5.8`.
71
+ - The kind comes from the step after the previous version of the same package. The first version of each package has the kind `first`.
72
+ - A version with a prerelease part is not a release. npm also keeps the placeholder `0.0.0-bootstrap.0` of a new package.
73
+ - The change of a release names its package, and the link goes to the version on npm.
74
+
68
75
  The kind of a version:
69
76
 
70
77
  | Kind | Rule |
@@ -117,9 +124,20 @@ The command also reads each heading `` ### `id`: Title `` under a `##` heading.
117
124
  - [crawler #22](https://github.com/acme/crawler/pull/22)
118
125
  ```
119
126
 
120
- - The list items `Area:`, `Owner:` and `Waits for:` give the optional fields.
121
- - The other list items give the links: Markdown links, `#12`, `PR #12` and commit hashes in code spans.
122
- - A `###` heading without an ID in a code span is not an item. The text of an item is not read.
127
+ The command also reads the heading `### S1 · Title`: the ID is one word before the middle dot. A list item `Status:` gives the status of its item, and it wins over the `##` heading.
128
+
129
+ ```md
130
+ ### S1 · Detection and divergence in Docker
131
+
132
+ - **Status:** in progress
133
+ - **Area:** program
134
+ - **Depends on:** S0
135
+ - **Links:** [The results](https://example.com/results/)
136
+ ```
137
+
138
+ - The list items `Area:`, `Owner:` and `Waits for:` (or `Depends on:`) give the optional fields. A label can be bold.
139
+ - The list item `Links:` and the other list items give the links: Markdown links, `#12`, `PR #12` and commit hashes in code spans.
140
+ - A `###` heading without an ID is not an item. A heading without a `##` heading above it and without a `Status:` item is not an item either. The text of an item is not read.
123
141
  - A roadmap without a table and without an item heading stops the build.
124
142
 
125
143
  The GitHub part comes from one GraphQL request: the 50 open pull requests and the 50 open issues that changed last, with the totals.
@@ -646,12 +646,74 @@ function earliest(dates) {
646
646
  function refPath(ref) {
647
647
  return encodeURI(ref).replace(/#/g, "%23").replace(/\?/g, "%3F");
648
648
  }
649
+ /** The kind of a version from the step after the previous version of its package. */
650
+ function stepKind(version, previous) {
651
+ if (previous === void 0) return "first";
652
+ const now = parseVersion(version);
653
+ const before = parseVersion(previous);
654
+ if (!now || !before) return kindOf(version, false);
655
+ if (now.major !== before.major) return "major";
656
+ return now.minor !== before.minor ? "minor" : "patch";
657
+ }
658
+ /**
659
+ * This function gives the releases of the npm versions of some packages, for a repository without
660
+ * a changelog and without GitHub releases (version 0.1.3). Each version of each package is one
661
+ * release.
662
+ *
663
+ * - The label is the version when the times name one package. Else it is the name without its
664
+ * scope and the version, for example `service@0.5.8`.
665
+ * - The kind comes from the step after the previous version of the same package. The first
666
+ * version of a package is the kind `first`.
667
+ * - A version with a prerelease part is not a release. npm also keeps the placeholder
668
+ * `0.0.0-bootstrap.0` of a new package.
669
+ */
670
+ function npmReleases(times, group) {
671
+ const stable = times.filter((time) => (!group || time.name === group) && parseVersion(time.version)?.prerelease.length === 0);
672
+ const byPackage = /* @__PURE__ */ new Map();
673
+ for (const time of stable) {
674
+ const list = byPackage.get(time.name) ?? [];
675
+ if (!list.some((each) => each.version === time.version)) list.push(time);
676
+ byPackage.set(time.name, list);
677
+ }
678
+ const shortNames = /* @__PURE__ */ new Map();
679
+ const shortCount = /* @__PURE__ */ new Map();
680
+ for (const name of byPackage.keys()) {
681
+ const short = name.replace(/^@[^/]+\//, "");
682
+ shortNames.set(name, short);
683
+ shortCount.set(short, (shortCount.get(short) ?? 0) + 1);
684
+ }
685
+ const several = byPackage.size > 1;
686
+ const releases = [];
687
+ for (const [name, list] of byPackage) {
688
+ list.sort((a, b) => compareVersions(a.version, b.version));
689
+ const short = shortNames.get(name) ?? name;
690
+ const label = (shortCount.get(short) ?? 0) > 1 ? name : short;
691
+ list.forEach((time, index) => {
692
+ releases.push({
693
+ version: several ? `${label}@${time.version}` : time.version,
694
+ date: time.date,
695
+ kind: stepKind(time.version, list[index - 1]?.version),
696
+ changes: [{
697
+ commit: null,
698
+ text: `Version ${time.version} of \`${name}\` on npm.`,
699
+ packages: [name]
700
+ }],
701
+ links: [{
702
+ label: "npm",
703
+ url: `https://www.npmjs.com/package/${name}/v/${time.version}`
704
+ }]
705
+ });
706
+ });
707
+ }
708
+ return releases.sort((a, b) => Date.parse(b.date) - Date.parse(a.date) || a.version.localeCompare(b.version));
709
+ }
649
710
  /**
650
711
  * This function merges the release sources into one entry for each version, the newest first.
651
712
  *
652
713
  * - The versions: the changelog of `group`, or else each changelog version and each GitHub release.
653
714
  * - The date: the git tag, else the GitHub release, else npm, else the commit of the changelog heading.
654
715
  * - The changes: the changelog entries, else the list items of the GitHub release text.
716
+ * - Without a changelog version and without a GitHub release, each npm version of each package is a release.
655
717
  *
656
718
  * @throws ReleaseDataError when `group` has no changelog and other changelogs exist
657
719
  */
@@ -683,7 +745,7 @@ function mergeReleases(sources) {
683
745
  for (const [version, list] of githubByVersion) if (list.some((entry) => inGroup(entry.package))) versions.add(version);
684
746
  }
685
747
  const ordered = [...versions].sort((a, b) => compareVersions(b, a));
686
- if (ordered.length === 0) return [];
748
+ if (ordered.length === 0) return npmReleases(sources.npm ?? [], group);
687
749
  const changelogChanges = /* @__PURE__ */ new Map();
688
750
  const changelogOf = /* @__PURE__ */ new Map();
689
751
  const groupFirst = groupChangelog ? [groupChangelog, ...parsed.filter((entry) => entry !== groupChangelog)] : parsed;
@@ -1037,8 +1099,13 @@ function linksOf(cell, options = {}) {
1037
1099
  }
1038
1100
  /** The heading of an item: "### `id`: Title". A dash can take the place of the colon. */
1039
1101
  const ITEM_HEADING = /^###\s+`([^`]+)`\s*[:–—-]\s*(.*?)\s*#*\s*$/;
1040
- /** A field of an item heading: "- Area: Docs". The label matches without case. */
1041
- const ITEM_FIELD = /^\s*[-*]\s+([A-Za-z][A-Za-z ]*?):\s*(.*)$/;
1102
+ /** The other heading of an item: "### S1 · Title". The ID is one word before the middle dot. */
1103
+ const ITEM_HEADING_DOT = /^###\s+([A-Za-z0-9][\w.-]*)\s+·\s+(.*?)\s*#*\s*$/;
1104
+ /**
1105
+ * A field of an item heading: "- Area: Docs", "- **Area:** Docs" or "- **Area**: Docs". The label
1106
+ * matches without case.
1107
+ */
1108
+ const ITEM_FIELD = /^\s*[-*]\s+(\*\*|__)?([A-Za-z][A-Za-z ]*?)(?::\1|\1:)\s*(.*)$/;
1042
1109
  /** The fields of an item heading that give the optional fields of an item. */
1043
1110
  const ITEM_FIELDS = {
1044
1111
  area: "area",
@@ -1048,10 +1115,13 @@ const ITEM_FIELDS = {
1048
1115
  "depends on": "needs"
1049
1116
  };
1050
1117
  /**
1051
- * This function gives the items of the second form of a roadmap: each heading "### `id`: Title"
1052
- * under a "##" heading. The "##" heading gives the status, for example "Waiting on Mark", "Later" or
1053
- * "Shipped". In the text of the item, the list items "Area:", "Owner:" and "Waits for:" give the
1054
- * optional fields, and the other list items give the links. Fenced code is not read.
1118
+ * This function gives the items of the second form of a roadmap: each heading "### `id`: Title" or
1119
+ * "### id · Title". The list item "Status:" gives the status. Without it, the "##" heading above
1120
+ * the item gives the status, for example "Waiting on Mark", "Later" or "Shipped". A heading without
1121
+ * a status is not an item.
1122
+ *
1123
+ * The list items "Area:", "Owner:" and "Waits for:" give the optional fields. The list item
1124
+ * "Links:" and the other list items give the links. Fenced code is not read.
1055
1125
  */
1056
1126
  function headingItems(markdown, options) {
1057
1127
  const lines = String(markdown).split(/\r?\n/);
@@ -1076,9 +1146,9 @@ function headingItems(markdown, options) {
1076
1146
  if (level === 2) section = plainText(heading[2]);
1077
1147
  if (level === 1) section = "";
1078
1148
  if (level !== 3) continue;
1079
- const item = ITEM_HEADING.exec(line);
1149
+ const item = ITEM_HEADING.exec(line) ?? ITEM_HEADING_DOT.exec(line);
1080
1150
  const id = plainText(item?.[1]);
1081
- if (!item || isEmpty(id) || section === "") continue;
1151
+ if (!item || isEmpty(id)) continue;
1082
1152
  current = {
1083
1153
  id,
1084
1154
  title: item[2] ?? "",
@@ -1093,15 +1163,22 @@ function headingItems(markdown, options) {
1093
1163
  }
1094
1164
  if (!current) continue;
1095
1165
  const field = ITEM_FIELD.exec(line);
1096
- const key = field ? ITEM_FIELDS[(field[1] ?? "").trim().toLowerCase()] : void 0;
1097
- if (field && key !== void 0) {
1098
- if (!isEmpty(field[2])) current[key] = (field[2] ?? "").trim();
1166
+ const label = (field?.[2] ?? "").trim().toLowerCase();
1167
+ const value = (field?.[3] ?? "").trim();
1168
+ const key = field ? ITEM_FIELDS[label] : void 0;
1169
+ if (field && label === "status") {
1170
+ if (!isEmpty(value)) {
1171
+ current.status = value;
1172
+ current.statusClass = statusClassOf(plainText(value));
1173
+ }
1174
+ } else if (field && key !== void 0) {
1175
+ if (!isEmpty(value)) current[key] = value;
1099
1176
  } else if (/^\s*[-*]\s+/.test(line)) {
1100
1177
  const seen = new Set(current.links.map((link) => link.url));
1101
1178
  for (const link of linksOf(line, options)) if (!seen.has(link.url)) current.links.push(link);
1102
1179
  }
1103
1180
  }
1104
- return items;
1181
+ return items.filter((item) => item.status !== "");
1105
1182
  }
1106
1183
  /**
1107
1184
  * This function gives the items of a roadmap file in the order of the file. It reads two forms:
@@ -1109,8 +1186,9 @@ function headingItems(markdown, options) {
1109
1186
  * - Each row of each table with an `ID` column and a `Status` column. The header names match without
1110
1187
  * case. The title comes from `Item`, else from `Title`. `Owner`, `Area` and `Needs` are optional.
1111
1188
  * `Where`, `Commit` and `Links` give the links.
1112
- * - Each heading "### `id`: Title" under a "##" heading that gives the status. The list items
1113
- * "Area:", "Owner:" and "Waits for:" give the optional fields, and the other list items give the links.
1189
+ * - Each heading "### `id`: Title" or "### id · Title". The list item "Status:", else the "##"
1190
+ * heading above it, gives the status. The list items "Area:", "Owner:" and "Waits for:" give the
1191
+ * optional fields, and "Links:" and the other list items give the links.
1114
1192
  *
1115
1193
  * @throws RoadmapParseError when the cells of a row do not match the header
1116
1194
  */
@@ -2342,4 +2420,4 @@ async function runCli(argv, io) {
2342
2420
  //#endregion
2343
2421
  export { GITHUB_API as $, RoadmapParseError as A, DEFAULT_CHANGELOGS as B, longDate as C, inlineMarkdown as D, escapeHtml as E, plainText as F, globFiles as G, mergeReleases as H, readStatusBoard as I, headingDate as J, gitTagDates as K, roadmapItems as L, buildStatusBoard as M, linksOf as N, safeUrl as O, markdownTables as P, npmPublishTimes as Q, splitRow as R, dayRange as S, utcDay as T, readChangelogs as U, ReleaseDataError as V, readReleases as W, originRepository as X, isShallow as Y, NPM_REGISTRY as Z, oldestFirst as _, runCli as a, headingAnchor as at, BASE_CSS as b, openGroups as c, compareVersions as ct, slugOf as d, versionOfTag as dt, GITHUB_GRAPHQL as et, statusLead as f, laneCenter as g, renderReleasesPage as h, parseBuildArgs as i, firstSentence as it, STATUS_CLASSES as j, OPEN_CLASSES as k, renderStatusPage as l, kindOf as lt, releasesLead as m, UsageError as n, githubOpenWork as nt, STATUS_SCRIPT as o, parseChangelog as ot, RELEASES_SCRIPT as p, headCommit as q, build as r, githubReleases as rt, classCounts as s, releaseBodyEntries as st, HELP as t, checkStateOf as tt, sectionsOf as u, parseVersion as ut, releaseSummary as v, shortDate as w, pageShell as x, timelineLayout as y, statusClassOf as z };
2344
2422
 
2345
- //# sourceMappingURL=build-C09QBcTa.js.map
2423
+ //# sourceMappingURL=build-CArquriz.js.map