@mark1russell7/site-pages 0.7.3 → 0.8.1
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 +8 -5
- package/build/chunks/build.js +1 -1
- package/build/chunks/data-stamp.js +1 -1
- package/build/chunks/freshness.d.ts +35 -17
- package/build/chunks/freshness.d.ts.map +1 -1
- package/build/chunks/freshness.js +322 -110
- package/build/chunks/freshness.js.map +1 -1
- package/build/cli.js +23 -2
- package/build/cli.js.map +1 -1
- package/build/index.d.ts +14 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/vite.d.ts +1 -1
- package/build/vite.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -160,7 +160,7 @@ site-pages bar --out dist --repo owner/name --pages "Demo=demo/,Docs=docs/" --si
|
|
|
160
160
|
- Its CSS has its own class names, so the CSS of the site does not change the bar. It follows the light and the dark scheme. Its rows wrap at 360 px.
|
|
161
161
|
- The command can start two times on one folder. The second start gives the same pages.
|
|
162
162
|
|
|
163
|
-
In `reusable-pages.yml`, the input `site-bar: true` starts the command before the upload. Then `site-pages nav --require-bar` crawls the built site, and a failure stops the deploy.
|
|
163
|
+
In `reusable-pages.yml`, the input `site-bar: true` starts the command before the upload. Then `site-pages nav --require-bar` crawls the built site, and a failure stops the deploy. Thus a site that turns on the bar removes the links of the bar from its own header in the same change. Then each page has one row of links.
|
|
164
164
|
|
|
165
165
|
## The scroll cue of the built pages
|
|
166
166
|
|
|
@@ -196,6 +196,7 @@ The command fails for each of these problems:
|
|
|
196
196
|
- A link goes to a page that gives a status of 400 or more.
|
|
197
197
|
- A click on a link to `releases/` or `status/` does not show the page of site-pages. A single-page application can catch the click and show its own page.
|
|
198
198
|
- With `--require-bar`, a page has no shared site bar.
|
|
199
|
+
- A page with the bar shows a link of the bar again in its own header or navigation. The check compares the target pages. The name of the site that links to the home counts too. A link to a part of the same page, for example `#use`, does not count. A link in a footer does not count.
|
|
199
200
|
|
|
200
201
|
The crawl opens at most `--max-pages` pages (default: 60). When it stops at this limit, the pages that it did not open are a "no read". A no-read is not a pass: the command fails, and `report.json` lists the pages in `unread`. The summary shows their count and their paths. In `site-audit.yml`, each no-read is a warning on the check of the pull request.
|
|
201
202
|
|
|
@@ -226,18 +227,20 @@ The gate has three rules. A fault of one rule gives the exit code 1.
|
|
|
226
227
|
|
|
227
228
|
1. Each page names a run, and each run has an id, a link, a date and its engine versions.
|
|
228
229
|
2. The data of a page is at most 3 days old (`MAX_DATA_AGE_DAYS`), or a run on newer engines is in flight. The stamp of that run is at most 3 days old, so an old stamp does not hold the gate open.
|
|
229
|
-
3. The engines of the newest run are at most 1 minor version behind npm at the start of the run (`MAX_MINORS_BEHIND`). A release during a long run does not fail the gate.
|
|
230
|
+
3. The engines of the newest run are at most 1 minor version behind npm at the start of the run (`MAX_MINORS_BEHIND`). A release during a long run does not fail the gate. An engine that is a package of the same repository has its version from its `package.json` at the build commit, not from npm. The gate reads each `package.json` that git tracks.
|
|
230
231
|
|
|
231
|
-
|
|
232
|
+
For an engine of the same repository, a break of rule 3 is a warning for 3 days (`VERSION_GRACE_DAYS`). The 3 days start at the commit that raised the version past the limit. Then the break is a fault, and the failing case is the end of the grace. The rule starts on 2026-11-30 (`WORKSPACE_RULE_START`). Before that start, each break is a warning. In a shallow clone, the gate cannot find the commit, so a break has no grace.
|
|
233
|
+
|
|
234
|
+
Stamps that pass also show one failing case for each page, in the log of each build. The case is the first time at which the gate fails on the page. A measured page must fail one day after the limit of its data. When the data is old at the start of the limit, it fails at that start. A study with no limit must fail before the date of its run. A page with no failing case gives the exit code 1, so each site that uses the gate shows that the gate holds it.
|
|
232
235
|
|
|
233
236
|
Two fields of a stamp change the age rule:
|
|
234
237
|
|
|
235
238
|
- `"study": true` marks a study of the versions of its runs. The rule 3 does not apply. A study has a `limit`, or it has the field `noLimit`. Each other study fails the gate.
|
|
236
239
|
- `"noLimit"` is for a study that no scheduled run can refresh: `{ "reproduce": "The code of the study is gone.", "today": "The page tells of one day." }`. The first text tells why no run of the current code can reproduce the numbers. It names the subject of the study, pinned to an exact version. The second text tells why the page claims nothing about today. The stamp line shows both, and tells that the page is a fixed study of that version.
|
|
237
240
|
- `"limit"` sets a longer age limit: `{ "days": 7, "reason": "The scan is weekly.", "workflow": ".github/workflows/scan.yml" }`. The stamp line shows the limit and the reason. The schedule of that workflow must meet the limit, or the gate fails. A limit with no schedule fails. A limit over 14 days (`MAX_LIMIT_DAYS_WITHOUT_RULING`) also needs a `ruling`, a public https link for that site. A study has the same line, and its limit is at most 30 days (`MAX_STUDY_LIMIT_DAYS`), also with a ruling. Each run of the study names the full `commit` of the code that ran. A monthly line has a gap of 31 days, so it fails a limit of 30.
|
|
238
|
-
- `"startsAt"` in a limit is the time at which the age rule and the commit rule start. The schedule rule applies at once. A site removes the field at the first green read of its workflow. The gate refuses a time after 2026-12-07 (`LAST_LIMIT_START`), so each limit turns on by that date.
|
|
241
|
+
- `"startsAt"` in a limit is the time at which the age rule and the commit rule start. Before it, a break of these rules is a warning: `::warning::` in GitHub Actions. The start does not change the age, which is always the time of the check minus the date of the data. The schedule rule applies at once. A site removes the field at the first green read of its workflow. The gate refuses a time after 2026-12-07 (`LAST_LIMIT_START`), so each limit turns on by that date.
|
|
239
242
|
|
|
240
|
-
When npm does not answer, the gate prints the rule 3 under `Not run
|
|
243
|
+
When npm does not answer for an engine that is not a package of the repository, the gate prints the rule 3 under `Not run`. It does not fail. A workflow turns the gate on with the input `data-stamps` of `reusable-pages.yml`. A site with its own Pages workflow uses the action `data-stamps` of the template. The gate then runs from the template commit, so it needs no install.
|
|
241
244
|
|
|
242
245
|
`renderDataStamp(stamp)` gives the line that the page shows with its data: the run, its date, its engine versions and the run in flight. The line also shows the age of the oldest run at the build.
|
|
243
246
|
|
package/build/chunks/build.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as listText, E as KPI_FILE, F as gitTagDates, G as parseVersion, H as npmPublishTimes, I as headCommit, K as versionOfTag, L as headingDate, M as readKpi, O as KpiError, R as isShallow, S as link, U as compareVersions, W as kindOf, b as escapeHtml, w as plural, x as inlineMarkdown, y as iconLink, z as originRepository } from "./freshness.js";
|
|
2
2
|
import { stripTypeScriptTypes } from "node:module";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { basename, dirname, isAbsolute, join, posix, resolve } from "node:path";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as listText, S as link, b as escapeHtml } from "./freshness.js";
|
|
2
2
|
// src/render/data-stamp.ts
|
|
3
3
|
const DAY_MS = 864e5;
|
|
4
4
|
/** This function gives an engine and its version in the short form, without the npm scope. */
|
|
@@ -57,6 +57,13 @@ interface NpmVersionTime {
|
|
|
57
57
|
version: string;
|
|
58
58
|
date: string;
|
|
59
59
|
}
|
|
60
|
+
/** A version of a package of the repository, and the time from which the repository has it. */
|
|
61
|
+
interface WorkspaceVersion {
|
|
62
|
+
/** The version in the `package.json` of the package. */
|
|
63
|
+
version: string;
|
|
64
|
+
/** The ISO time of the commit that set the version. It is absent when the clone does not have that commit. */
|
|
65
|
+
since?: string;
|
|
66
|
+
}
|
|
60
67
|
/** The result of `npmPublishTimes`: the times that npm gave, and a message for each package that failed. */
|
|
61
68
|
interface NpmPublishTimes {
|
|
62
69
|
times: NpmVersionTime[];
|
|
@@ -257,6 +264,10 @@ declare const MAX_LIMIT_DAYS_WITHOUT_RULING = 14;
|
|
|
257
264
|
declare const MAX_STUDY_LIMIT_DAYS = 30;
|
|
258
265
|
/** The last time at which a limit can start. A limit turns on at this time if its site did not turn it on before. */
|
|
259
266
|
declare const LAST_LIMIT_START = "2026-12-07T00:00:00Z";
|
|
267
|
+
/** The days after the commit that raised a package of the repository past the limit, before a fault. A rerun needs that time. */
|
|
268
|
+
declare const VERSION_GRACE_DAYS = 3;
|
|
269
|
+
/** The start of the version rule for an engine of the same repository. Before it, a break of that rule is a warning. */
|
|
270
|
+
declare const WORKSPACE_RULE_START = "2026-11-30T00:00:00Z";
|
|
260
271
|
/** One run that gives the data of a page. */
|
|
261
272
|
interface DataRun {
|
|
262
273
|
readonly id: string;
|
|
@@ -329,6 +340,15 @@ interface FreshnessOptions {
|
|
|
329
340
|
readonly maxMinorsBehind?: number;
|
|
330
341
|
/** The schedule of each workflow of a limit. A number is the largest gap between its starts in days. A text tells why the gate cannot read it. */
|
|
331
342
|
readonly schedules?: Readonly<Record<string, number | string>>;
|
|
343
|
+
/**
|
|
344
|
+
* The versions of each package of the repository, by its npm name. The first version is the version at the build commit.
|
|
345
|
+
* An engine with a name here is a package of the same repository, so the gate reads its version here and not on npm.
|
|
346
|
+
*/
|
|
347
|
+
readonly workspace?: Readonly<Record<string, readonly WorkspaceVersion[]>>;
|
|
348
|
+
/** The days of grace after the commit that raised a package of the repository past the limit. The default is `VERSION_GRACE_DAYS`. */
|
|
349
|
+
readonly versionGraceDays?: number;
|
|
350
|
+
/** The start of the version rule for an engine of the same repository. The default is `WORKSPACE_RULE_START`. */
|
|
351
|
+
readonly workspaceStartsAt?: string;
|
|
332
352
|
}
|
|
333
353
|
/** The result of `checkFreshness`. */
|
|
334
354
|
interface FreshnessCheck {
|
|
@@ -336,6 +356,8 @@ interface FreshnessCheck {
|
|
|
336
356
|
readonly faults: readonly string[];
|
|
337
357
|
/** Each rule that the gate could not run, with the reason. */
|
|
338
358
|
readonly notRun: readonly string[];
|
|
359
|
+
/** Each break before the gate fails on it, with the time from which it fails. A warning does not fail the gate. */
|
|
360
|
+
readonly warnings: readonly string[];
|
|
339
361
|
}
|
|
340
362
|
/**
|
|
341
363
|
* This function reads the content of a file of data stamps. It gives each fault of the content, so a page with no versions
|
|
@@ -346,28 +368,20 @@ declare function parseDataStamps(raw: unknown): DataStampsParse;
|
|
|
346
368
|
declare function minorsBehind(used: string, latest: string): number;
|
|
347
369
|
/** This function gives the newest stable version of a package on npm at a time, or undefined when npm has none. */
|
|
348
370
|
declare function latestAt(times: readonly NpmVersionTime[], name: string, date: string): string | undefined;
|
|
349
|
-
/** One schedule of a workflow. */
|
|
350
|
-
interface CronLine {
|
|
351
|
-
/** The number of the line in the file, from 1. */
|
|
352
|
-
readonly line: number;
|
|
353
|
-
/** The cron text, with no quotes and no comment. */
|
|
354
|
-
readonly cron: string;
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* This function gives each line `cron:` of a workflow. It is the one reader of these lines: the freshness gate and the rule `runner-budget` of conventions use it.
|
|
358
|
-
* It skips a comment line. It reads a quoted key, a list item, a quoted value and a comment at the end of the line.
|
|
359
|
-
*/
|
|
360
|
-
declare function cronLines(workflow: string): CronLine[];
|
|
361
371
|
/**
|
|
362
372
|
* This function applies the rules of the gate to the stamps.
|
|
363
373
|
*
|
|
364
374
|
* - The data of each page is at most `maxAgeDays` old, or a run on newer engines is in flight.
|
|
365
375
|
* - The engines of the newest run are at most `maxMinorsBehind` behind npm at the start of that run.
|
|
376
|
+
* - An engine that is a package of the repository is at most `maxMinorsBehind` behind its version at the build commit.
|
|
377
|
+
* The gate fails on a break `versionGraceDays` after the commit that raised the version, and not before `workspaceStartsAt`.
|
|
378
|
+
* Before that time, the break is a warning.
|
|
366
379
|
* - A run in flight has the same age limit, so an old stamp does not hold the gate open.
|
|
367
380
|
* - A page with its own limit uses that limit, and the schedule of its workflow meets the limit.
|
|
368
381
|
* - A study has no limit of the engines, because it tells about the versions that it names.
|
|
369
382
|
* - A study with a limit in force names the commit of each run. A study with no limit has no age rule.
|
|
370
|
-
* - A limit with `startsAt` applies the age rule and the commit rule from that time.
|
|
383
|
+
* - A limit with `startsAt` applies the age rule and the commit rule from that time. Before it, each break is a warning.
|
|
384
|
+
* The age is always the time of the check minus the date of the data. The schedule rule applies at once.
|
|
371
385
|
*/
|
|
372
386
|
declare function checkFreshness(stamps: DataStamps, options: FreshnessOptions): FreshnessCheck;
|
|
373
387
|
/** A time at which the gate must fail for a page, and what the gate says at that time. */
|
|
@@ -380,10 +394,14 @@ interface FailingCase {
|
|
|
380
394
|
readonly fault?: string;
|
|
381
395
|
}
|
|
382
396
|
/**
|
|
383
|
-
* This function gives one failing case for each page, from the stamps of the site itself.
|
|
384
|
-
*
|
|
385
|
-
*
|
|
397
|
+
* This function gives one failing case for each page, from the stamps of the site itself. The case is the first time at
|
|
398
|
+
* which the gate fails on the page. That time is one day after the limit of a run or of the run in flight. When the data is
|
|
399
|
+
* old at the start of the limit, the time is that start. The age always counts from the date of the data. For a version
|
|
400
|
+
* break of an engine of the same repository, the time is the end of its grace.
|
|
401
|
+
*
|
|
402
|
+
* A study with no limit must fail before the date of its run. Stamps that pass and give a case with no fault tell that the
|
|
403
|
+
* gate does not examine that page.
|
|
386
404
|
*/
|
|
387
405
|
declare function failingCases(stamps: DataStamps, options: FreshnessOptions): readonly FailingCase[];
|
|
388
|
-
export { StatusClass as $, readKpi as A, GitHubReleases as B, KPI_FILE as C, kpiFile as D, KpiInput as E, ChangelogFileFault as F, Link as G, KpiFile as H, ChangelogReading as I, OpenWorkTotals as J, NpmPublishTimes as K, CheckState as L, BoardIssue as M, BoardItem as N, kpiProblems as O, BoardPullRequest as P, StatusBoardData as Q, GitHubOpenWork as R, parseDataStamps as S, KpiError as T, KpiMeasure as U, KpiEngine as V, KpiTarget as W, ReleaseChange as X, Release as Y, ReleaseKind as Z,
|
|
406
|
+
export { StatusClass as $, readKpi as A, GitHubReleases as B, KPI_FILE as C, kpiFile as D, KpiInput as E, ChangelogFileFault as F, Link as G, KpiFile as H, ChangelogReading as I, OpenWorkTotals as J, NpmPublishTimes as K, CheckState as L, BoardIssue as M, BoardItem as N, kpiProblems as O, BoardPullRequest as P, StatusBoardData as Q, GitHubOpenWork as R, parseDataStamps as S, KpiError as T, KpiMeasure as U, KpiEngine as V, KpiTarget as W, ReleaseChange as X, Release as Y, ReleaseKind as Z, WORKSPACE_RULE_START as _, DataStampsParse as a, latestAt as b, FreshnessOptions as c, MAX_LIMIT_DAYS_WITHOUT_RULING as d, WorkspaceVersion as et, MAX_MINORS_BEHIND as f, VERSION_GRACE_DAYS as g, PageStamp as h, DataStamps as i, writeKpi as j, kpiText as k, LAST_LIMIT_START as l, NoAgeLimit as m, DataLimit as n, FailingCase as o, MAX_STUDY_LIMIT_DAYS as p, NpmVersionTime as q, DataRun as r, FreshnessCheck as s, DATA_STAMP_SCHEMA as t, MAX_DATA_AGE_DAYS as u, checkFreshness as v, KPI_FORMAT as w, minorsBehind as x, failingCases as y, GitHubRelease as z };
|
|
389
407
|
//# sourceMappingURL=freshness.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"freshness.d.ts","names":[],"sources":["../../src/data/types.ts","../../src/data/kpi.ts","../../src/check/freshness.ts"],"mappings":";;;;;UAMiB;EACf;EACA;;;;;;KAWU;;UAGK;;EAEf;;EAEA;;EAEA;;;UAIe;EACf;;EAEA;EACA,MAAM;;EAEN,SAAS;;EAET,OAAO;;;UAIQ;EACf;EACA;;EAEA;;EAEA;EACA;EACA;;;KAIU;EAAmB;EAAiB,UAAU;;EAAsB;EAAkB;;;UAGjF;EACf;EACA;EACA;;;UAIe;EACf,OAAO;EACP;;;KAQU;;UAGK;EACf;EACA;;EAEA;EACA,aAAa;EACb;EACA;;EAEA;;EAEA;;EAEA;EACA,OAAO;;;KAIG;;UAGK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,QAAQ;;;UAIO;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;UAIe;EACf;EACA;;;KAIU;EACN;EAAiB,cAAc;EAAoB,QAAQ;EAAc,QAAQ;;EACjF;EAAkB;;;UAGP;;EAEf;EACA;EACA;;EAEA;;EAEA;;EAEA,UAAU;;;UAIK;;EAEf;;EAEA;;;UAIe;;EAEf;EACA;;;UAIe;EACf;;EAEA;;EAEA;;EAEA;EACA,UAAU;;EAEV,UAAU;;;UAIK;;EAEf;EACA;;EAEA;;EAEA;;;UAIe;;;;;EAKf;;EAEA;;EAEA,QAAQ;;;UAIO;;EAEf;;EAEA;;EAEA;IAAU;IAAwB;;EAClC,OAAO;EACP,cAAc;EACd,QAAQ;;EAER;IAAU;IAAoB;IAAiB,SAAS;;;EAExD,MAAM;;EAEN,YAAY;;;
|
|
1
|
+
{"version":3,"file":"freshness.d.ts","names":[],"sources":["../../src/data/types.ts","../../src/data/kpi.ts","../../src/check/freshness.ts"],"mappings":";;;;;UAMiB;EACf;EACA;;;;;;KAWU;;UAGK;;EAEf;;EAEA;;EAEA;;;UAIe;EACf;;EAEA;EACA,MAAM;;EAEN,SAAS;;EAET,OAAO;;;UAIQ;EACf;EACA;;EAEA;;EAEA;EACA;EACA;;;KAIU;EAAmB;EAAiB,UAAU;;EAAsB;EAAkB;;;UAGjF;EACf;EACA;EACA;;;UAIe;;EAEf;;EAEA;;;UAIe;EACf,OAAO;EACP;;;KAQU;;UAGK;EACf;EACA;;EAEA;EACA,aAAa;EACb;EACA;;EAEA;;EAEA;;EAEA;EACA,OAAO;;;KAIG;;UAGK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,QAAQ;;;UAIO;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;UAIe;EACf;EACA;;;KAIU;EACN;EAAiB,cAAc;EAAoB,QAAQ;EAAc,QAAQ;;EACjF;EAAkB;;;UAGP;;EAEf;EACA;EACA;;EAEA;;EAEA;;EAEA,UAAU;;;UAIK;;EAEf;;EAEA;;;UAIe;;EAEf;EACA;;;UAIe;EACf;;EAEA;;EAEA;;EAEA;EACA,UAAU;;EAEV,UAAU;;;UAIK;;EAEf;EACA;;EAEA;;EAEA;;;UAIe;;;;;EAKf;;EAEA;;EAEA,QAAQ;;;UAIO;;EAEf;;EAEA;;EAEA;IAAU;IAAwB;;EAClC,OAAO;EACP,cAAc;EACd,QAAQ;;EAER;IAAU;IAAoB;IAAiB,SAAS;;;EAExD,MAAM;;EAEN,YAAY;;;cCrND;;cAGA;;KAGD,WAAW,KAAK;;cAkBf,iBAAiB;WACnB;EAET,YAAY;;;;;;;;iBA2EE,YAAY,gBAAgB;;;;;;iBAuC5B,QAAQ,OAAO,UAAU,eAAe;;iBASxC,QAAQ,MAAM;;;;;;iBASd,QAAQ,cAAc,eAAe;;;;;;iBAkBrC,SAAS,aAAa,OAAO,UAAU;;cCxK1C;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;UAQI;WACN;WACA;;WAEA;;WAEA,SAAS,SAAS;;WAElB;;WAEA;;;UAIM;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;UAIM;;WAEN;;WAEA;;;UAIM;WACN;;WAEA,eAAe;;WAEf,WAAW;;WAEX;;WAEA,QAAQ;;WAER,UAAU;;;UAIJ;WACN,eAAe;WACf,gBAAgB;;;KAIf;WAA6B;WAAmB,QAAQ;;WAA0B;WAAoB;;;UAGjG;;WAEN;;WAEA,gBAAgB;;WAEhB;;WAEA;;WAEA,YAAY,SAAS;;;;;WAKrB,YAAY,SAAS,wBAAwB;;WAE7C;;WAEA;;;UAIM;;WAEN;;WAEA;;WAEA;;;;;;iBAkFK,gBAAgB,eAAe;;iBAwB/B,aAAa,cAAc;;iBAS3B,SAAS,gBAAgB,kBAAkB,cAAc;;;;;;;;;;;;;;;;iBA2EzD,eAAe,QAAQ,YAAY,SAAS,mBAAmB;;UA6D9D;;WAEN;;WAEA;;WAEA;;;;;;;;;;;iBAYK,aAAa,QAAQ,YAAY,SAAS,4BAA4B"}
|