@mark1russell7/site-pages 0.1.5 → 0.1.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/README.md +2 -1
- package/build/{build-MO5a6V2k.js → build-Dr35nErd.js} +34 -40
- package/build/build-Dr35nErd.js.map +1 -0
- package/build/cli.js +2 -3
- package/build/index.d.ts +7 -32
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/package.json +2 -2
- package/build/build-MO5a6V2k.js.map +0 -1
package/README.md
CHANGED
|
@@ -260,7 +260,8 @@ jobs:
|
|
|
260
260
|
build:
|
|
261
261
|
if: >-
|
|
262
262
|
github.event_name != 'workflow_run' ||
|
|
263
|
-
(github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push'
|
|
263
|
+
(github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' &&
|
|
264
|
+
github.event.workflow_run.head_branch == github.event.repository.default_branch)
|
|
264
265
|
runs-on: ubuntu-latest
|
|
265
266
|
# Read access only: the status page reads the pull requests, the issues and their checks.
|
|
266
267
|
# A scheduled run reads the runs of CI to find the newest commit that passed.
|
|
@@ -2,7 +2,7 @@ import { execFileSync } from "node:child_process";
|
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { basename, dirname, isAbsolute, join, posix, resolve } from "node:path";
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
5
|
-
|
|
5
|
+
// src/data/versions.ts
|
|
6
6
|
const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
7
7
|
/** This function gives the parts of a version, or null when the text is not a SemVer version. */
|
|
8
8
|
function parseVersion(version) {
|
|
@@ -64,8 +64,7 @@ function versionOfTag(tag) {
|
|
|
64
64
|
package: match[1] ?? null
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
//#region src/data/changelog.ts
|
|
67
|
+
// src/data/changelog.ts
|
|
69
68
|
const VERSION_HEADING = /^##\s+\[?v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)\]?(?:\s.*)?$/;
|
|
70
69
|
const COMMIT_ENTRY = /^([0-9a-f]{7,40}):\s+([\s\S]*)$/;
|
|
71
70
|
const DEPENDENCY_ENTRY = /^(?:Updated dependencies\b|@?[\w.-]+(?:\/[\w.-]+)?@\S+\s*$)/;
|
|
@@ -197,8 +196,7 @@ function releaseBodyEntries(body) {
|
|
|
197
196
|
function headingAnchor(heading) {
|
|
198
197
|
return heading.toLowerCase().trim().replace(/[^\p{L}\p{N}\s_-]/gu, "").replace(/\s/g, "-");
|
|
199
198
|
}
|
|
200
|
-
|
|
201
|
-
//#region src/data/github.ts
|
|
199
|
+
// src/data/github.ts
|
|
202
200
|
/** The GraphQL endpoint of GitHub. */
|
|
203
201
|
const GITHUB_GRAPHQL = "https://api.github.com/graphql";
|
|
204
202
|
/** The REST endpoint of GitHub. */
|
|
@@ -423,8 +421,7 @@ async function githubReleases(options) {
|
|
|
423
421
|
return failure(error, timeoutMs);
|
|
424
422
|
}
|
|
425
423
|
}
|
|
426
|
-
|
|
427
|
-
//#region src/data/npm.ts
|
|
424
|
+
// src/data/npm.ts
|
|
428
425
|
/** The public npm registry. */
|
|
429
426
|
const NPM_REGISTRY = "https://registry.npmjs.org";
|
|
430
427
|
const object = (value) => value !== null && typeof value === "object" ? value : {};
|
|
@@ -498,8 +495,7 @@ async function npmPublishTimes(options) {
|
|
|
498
495
|
problems
|
|
499
496
|
};
|
|
500
497
|
}
|
|
501
|
-
|
|
502
|
-
//#region src/data/git.ts
|
|
498
|
+
// src/data/git.ts
|
|
503
499
|
/**
|
|
504
500
|
* The git source: the tags with their dates, the commit of the build and the GitHub remote. Each
|
|
505
501
|
* function gives an empty result when git or the repository is not available.
|
|
@@ -558,8 +554,7 @@ function originRepository(repoDir) {
|
|
|
558
554
|
const match = /github\.com[:/]([^/]+)\/(.+?)(?:\.git)?\/?$/.exec(url);
|
|
559
555
|
return match ? `${match[1]}/${match[2]}` : null;
|
|
560
556
|
}
|
|
561
|
-
|
|
562
|
-
//#region src/data/glob.ts
|
|
557
|
+
// src/data/glob.ts
|
|
563
558
|
/**
|
|
564
559
|
* A small glob for the changelog files. The syntax has `*` and `?` in one path segment, and `**` for
|
|
565
560
|
* zero or more folders.
|
|
@@ -610,8 +605,7 @@ function safeList(dir) {
|
|
|
610
605
|
return [];
|
|
611
606
|
}
|
|
612
607
|
}
|
|
613
|
-
|
|
614
|
-
//#region src/data/releases.ts
|
|
608
|
+
// src/data/releases.ts
|
|
615
609
|
/**
|
|
616
610
|
* The release data: one entry for each version. The sources are the changelogs of Changesets, the
|
|
617
611
|
* GitHub releases, the git tags and the publication times on npm.
|
|
@@ -908,8 +902,7 @@ async function readReleases(options) {
|
|
|
908
902
|
warn
|
|
909
903
|
});
|
|
910
904
|
}
|
|
911
|
-
|
|
912
|
-
//#region src/data/status.ts
|
|
905
|
+
// src/data/status.ts
|
|
913
906
|
/**
|
|
914
907
|
* The status data: the open work of a roadmap file, and the open pull requests and issues of a
|
|
915
908
|
* GitHub repository. The build reads both, so the page shows the state at the time of the build.
|
|
@@ -1333,6 +1326,18 @@ function roadmapItems(markdown, options = {}) {
|
|
|
1333
1326
|
});
|
|
1334
1327
|
return headings.length === 0 ? items : [...items, ...headings].sort((a, b) => a.line - b.line);
|
|
1335
1328
|
}
|
|
1329
|
+
/**
|
|
1330
|
+
* This function gives the items of a roadmap file, as the Status page reads them. It fails when the file has no item.
|
|
1331
|
+
*
|
|
1332
|
+
* @throws RoadmapParseError when the cells of a row do not match the header
|
|
1333
|
+
* @throws RoadmapParseError when the roadmap has no item: no table with an ID and a Status column, and no item heading
|
|
1334
|
+
*/
|
|
1335
|
+
function parseRoadmap(markdown, options = {}) {
|
|
1336
|
+
const { file = "ROADMAP.md" } = options;
|
|
1337
|
+
const items = roadmapItems(markdown, options);
|
|
1338
|
+
if (items.length === 0) throw new RoadmapParseError(`${file}: no table with an ID column and a Status column, and no heading "### \`id\`: Title"`);
|
|
1339
|
+
return items;
|
|
1340
|
+
}
|
|
1336
1341
|
/** This function puts the roadmap items and the GitHub part into the shape of `status.json`. */
|
|
1337
1342
|
function buildStatusBoard(input) {
|
|
1338
1343
|
const { items, github, roadmap, repository, commit = null, generatedAt = (/* @__PURE__ */ new Date()).toISOString() } = input;
|
|
@@ -1365,14 +1370,11 @@ async function readStatusBoard(options) {
|
|
|
1365
1370
|
const { repoDir, roadmap = null, owner, repo, token, commit = null } = options;
|
|
1366
1371
|
const repository = `${owner}/${repo}`;
|
|
1367
1372
|
let items = [];
|
|
1368
|
-
if (roadmap) {
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
});
|
|
1374
|
-
if (items.length === 0) throw new RoadmapParseError(`${roadmap}: no table with an ID column and a Status column, and no heading "### \`id\`: Title"`);
|
|
1375
|
-
}
|
|
1373
|
+
if (roadmap) items = parseRoadmap(readFileSync(join(repoDir, ...roadmap.split("/")), "utf8"), {
|
|
1374
|
+
file: roadmap,
|
|
1375
|
+
repository,
|
|
1376
|
+
ref: commit ?? "HEAD"
|
|
1377
|
+
});
|
|
1376
1378
|
const github = await githubOpenWork({
|
|
1377
1379
|
owner,
|
|
1378
1380
|
repo,
|
|
@@ -1388,8 +1390,7 @@ async function readStatusBoard(options) {
|
|
|
1388
1390
|
...options.generatedAt ? { generatedAt: options.generatedAt } : {}
|
|
1389
1391
|
});
|
|
1390
1392
|
}
|
|
1391
|
-
|
|
1392
|
-
//#region src/render/html.ts
|
|
1393
|
+
// src/render/html.ts
|
|
1393
1394
|
/**
|
|
1394
1395
|
* The HTML helpers of the pages: the escape functions and a small inline Markdown renderer.
|
|
1395
1396
|
*/
|
|
@@ -1466,8 +1467,7 @@ function listText(parts) {
|
|
|
1466
1467
|
if (parts.length <= 1) return parts.join("");
|
|
1467
1468
|
return `${parts.slice(0, -1).join(", ")} and ${parts[parts.length - 1]}`;
|
|
1468
1469
|
}
|
|
1469
|
-
|
|
1470
|
-
//#region src/render/dates.ts
|
|
1470
|
+
// src/render/dates.ts
|
|
1471
1471
|
/**
|
|
1472
1472
|
* The dates of the pages. The pages show each date in UTC, so the build and the browser agree.
|
|
1473
1473
|
*/
|
|
@@ -1510,8 +1510,7 @@ function dayRange(start, end) {
|
|
|
1510
1510
|
const last = new Date(end);
|
|
1511
1511
|
return first.getUTCMonth() === last.getUTCMonth() ? `${shortDate(start)}–${last.getUTCDate()}` : `${shortDate(start)}–${shortDate(end)}`;
|
|
1512
1512
|
}
|
|
1513
|
-
|
|
1514
|
-
//#region src/render/theme.ts
|
|
1513
|
+
// src/render/theme.ts
|
|
1515
1514
|
/**
|
|
1516
1515
|
* The page shell and the CSS of the standalone pages. The CSS uses variables (`--sp-bg`, `--sp-fg`,
|
|
1517
1516
|
* `--sp-accent` and the others), so a site can change the colors and the fonts with `extraCss`.
|
|
@@ -1696,8 +1695,7 @@ ${parts.main}
|
|
|
1696
1695
|
</html>
|
|
1697
1696
|
`;
|
|
1698
1697
|
}
|
|
1699
|
-
|
|
1700
|
-
//#region src/render/timeline.ts
|
|
1698
|
+
// src/render/timeline.ts
|
|
1701
1699
|
/**
|
|
1702
1700
|
* The layout of the release timeline: one mark for each version on a time axis.
|
|
1703
1701
|
*
|
|
@@ -1812,8 +1810,7 @@ function timelineLayout(releases, options) {
|
|
|
1812
1810
|
marks
|
|
1813
1811
|
};
|
|
1814
1812
|
}
|
|
1815
|
-
|
|
1816
|
-
//#region src/render/releases.ts
|
|
1813
|
+
// src/render/releases.ts
|
|
1817
1814
|
/** The changes and the package chips that the page shows before "Show all". */
|
|
1818
1815
|
const FIRST_CHANGES = 8;
|
|
1819
1816
|
const FIRST_CHIPS = 4;
|
|
@@ -2052,8 +2049,7 @@ function renderReleasesPage(releases, options) {
|
|
|
2052
2049
|
script: RELEASES_SCRIPT
|
|
2053
2050
|
}, options);
|
|
2054
2051
|
}
|
|
2055
|
-
|
|
2056
|
-
//#region src/render/status.ts
|
|
2052
|
+
// src/render/status.ts
|
|
2057
2053
|
/**
|
|
2058
2054
|
* The standalone status page: the open work of the roadmap file, the open pull requests and the
|
|
2059
2055
|
* open issues. The build renders the HTML, and one small inline module adds the filters.
|
|
@@ -2340,8 +2336,7 @@ function renderStatusPage(data, options) {
|
|
|
2340
2336
|
script: STATUS_SCRIPT
|
|
2341
2337
|
}, options);
|
|
2342
2338
|
}
|
|
2343
|
-
|
|
2344
|
-
//#region src/build.ts
|
|
2339
|
+
// src/build.ts
|
|
2345
2340
|
/**
|
|
2346
2341
|
* The `site-pages build` command. It reads the sources. Then it writes the JSON data and the two
|
|
2347
2342
|
* standalone pages into the built output folder of a site.
|
|
@@ -2532,7 +2527,6 @@ async function runCli(argv, io) {
|
|
|
2532
2527
|
throw error;
|
|
2533
2528
|
}
|
|
2534
2529
|
}
|
|
2535
|
-
|
|
2536
|
-
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 };
|
|
2530
|
+
export { npmPublishTimes as $, RoadmapParseError as A, statusClassOf as B, longDate as C, inlineMarkdown as D, escapeHtml as E, parseRoadmap as F, readReleases as G, ReleaseDataError as H, plainText as I, headCommit as J, globFiles as K, readStatusBoard as L, buildStatusBoard as M, linksOf as N, safeUrl as O, markdownTables as P, NPM_REGISTRY as Q, roadmapItems as R, dayRange as S, utcDay as T, mergeReleases as U, DEFAULT_CHANGELOGS as V, readChangelogs as W, isShallow as X, headingDate as Y, originRepository as Z, oldestFirst as _, runCli as a, firstSentence as at, BASE_CSS as b, openGroups as c, releaseBodyEntries as ct, slugOf as d, parseVersion as dt, GITHUB_API as et, statusLead as f, versionOfTag as ft, laneCenter as g, renderReleasesPage as h, parseBuildArgs as i, githubReleases as it, STATUS_CLASSES as j, OPEN_CLASSES as k, renderStatusPage as l, compareVersions as lt, releasesLead as m, UsageError as n, checkStateOf as nt, STATUS_SCRIPT as o, headingAnchor as ot, RELEASES_SCRIPT as p, gitTagDates as q, build as r, githubOpenWork as rt, classCounts as s, parseChangelog as st, HELP as t, GITHUB_GRAPHQL as tt, sectionsOf as u, kindOf as ut, releaseSummary as v, shortDate as w, pageShell as x, timelineLayout as y, splitRow as z };
|
|
2537
2531
|
|
|
2538
|
-
//# sourceMappingURL=build-
|
|
2532
|
+
//# sourceMappingURL=build-Dr35nErd.js.map
|