@ofidj/generator-fidj 1.8.0 → 3.7.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/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.6.24`; a registry-only install is not validated until coordinated versions are published.
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
 
@@ -15,7 +15,7 @@
15
15
  "privacy:rehearse": "npm run build && node --test test/server.test.mjs"
16
16
  },
17
17
  "dependencies": {
18
- "@ofidj/node": "^3.6.30"
18
+ "@ofidj/node": "^3.7.3"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/node": "^22.0.0",
@@ -269,6 +269,13 @@ function startModule() {
269
269
  for (const script of mount.scripts) {
270
270
  const element = document.createElement("script");
271
271
  if (script.module) element.type = "module";
272
+ // A script created here carries async = true by default, so these execute
273
+ // in whatever order the network returns them. An app's polyfills have to
274
+ // run before its entry point — Angular boots without Zone.js otherwise,
275
+ // throws NG0908 and paints nothing, which reaches the person as a blank
276
+ // page, intermittently, with nothing said. Clearing it restores the order
277
+ // they were inserted in, which is the order the app's own document had.
278
+ element.async = false;
272
279
  element.src = script.src;
273
280
  document.body.appendChild(element);
274
281
  }
@@ -1,9 +1,9 @@
1
1
  export function showVersionBadge(version: string, apiEndpoint?: string): void {
2
- if (!/^\d{2}\.\d{2}\.\d{2}$/.test(version || "")) return;
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", `App version ${version}`);
6
- badge.textContent = `v${version}`;
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 = `v${version} · API ${apiVersion}`;
15
- badge.setAttribute("aria-label", `App version ${version}, API version ${apiVersion}`);
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` : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ofidj/generator-fidj",
3
- "version": "1.8.0",
3
+ "version": "3.7.4",
4
4
  "description": "Generate a TypeScript app with Fidj sign-in, live server-side roles and per-app privacy.",
5
5
  "homepage": "https://fidj.ovh",
6
6
  "bugs": {