@meddleware/frontend-config 0.0.4 → 0.0.5
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/network-status.js +18 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.0.5] - 2026-11-07
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `mw-network-status --check <file>`: fails when the committed network file differs from the deployment records (for CI).
|
|
13
|
+
|
|
8
14
|
## [0.0.4] - 2026-11-07
|
|
9
15
|
|
|
10
16
|
### Added
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ same accessibility and browser-support bar.
|
|
|
23
23
|
| `/tsconfig/vue-app.json` | The compiler options of a Vue app (`"extends": "@meddleware/frontend-config/tsconfig/vue-app.json"`); the repository keeps only its `include`. |
|
|
24
24
|
| `/csp` | `buildCsp(options)`, `cspForProfile(name, current?)`, `PROFILES`, `scriptHashesOf(csp)` — the Content-Security-Policy every app image serves, as six named profiles (`static`, `static-strict`, `console`, `chain`, `chain-wasm`, `docs`), so the policy is written once. |
|
|
25
25
|
| `mw-sync` | `mw-sync --check` / `--write` in a repository root: the files every frontend repository copies (dependabot.yml, .dockerignore, postcss/stylelint configs, the Lighthouse allowlist) equal this package's `templates/`, and the Dockerfile's `ARG CSP` equals its profile. Declared in package.json: `"meddleware": { "kind": "app", "csp": "chain-wasm", "lhci": true }`. |
|
|
26
|
-
| `mw-network-status` | `mw-network-status
|
|
26
|
+
| `mw-network-status` | `mw-network-status --out src/network.json` (or `--check src/network.json` in CI): which networks MeddleWare is deployed on, from the installed clients' deployment records through `networkAvailability` (`@meddleware/web-utils`). The file is committed and CI checks it, so "mainnet is coming" turns into "live" by the records alone. |
|
|
27
27
|
| `mw-audit-gate` | CI dependency gate: `npm audit` at high/critical minus the dated, reasoned entries of `.github/audit-allowlist.json` (an entry with no reason or an expired date fails). |
|
|
28
28
|
| `mw-third-party-licenses` | Writes `dist/THIRD_PARTY_LICENSES` from the lockfile's production packages and their installed licence texts; `--check` fails when none can be written. |
|
|
29
29
|
| `mw-check-csp-inline` | `mw-check-csp-inline <policy or @Dockerfile> [dist]`: every inline script in the built pages is allowed by a `sha256` source in the policy, and the policy never allows `'unsafe-inline'` scripts. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meddleware/frontend-config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared frontend tooling for MeddleWare apps: browser support, ESLint, Stylelint, html-validate, PostCSS, Playwright, axe, screenshots, Lighthouse and the Vite target.",
|
|
6
6
|
"license": "0BSD",
|
package/src/network-status.js
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
// site (landing page, docs, developer docs) says "mainnet is coming" until the records have a `mainnet` key and says "live" the moment they do.
|
|
5
5
|
//
|
|
6
6
|
// mw-network-status [--out src/network.json] (default: print to stdout)
|
|
7
|
+
// mw-network-status --check src/network.json fail (exit 1) when the committed file differs from the records
|
|
7
8
|
//
|
|
8
|
-
//
|
|
9
|
+
// The file is committed, so the page and its tests never depend on a hidden build step; CI runs `--check`, and bumping a client package
|
|
10
|
+
// (Dependabot, or a release that adds a mainnet record) fails the check until the file is regenerated with `--out`. The repository needs `@meddleware/web-utils` and the two clients
|
|
9
11
|
// (`@meddleware/access-gate-client`, `@meddleware/sealed-storage-client`) installed; it fails when one is missing rather than guess.
|
|
10
|
-
import { writeFileSync } from 'node:fs'
|
|
12
|
+
import { readFileSync, writeFileSync } from 'node:fs'
|
|
11
13
|
import { createRequire } from 'node:module'
|
|
12
14
|
import { join } from 'node:path'
|
|
13
15
|
import { pathToFileURL } from 'node:url'
|
|
@@ -30,13 +32,26 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
30
32
|
const args = process.argv.slice(2)
|
|
31
33
|
const outIndex = args.indexOf('--out')
|
|
32
34
|
const out = outIndex >= 0 ? args[outIndex + 1] : undefined
|
|
35
|
+
const checkIndex = args.indexOf('--check')
|
|
36
|
+
const check = checkIndex >= 0 ? args[checkIndex + 1] : undefined
|
|
33
37
|
try {
|
|
34
38
|
const utils = await load('@meddleware/web-utils')
|
|
35
39
|
const gate = await load('@meddleware/access-gate-client')
|
|
36
40
|
const sealed = await load('@meddleware/sealed-storage-client')
|
|
37
41
|
const status = networkStatus(utils, { 'access gate': gate.ACCESS_GATE_DEPLOYMENTS, 'sealed storage': sealed.SEAL_POLICIES_DEPLOYMENTS })
|
|
38
42
|
const json = JSON.stringify(status, null, 2) + '\n'
|
|
39
|
-
if (
|
|
43
|
+
if (check) {
|
|
44
|
+
let have = ''
|
|
45
|
+
try {
|
|
46
|
+
have = readFileSync(check, 'utf8')
|
|
47
|
+
} catch {
|
|
48
|
+
// missing counts as different
|
|
49
|
+
}
|
|
50
|
+
if (have !== json) {
|
|
51
|
+
console.error(`mw-network-status: ${check} is out of date with the deployment records; run \`mw-network-status --out ${check}\``)
|
|
52
|
+
process.exit(1)
|
|
53
|
+
}
|
|
54
|
+
} else if (out) writeFileSync(out, json)
|
|
40
55
|
else process.stdout.write(json)
|
|
41
56
|
} catch (err) {
|
|
42
57
|
console.error(`mw-network-status: ${err instanceof Error ? err.message : String(err)}`)
|