@mark1russell7/site-pages 0.1.6 → 0.1.8
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 +61 -0
- package/build/{build-Dr35nErd.js → build-CD2wc7Yl.js} +6 -1
- package/build/{build-Dr35nErd.js.map → build-CD2wc7Yl.js.map} +1 -1
- package/build/cli.js +673 -3
- package/build/cli.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/package.json +4 -2
- package/styles/scroll-cue.css +31 -0
package/README.md
CHANGED
|
@@ -50,6 +50,42 @@ A failure of GitHub or npm does not stop the build. Without a token, or when Git
|
|
|
50
50
|
|
|
51
51
|
Give the token in the environment variable `GITHUB_TOKEN`, not with `--token`. Other processes can see a command line.
|
|
52
52
|
|
|
53
|
+
## The check of a site
|
|
54
|
+
|
|
55
|
+
The command `site-pages check` opens the pages of a site in a headless Chromium. It examines each page at phone and desktop widths, in the light and the dark scheme.
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
site-pages check --out dist --repo owner/name --pages /,/releases/ --probe site-probe.js --shots shots
|
|
59
|
+
site-pages check --url https://owner.github.io/name/
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
A view fails for each of these problems:
|
|
63
|
+
|
|
64
|
+
- The page is wider than the screen, or an element goes past the right edge. A container that scrolls or clips is not a problem.
|
|
65
|
+
- A text area hides a part of its text.
|
|
66
|
+
- The page shows no text.
|
|
67
|
+
- The page writes a console error, or a script throws an exception.
|
|
68
|
+
- A request to the site fails, or gets a status of 400 or more.
|
|
69
|
+
- A check of the probe fails, or the probe makes no check.
|
|
70
|
+
|
|
71
|
+
The probe is a JavaScript file. Its code is the body of an async function. These functions are available:
|
|
72
|
+
|
|
73
|
+
| Function | Operation |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| `check(name, ok, detail)` | Records a check. A false `ok` fails it, and `detail` tells why. |
|
|
76
|
+
| `$(selector)`, `$$(selector)` | Find one element, or all of them |
|
|
77
|
+
| `click(element)`, `type(element, text)` | Click an element, or write text into a field with an `input` event |
|
|
78
|
+
| `wait(ms)`, `until(fn, ms)` | Wait, or wait until `fn` gives a true value |
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
type("#editor", "Utilize the cache.");
|
|
82
|
+
check("the linter finds a word", await until(() => $$(".finding").length === 1), $$(".finding").length);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The check runs the probe on the first page, in the first scheme, at each width. The folder of `--shots` gets a screenshot of each view, `report.json` and `summary.md`. The exit code is 0 when each view passes, 1 when a view fails, and 2 for an incorrect command line.
|
|
86
|
+
|
|
87
|
+
The check finds a browser in this order: `--browser`, `$SITE_CHECK_BROWSER`, the newest Chromium of Playwright, and then Chrome or Edge. The folder `src/check` imports only Node.js. Thus Node.js 22.18 or later can start `src/check/main.ts` with no install. The workflow `reusable-pages.yml` of the template uses it this way.
|
|
88
|
+
|
|
53
89
|
## The releases
|
|
54
90
|
|
|
55
91
|
The command merges four sources by version:
|
|
@@ -233,6 +269,31 @@ The variables are `--sp-bg`, `--sp-surface`, `--sp-sunken`, `--sp-fg`, `--sp-fg-
|
|
|
233
269
|
|
|
234
270
|
The pages operate at a width of 390 px without horizontal scroll. The timeline scrolls in its own box. The keyboard operates all controls: the arrow keys, Home and End move between the versions, and Enter or Space selects one. Without JavaScript, the releases page shows all versions.
|
|
235
271
|
|
|
272
|
+
## A cue on a box that scrolls
|
|
273
|
+
|
|
274
|
+
A wide code block or table on a narrow screen scrolls sideways. Without a cue, its text looks cut. The file `scroll-cue.css` of the package gives a cue:
|
|
275
|
+
|
|
276
|
+
- A shade shows at each edge that has more content. At an end of the box, the shade of that end goes.
|
|
277
|
+
- The cue uses only CSS. It needs no JavaScript.
|
|
278
|
+
|
|
279
|
+
Import the file in the site, and give the class `scroll-cue` to the box:
|
|
280
|
+
|
|
281
|
+
```ts
|
|
282
|
+
import "@mark1russell7/site-pages/scroll-cue.css";
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
```html
|
|
286
|
+
<pre class="scroll-cue">pnpm add @mark1russell7/site-pages</pre>
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
The class sets `overflow-x: auto` and the background color of the box. Set `--scroll-cue-bg` to the background color of the box, and `--scroll-cue-shade` to the color of the shade:
|
|
290
|
+
|
|
291
|
+
```css
|
|
292
|
+
.code {
|
|
293
|
+
--scroll-cue-bg: var(--code-bg);
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
236
297
|
## A GitHub Pages workflow
|
|
237
298
|
|
|
238
299
|
This workflow builds the site, adds the two pages, and deploys. It also starts every 3 hours, so the status page stays current without a push. A scheduled run builds the newest commit of `main` that passed CI.
|
|
@@ -2424,6 +2424,11 @@ Options:
|
|
|
2424
2424
|
--site-name <name> The name of the site in the header (default: the repository name)
|
|
2425
2425
|
--data-only Write only the JSON data, not the pages
|
|
2426
2426
|
-h, --help Show this help
|
|
2427
|
+
|
|
2428
|
+
Usage: site-pages check (--out <dir> | --url <url>) [options]
|
|
2429
|
+
|
|
2430
|
+
Opens the pages of the site in a headless Chromium at phone and desktop widths. Start
|
|
2431
|
+
"site-pages check --help" for its options.
|
|
2427
2432
|
`;
|
|
2428
2433
|
/**
|
|
2429
2434
|
* This function reads the command line into the options of `build`.
|
|
@@ -2529,4 +2534,4 @@ async function runCli(argv, io) {
|
|
|
2529
2534
|
}
|
|
2530
2535
|
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 };
|
|
2531
2536
|
|
|
2532
|
-
//# sourceMappingURL=build-
|
|
2537
|
+
//# sourceMappingURL=build-CD2wc7Yl.js.map
|