@pagenary/publisher 2026.6.1 → 2026.6.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/package.json +1 -1
- package/scripts/build-tenants.js +22 -0
- package/site/index.html +18 -4
- package/site/robots.txt +1 -1
- package/src/index.html +17 -3
package/package.json
CHANGED
package/scripts/build-tenants.js
CHANGED
|
@@ -959,6 +959,23 @@ async function applyBranding(distDir, config, tenantId) {
|
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
961
|
|
|
962
|
+
/**
|
|
963
|
+
* Replace the shell's `__PAGENARY_TENANT__` base-resolution placeholder with the
|
|
964
|
+
* real tenant id. Runs for every tenant so the runtime `<base href>` bootstrap
|
|
965
|
+
* can resolve asset/module URLs against the tenant root under subpath mounts
|
|
966
|
+
* (e.g. /tenant/) while domain-root deploys fall back to "/".
|
|
967
|
+
* @param {string} distDir - Tenant output directory
|
|
968
|
+
* @param {string} tenantId - Tenant identifier
|
|
969
|
+
*/
|
|
970
|
+
async function injectTenantBase(distDir, tenantId) {
|
|
971
|
+
const indexPath = path.join(distDir, 'index.html');
|
|
972
|
+
if (!(await pathExists(indexPath))) return;
|
|
973
|
+
const html = await fsp.readFile(indexPath, 'utf8');
|
|
974
|
+
if (!html.includes('__PAGENARY_TENANT__')) return;
|
|
975
|
+
await fsp.writeFile(indexPath, html.split('__PAGENARY_TENANT__').join(tenantId), 'utf8');
|
|
976
|
+
console.log(` ↳ wired tenant base for ${tenantId}`);
|
|
977
|
+
}
|
|
978
|
+
|
|
962
979
|
function hexToRgb(hex) {
|
|
963
980
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
964
981
|
if (!result) return null;
|
|
@@ -3313,6 +3330,11 @@ async function buildTenant(tenant, targetOverride, cacheDir, buildOptions) {
|
|
|
3313
3330
|
await applyWelcome(distDir, config, tenantId);
|
|
3314
3331
|
}
|
|
3315
3332
|
|
|
3333
|
+
// Inject the tenant id into the shell's base-resolution bootstrap for EVERY
|
|
3334
|
+
// tenant (regardless of branding config) so subpath mounts resolve assets
|
|
3335
|
+
// against the tenant root. Domain-root deploys fall back to "/".
|
|
3336
|
+
await injectTenantBase(distDir, tenantId);
|
|
3337
|
+
|
|
3316
3338
|
// Copy static assets from .public/ directory
|
|
3317
3339
|
await copyPublicAssets(sourceDir, distDir, tenantId);
|
|
3318
3340
|
|
package/site/index.html
CHANGED
|
@@ -5,9 +5,23 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
6
6
|
<title>Pagenary Docs</title>
|
|
7
7
|
<meta name="description" content="Pagenary developer documentation — building, configuring, deploying, and extending the multi-tenant documentation publisher, published with Pagenary itself." />
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
<script>
|
|
9
|
+
// Resolve all asset/module URLs against the tenant root in both deploy
|
|
10
|
+
// modes: domain-per-tenant at root (production, with SPA fallback) and a
|
|
11
|
+
// subpath mount such as /<tenant>/ (the dev preview server). The tenant id
|
|
12
|
+
// is injected at build time. On a domain root the path never starts with
|
|
13
|
+
// "/<tenant>/", so the base falls back to "/". For the un-replaced default
|
|
14
|
+
// build the placeholder starts with "_", which also yields "/".
|
|
15
|
+
(function () {
|
|
16
|
+
var t = "pagenary";
|
|
17
|
+
var p = location.pathname;
|
|
18
|
+
var base = t && p.indexOf("/" + t + "/") === 0 ? "/" + t + "/" : "/";
|
|
19
|
+
document.write('<base href="' + base + '">');
|
|
20
|
+
})();
|
|
21
|
+
</script>
|
|
22
|
+
<link rel="icon" type="image/png" href="./favicon.png" />
|
|
23
|
+
<link rel="stylesheet" href="./styles.css" />
|
|
24
|
+
<meta name="x-build" content="2026-06-15T19:17:20.632Z" />
|
|
11
25
|
</head>
|
|
12
26
|
<body>
|
|
13
27
|
<a class="skip-link" href="#app">Skip to content</a>
|
|
@@ -52,6 +66,6 @@
|
|
|
52
66
|
<ul id="commandList" class="cmd-list" role="listbox"></ul>
|
|
53
67
|
</div>
|
|
54
68
|
</div>
|
|
55
|
-
<script type="module" src="
|
|
69
|
+
<script type="module" src="./app.js"></script>
|
|
56
70
|
</body>
|
|
57
71
|
</html>
|
package/site/robots.txt
CHANGED
package/src/index.html
CHANGED
|
@@ -5,8 +5,22 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
6
6
|
<title>Docs Toolkit</title>
|
|
7
7
|
<meta name="description" content="Reusable documentation toolkit for multi-tenant services." />
|
|
8
|
-
<
|
|
9
|
-
|
|
8
|
+
<script>
|
|
9
|
+
// Resolve all asset/module URLs against the tenant root in both deploy
|
|
10
|
+
// modes: domain-per-tenant at root (production, with SPA fallback) and a
|
|
11
|
+
// subpath mount such as /<tenant>/ (the dev preview server). The tenant id
|
|
12
|
+
// is injected at build time. On a domain root the path never starts with
|
|
13
|
+
// "/<tenant>/", so the base falls back to "/". For the un-replaced default
|
|
14
|
+
// build the placeholder starts with "_", which also yields "/".
|
|
15
|
+
(function () {
|
|
16
|
+
var t = "__PAGENARY_TENANT__";
|
|
17
|
+
var p = location.pathname;
|
|
18
|
+
var base = t && p.indexOf("/" + t + "/") === 0 ? "/" + t + "/" : "/";
|
|
19
|
+
document.write('<base href="' + base + '">');
|
|
20
|
+
})();
|
|
21
|
+
</script>
|
|
22
|
+
<link rel="icon" type="image/png" href="./favicon.png" />
|
|
23
|
+
<link rel="stylesheet" href="./styles.css" />
|
|
10
24
|
</head>
|
|
11
25
|
<body>
|
|
12
26
|
<a class="skip-link" href="#app">Skip to content</a>
|
|
@@ -51,6 +65,6 @@
|
|
|
51
65
|
<ul id="commandList" class="cmd-list" role="listbox"></ul>
|
|
52
66
|
</div>
|
|
53
67
|
</div>
|
|
54
|
-
<script type="module" src="
|
|
68
|
+
<script type="module" src="./app.js"></script>
|
|
55
69
|
</body>
|
|
56
70
|
</html>
|