@meddleware/frontend-config 0.0.3 → 0.0.4
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 -0
- package/dist/network-status.d.ts +8 -0
- package/package.json +3 -2
- package/src/network-status.js +45 -0
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.4] - 2026-11-07
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `mw-network-status`: writes the networks the platform is deployed on from the clients' deployment records, for the landing page, docs and developer docs.
|
|
13
|
+
|
|
8
14
|
## [0.0.3] - 2026-11-07
|
|
9
15
|
|
|
10
16
|
### Added
|
package/README.md
CHANGED
|
@@ -23,6 +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 [--out src/network.json]`: which networks MeddleWare is deployed on, from the installed clients' deployment records through `networkAvailability` (`@meddleware/web-utils`). A static site runs it as `prebuild`, so "mainnet is coming" turns into "live" by the records alone. |
|
|
26
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). |
|
|
27
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. |
|
|
28
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. |
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @param {{ networkAvailability: Function }} utils
|
|
4
|
+
* @param {Record<string, Record<string, unknown>>} records product name → its deployments object
|
|
5
|
+
*/
|
|
6
|
+
export function networkStatus(utils: {
|
|
7
|
+
networkAvailability: Function;
|
|
8
|
+
}, records: Record<string, Record<string, unknown>>): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meddleware/frontend-config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
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",
|
|
@@ -175,6 +175,7 @@
|
|
|
175
175
|
"mw-audit-gate": "./src/audit-gate.js",
|
|
176
176
|
"mw-third-party-licenses": "./src/third-party-licenses.js",
|
|
177
177
|
"mw-check-csp-inline": "./src/check-csp-inline.js",
|
|
178
|
-
"mw-sync": "./src/sync.js"
|
|
178
|
+
"mw-sync": "./src/sync.js",
|
|
179
|
+
"mw-network-status": "./src/network-status.js"
|
|
179
180
|
}
|
|
180
181
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-check
|
|
3
|
+
// mw-network-status — write which networks MeddleWare is deployed on, from the deployment records of the installed client packages, so a static
|
|
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
|
+
//
|
|
6
|
+
// mw-network-status [--out src/network.json] (default: print to stdout)
|
|
7
|
+
//
|
|
8
|
+
// Run it from the repository root before the build (a `prebuild` script). The repository needs `@meddleware/web-utils` and the two clients
|
|
9
|
+
// (`@meddleware/access-gate-client`, `@meddleware/sealed-storage-client`) installed; it fails when one is missing rather than guess.
|
|
10
|
+
import { writeFileSync } from 'node:fs'
|
|
11
|
+
import { createRequire } from 'node:module'
|
|
12
|
+
import { join } from 'node:path'
|
|
13
|
+
import { pathToFileURL } from 'node:url'
|
|
14
|
+
|
|
15
|
+
/** @param {string} name */
|
|
16
|
+
async function load(name) {
|
|
17
|
+
const require = createRequire(join(process.cwd(), 'noop.js'))
|
|
18
|
+
return import(pathToFileURL(require.resolve(name)).href)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param {{ networkAvailability: Function }} utils
|
|
23
|
+
* @param {Record<string, Record<string, unknown>>} records product name → its deployments object
|
|
24
|
+
*/
|
|
25
|
+
export function networkStatus(utils, records) {
|
|
26
|
+
return utils.networkAvailability(Object.fromEntries(Object.entries(records).map(([name, deployments]) => [name, Object.keys(deployments)])))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
30
|
+
const args = process.argv.slice(2)
|
|
31
|
+
const outIndex = args.indexOf('--out')
|
|
32
|
+
const out = outIndex >= 0 ? args[outIndex + 1] : undefined
|
|
33
|
+
try {
|
|
34
|
+
const utils = await load('@meddleware/web-utils')
|
|
35
|
+
const gate = await load('@meddleware/access-gate-client')
|
|
36
|
+
const sealed = await load('@meddleware/sealed-storage-client')
|
|
37
|
+
const status = networkStatus(utils, { 'access gate': gate.ACCESS_GATE_DEPLOYMENTS, 'sealed storage': sealed.SEAL_POLICIES_DEPLOYMENTS })
|
|
38
|
+
const json = JSON.stringify(status, null, 2) + '\n'
|
|
39
|
+
if (out) writeFileSync(out, json)
|
|
40
|
+
else process.stdout.write(json)
|
|
41
|
+
} catch (err) {
|
|
42
|
+
console.error(`mw-network-status: ${err instanceof Error ? err.message : String(err)}`)
|
|
43
|
+
process.exit(1)
|
|
44
|
+
}
|
|
45
|
+
}
|