The Go module moves from backend/ to the root (go.mod, go.sum, .golangci.yml, cmd/, internal/), the page's source to web/, and nginx's two files to configs/. backend/ is gone: its LICENSE and .dockerignore are deleted, and its .gitignore entries, README and scripts are folded into the root ones. script/build builds the server binary after the frontend; script/run and script/clean move up from backend/script/; make test, lint, fmt and fmt-check do what the backend's did. Vite's root is web/ and it still builds into dist/. go.mod ignores node_modules/, whose npm packages can ship .go files. script/bootstrap no longer installs gcc, which only the host Go tests needed. Model: opus-5-5
This commit was merged in pull request #127.
This commit is contained in:
+10
-10
@@ -7,11 +7,11 @@ make frontend-viewport-test
|
||||
```
|
||||
|
||||
It builds `dist/`, serves it from the same digest-pinned `nginx` image and the
|
||||
same `nginx.conf` the shipping container uses, drives a digest-pinned headless
|
||||
Chrome against it over CDP, and asserts on computed layout at every viewport
|
||||
width derived from the app's own CSS. Screenshots land in `tmp/viewport/`
|
||||
alongside a `results.json`; they are artifacts for a human to look at when
|
||||
something fails, not the evidence. The assertions are the evidence.
|
||||
same `configs/nginx.conf` the shipping container uses, drives a digest-pinned
|
||||
headless Chrome against it over CDP, and asserts on computed layout at every
|
||||
viewport width derived from the app's own CSS. Screenshots land in
|
||||
`tmp/viewport/` alongside a `results.json`; they are artifacts for a human to
|
||||
look at when something fails, not the evidence. The assertions are the evidence.
|
||||
|
||||
The target is deliberately outside `make check`: it takes minutes, and
|
||||
`make test` has to stay under 60 seconds.
|
||||
@@ -19,10 +19,10 @@ The target is deliberately outside `make check`: it takes minutes, and
|
||||
## How the widths are chosen
|
||||
|
||||
Not from a list of phone models. `viewports.js` parses the `@media` conditions
|
||||
out of `src/styles.css` and scans `src/main.js` and `index.html` for Tailwind
|
||||
responsive prefixes, then tests every breakpoint it finds at one pixel below it,
|
||||
exactly on it, and one pixel above it. A generic 375px "phone" test sails
|
||||
straight past an off-by-one at a media query boundary; `max-width: 768px`
|
||||
out of `web/src/styles.css` and scans `web/src/main.js` and `web/index.html` for
|
||||
Tailwind responsive prefixes, then tests every breakpoint it finds at one pixel
|
||||
below it, exactly on it, and one pixel above it. A generic 375px "phone" test
|
||||
sails straight past an off-by-one at a media query boundary; `max-width: 768px`
|
||||
matches _at_ 768, and the sweep pins down which side of that line each layout is
|
||||
on.
|
||||
|
||||
@@ -108,7 +108,7 @@ function of viewport width and CSS, and is covered above.
|
||||
|
||||
Complementary layers, not two stacks. The unit tests in `test/unit/`, which
|
||||
`make test` runs with Node's built-in test runner, exercise the functions
|
||||
`src/main.js` exports in-process with no browser. This harness exercises
|
||||
`web/src/main.js` exports in-process with no browser. This harness exercises
|
||||
rendered layout in a real engine and is the only thing here that can see a media
|
||||
query. Neither replaces the other; assertions about computed styles and element
|
||||
geometry belong here, assertions about functions belong in `test/unit/`.
|
||||
|
||||
@@ -51,7 +51,8 @@ const PROBE_DELAYS_MS = [2, 45, 123, 456, 780];
|
||||
// offline row rendering is exercised too.
|
||||
const UNREACHABLE_MODULUS = 7;
|
||||
// The gateway candidate that "answers", so gateway detection succeeds and
|
||||
// the Local Gateway row renders. Matches GATEWAY_CANDIDATES in src/main.js.
|
||||
// the Local Gateway row renders. Matches GATEWAY_CANDIDATES in
|
||||
// web/src/main.js.
|
||||
const RESPONSIVE_GATEWAY = "http://192.168.1.1";
|
||||
|
||||
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
|
||||
@@ -161,26 +161,27 @@ const ANCHOR_VIEWPORTS = [
|
||||
export function deriveViewports(root) {
|
||||
const conditions = [
|
||||
...mediaConditionsFromCss(
|
||||
readFileSync(join(root, "src/styles.css"), "utf8"),
|
||||
"src/styles.css",
|
||||
readFileSync(join(root, "web/src/styles.css"), "utf8"),
|
||||
"web/src/styles.css",
|
||||
),
|
||||
...mediaConditionsFromMarkup([
|
||||
{
|
||||
path: "src/main.js",
|
||||
text: readFileSync(join(root, "src/main.js"), "utf8"),
|
||||
path: "web/src/main.js",
|
||||
text: readFileSync(join(root, "web/src/main.js"), "utf8"),
|
||||
},
|
||||
{
|
||||
path: "index.html",
|
||||
text: readFileSync(join(root, "index.html"), "utf8"),
|
||||
path: "web/index.html",
|
||||
text: readFileSync(join(root, "web/index.html"), "utf8"),
|
||||
},
|
||||
]),
|
||||
];
|
||||
|
||||
if (conditions.length === 0) {
|
||||
throw new Error(
|
||||
"no responsive breakpoints found in src/styles.css, src/main.js or " +
|
||||
"index.html — either the responsive layout was deleted or this " +
|
||||
"derivation has stopped matching the sources",
|
||||
"no responsive breakpoints found in web/src/styles.css, " +
|
||||
"web/src/main.js or web/index.html — either the responsive " +
|
||||
"layout was deleted or this derivation has stopped matching " +
|
||||
"the sources",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user