@tokenoftrust/storefront-runner 2.2.89 → 2.2.91

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.
@@ -62,7 +62,7 @@ import {
62
62
  import { dirname, resolve, join } from "node:path";
63
63
  import { fileURLToPath } from "node:url";
64
64
  import { resolveDevSourceRoot } from "./dev/tenant-source-root.mjs";
65
- import { tenantDirRelative, tenantDirSegments } from "./lib/tenant-dirs.mjs";
65
+ import { tenantDirSegments } from "./lib/tenant-dirs.mjs";
66
66
  import { firstFreePort, isPortFree } from "./dev/port-check.mjs";
67
67
  import { busyPortMessage, classifyBusyPort, lockPort, unlockPort } from "./dev/port-lock.mjs";
68
68
  import { resync, startWatch } from "./dev/checkout-watch.mjs";
@@ -276,12 +276,12 @@ if (workspacePath) {
276
276
  console.log(` checkout: ${wsRoot}`);
277
277
 
278
278
  /**
279
- * Graft one checkout path (`wsRel`, checkout-relative) into the in-tree
280
- * `tenants/<tenant>/` layout the app globs, with the same move-aside/restore +
281
- * watch-and-resync machinery every mapping gets. Returns true if grafted.
279
+ * Graft one checkout path (`wsRel`, checkout-relative) to `repoRel` in the
280
+ * in-tree `tenants/<tenant>/` layout the app globs, with the same
281
+ * move-aside/restore + watch-and-resync machinery every mapping gets. Returns
282
+ * true if grafted.
282
283
  */
283
- function graftOne(wsRel, isDir) {
284
- const repoRel = join(tenantDirRelative(tenant), wsRel);
284
+ function graftOne(wsRel, repoRel, isDir) {
285
285
 
286
286
  const source = resolve(wsRoot, wsRel); // real files in the checkout
287
287
  const target = resolve(repoRoot, repoRel); // where the app globs them
@@ -320,19 +320,19 @@ if (workspacePath) {
320
320
  return true;
321
321
  }
322
322
 
323
- // `workspace` is the checkout-relative prefix (e.g. "content/", "theme.json").
324
- // COLOCATION: a tenant IS the repo-root dir `tenants/<id>/`, and the checkout
325
- // (a `git subtree split --prefix=tenants/<id>` of that dir) has the SAME layout
326
- // at its root — so the graft is an identity map: content/ -> tenants/<id>/content/,
327
- // public/ -> tenants/<id>/public/, theme.json -> tenants/<id>/theme.json. We map
328
- // structurally (ignoring any legacy `repo` field in the checkout's .tot/config.json).
329
- // standaloneGraftPlan ALSO appends `.tot/config.json` unconditionally — see its
330
- // own doc comment. Its success does NOT count toward "did we graft a usable
331
- // site" below: a checkout with config but no content/public/theme is still
332
- // nothing to serve.
323
+ // Each mapping's checkout files land where its `repo` says, under THIS tenant's
324
+ // directory (see scripts/dev/standalone-graft-plan.mjs) — resolved exactly as
325
+ // the hosted reconcile resolves them. standaloneGraftPlan ALSO appends
326
+ // `.tot/config.json` unconditionally — see its own doc comment. Its success does
327
+ // NOT count toward "did we graft a usable site" below: a checkout with config but
328
+ // no content/public/theme is still nothing to serve.
333
329
  let mappedCount = 0;
334
- for (const { workspace, isDir } of standaloneGraftPlan(mappings)) {
335
- const grafted = graftOne(workspace, isDir);
330
+ for (const { workspace, target, isDir } of standaloneGraftPlan(tenant, mappings)) {
331
+ if (!target) {
332
+ console.warn(` ⚠ mapping for "${workspace}" has no valid "repo" under tenants/<id>/ — skipping (run tot validate)`);
333
+ continue;
334
+ }
335
+ const grafted = graftOne(workspace, target, isDir);
336
336
  if (workspace === ".tot/config.json") {
337
337
  if (!grafted) console.warn(` ⚠ checkout has no .tot/config.json — compliance/capabilities/siteType resolve undeclared.`);
338
338
  continue;