@mark1russell7/site-pages 0.7.3 → 0.8.0
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 +6 -4
- 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 +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
|
@@ -226,18 +226,20 @@ The gate has three rules. A fault of one rule gives the exit code 1.
|
|
|
226
226
|
|
|
227
227
|
1. Each page names a run, and each run has an id, a link, a date and its engine versions.
|
|
228
228
|
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.
|
|
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. 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
230
|
|
|
231
|
-
|
|
231
|
+
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.
|
|
232
|
+
|
|
233
|
+
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
234
|
|
|
233
235
|
Two fields of a stamp change the age rule:
|
|
234
236
|
|
|
235
237
|
- `"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
238
|
- `"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
239
|
- `"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.
|
|
240
|
+
- `"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
241
|
|
|
240
|
-
When npm does not answer, the gate prints the rule 3 under `Not run
|
|
242
|
+
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
243
|
|
|
242
244
|
`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
245
|
|
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;;EAE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