@ofidj/generator-fidj 3.8.1 → 3.9.0
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/lib/scaffold.cjs
CHANGED
|
@@ -21,6 +21,21 @@ const escapeHtml = (value) =>
|
|
|
21
21
|
const moduleRedirectRoot = (file) =>
|
|
22
22
|
(path.posix.relative(path.posix.dirname("module/" + file), ".") || ".") + "/";
|
|
23
23
|
|
|
24
|
+
// Which Fidj an app points at follows the API it talks to. It used to be the
|
|
25
|
+
// constant https://fidj.ovh, so every app built against the sandbox API sent
|
|
26
|
+
// people to a different deployment with a different database, where their apps
|
|
27
|
+
// are not — and the sandbox console never recognised itself as Fidj, because
|
|
28
|
+
// recognising itself is comparing its own origin against this value.
|
|
29
|
+
//
|
|
30
|
+
// An API host named after its console (api.X serves X) says where that console
|
|
31
|
+
// is. One that is not says nothing, and then the default stands rather than a
|
|
32
|
+
// guess being invented.
|
|
33
|
+
function dashboardFor(api) {
|
|
34
|
+
return api.hostname.startsWith("api.")
|
|
35
|
+
? `https://${api.hostname.slice(4)}`
|
|
36
|
+
: "https://fidj.ovh";
|
|
37
|
+
}
|
|
38
|
+
|
|
24
39
|
function scaffold(destination, options) {
|
|
25
40
|
const anonymous = options.anonymous ?? true;
|
|
26
41
|
if (![true, false, "true", "false"].includes(anonymous))
|
|
@@ -182,7 +197,7 @@ function scaffold(destination, options) {
|
|
|
182
197
|
? new URL("/oidc", localApi).href
|
|
183
198
|
: null,
|
|
184
199
|
apiEndpoint: localApi,
|
|
185
|
-
dashboardUrl: options.local ? "http://localhost:4200" :
|
|
200
|
+
dashboardUrl: options.local ? "http://localhost:4200" : dashboardFor(api),
|
|
186
201
|
title,
|
|
187
202
|
releaseVersion,
|
|
188
203
|
localDemo: Boolean(options.local),
|