@ofidj/generator-fidj 1.7.3 → 3.7.3
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
CHANGED
|
@@ -62,7 +62,16 @@ a style change lands here first.
|
|
|
62
62
|
|
|
63
63
|
Generation writes `.env.example`, `.env` and public `app.config.json`. Static configuration is embedded at build time: regenerate/rebuild when changing endpoints. Notes server configuration is read at runtime. Do not place secrets in any public configuration or content input.
|
|
64
64
|
|
|
65
|
-
For unpublished coordinated changes, build the sibling SDK and pass `--sdk-path` with its absolute `dist` path. Committed templates use registry dependency `@ofidj/node ^3.
|
|
65
|
+
For unpublished coordinated changes, build the sibling SDK and pass `--sdk-path` with its absolute `dist` path. Committed templates use registry dependency `@ofidj/node ^3.7.3`; a registry-only install is not validated until coordinated versions are published.
|
|
66
|
+
|
|
67
|
+
Every generated app carries a fixed bottom-right badge naming the Fidj it runs:
|
|
68
|
+
`fidj@<version>`, taken from the SDK it was generated with — the `--sdk-path`
|
|
69
|
+
build when one is supplied, the template's `@ofidj/node` range otherwise — and
|
|
70
|
+
written to `APP_VERSION` and `app.config.json`. On Fidj's own apps it also shows
|
|
71
|
+
the version `/v3/status` answers with, so the two can be compared without
|
|
72
|
+
translation. Keep that range on the version this generator releases: the
|
|
73
|
+
workspace's `scripts/check-versions.py` and this package's own suite both refuse
|
|
74
|
+
the mismatch.
|
|
66
75
|
|
|
67
76
|
## Real validation repository
|
|
68
77
|
|
|
@@ -437,7 +437,14 @@ function render() {
|
|
|
437
437
|
askedProvider = true;
|
|
438
438
|
void (async () => {
|
|
439
439
|
if (!(await providerRendersHere())) return;
|
|
440
|
-
|
|
440
|
+
// Being recognised again is the one thing somebody who just signed out did
|
|
441
|
+
// not ask for, and this shortcut is what made a sign-out undoable by a page
|
|
442
|
+
// reload. Ending the provider session is what should make that impossible,
|
|
443
|
+
// and that call can be refused — so here the screen asks rather than
|
|
444
|
+
// assumes, until somebody signs in again.
|
|
445
|
+
window.location.assign(
|
|
446
|
+
await oidc.beginLogin(oidc.signedOutHere() ? { prompt: "login" } : {}),
|
|
447
|
+
);
|
|
441
448
|
})();
|
|
442
449
|
}
|
|
443
450
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export function showVersionBadge(version: string, apiEndpoint?: string): void {
|
|
2
|
-
if (!/^\d
|
|
2
|
+
if (!/^\d+\.\d+\.\d+(-[\w.]+)?$/.test(version || "")) return;
|
|
3
3
|
const badge = document.createElement("div");
|
|
4
4
|
badge.className = "fidj-version";
|
|
5
|
-
badge.setAttribute("aria-label", `
|
|
6
|
-
badge.textContent = `
|
|
5
|
+
badge.setAttribute("aria-label", `Fidj version ${version}`);
|
|
6
|
+
badge.textContent = `fidj@${version}`;
|
|
7
7
|
document.body.append(badge);
|
|
8
8
|
if (apiEndpoint) {
|
|
9
9
|
void fetch(`${apiEndpoint.replace(/\/$/, "")}/status`)
|
|
@@ -11,8 +11,8 @@ export function showVersionBadge(version: string, apiEndpoint?: string): void {
|
|
|
11
11
|
.then(status => {
|
|
12
12
|
const apiVersion = status?.version || status?.built;
|
|
13
13
|
if (!apiVersion) return;
|
|
14
|
-
badge.textContent = `
|
|
15
|
-
badge.setAttribute("aria-label", `
|
|
14
|
+
badge.textContent = `fidj@${version} · API ${apiVersion}`;
|
|
15
|
+
badge.setAttribute("aria-label", `Fidj version ${version}, API version ${apiVersion}`);
|
|
16
16
|
})
|
|
17
17
|
.catch(() => undefined);
|
|
18
18
|
}
|
package/lib/scaffold.cjs
CHANGED
|
@@ -135,6 +135,10 @@ function scaffold(destination, options) {
|
|
|
135
135
|
fs.readFileSync(path.join(dir, "package.json"), "utf8"),
|
|
136
136
|
);
|
|
137
137
|
pkg.name = name;
|
|
138
|
+
// The badge says which Fidj the app is running, so the version comes from the
|
|
139
|
+
// SDK the app will actually carry: the local build when one is supplied, the
|
|
140
|
+
// published range otherwise. A date told nobody which API it could talk to.
|
|
141
|
+
let releaseVersion = pkg.dependencies["@ofidj/node"].replace(/^[\^~]/, "");
|
|
138
142
|
if (options.sdkPath) {
|
|
139
143
|
const sdkPath = path.resolve(options.sdkPath);
|
|
140
144
|
const sdk = JSON.parse(
|
|
@@ -142,6 +146,7 @@ function scaffold(destination, options) {
|
|
|
142
146
|
);
|
|
143
147
|
if (sdk.name !== "@ofidj/node")
|
|
144
148
|
throw new Error("SDK path must contain a built @ofidj/node package.");
|
|
149
|
+
releaseVersion = sdk.version;
|
|
145
150
|
pkg.dependencies["@ofidj/node"] = "file:" + sdkPath;
|
|
146
151
|
}
|
|
147
152
|
fs.writeFileSync(
|
|
@@ -149,7 +154,6 @@ function scaffold(destination, options) {
|
|
|
149
154
|
JSON.stringify(pkg, null, 2) + "\n",
|
|
150
155
|
);
|
|
151
156
|
fs.renameSync(path.join(dir, "gitignore"), path.join(dir, ".gitignore"));
|
|
152
|
-
const releaseVersion = new Date().toISOString().slice(2, 10).replaceAll("-", ".");
|
|
153
157
|
// The app's own server serves this to its page: the entry cannot redirect to
|
|
154
158
|
// a provider it was never told about.
|
|
155
159
|
const issuerSetting = options.oidcIssuer ? `FIDJ_OIDC_ISSUER=${options.oidcIssuer}\n` : "";
|