feat(deploy): move app URL to /human-machine-strata + 301 from the legacy path
Build default app-path → /human-machine-strata; deploy.sh APP_PATH default too. _write_redirects now emits a permanent redirect /human-experience-simulator/* → /human-machine-strata/:splat so old links still land. Media (R2 bucket) + Pages project names are unchanged (not in the benstull.art URL). Updated the build test (asserts the legacy redirect) + static-build e2e path + README paths. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+16
-6
@@ -59,13 +59,23 @@ def _write_config(app_dir: Path, media_base: str) -> None:
|
||||
)
|
||||
|
||||
|
||||
# The app's original deploy path, kept as a permanent redirect so old links to
|
||||
# /human-experience-simulator/… still land on the renamed /human-machine-strata/….
|
||||
LEGACY_APP_PATH = "human-experience-simulator"
|
||||
|
||||
|
||||
def _write_redirects(out: Path, seg: str) -> None:
|
||||
# Apex → app path, and the no-trailing-slash form → slashed (so RELATIVE asset
|
||||
# urls resolve under the prefix). Cloudflare Pages `_redirects` syntax.
|
||||
(out / "_redirects").write_text(
|
||||
f"/ /{seg}/ 308\n"
|
||||
f"/{seg} /{seg}/ 308\n"
|
||||
)
|
||||
# urls resolve under the prefix). Plus a permanent (301) redirect from the legacy
|
||||
# path to the current one. Cloudflare Pages `_redirects` syntax.
|
||||
lines = [
|
||||
f"/ /{seg}/ 308\n",
|
||||
f"/{seg} /{seg}/ 308\n",
|
||||
]
|
||||
if LEGACY_APP_PATH and LEGACY_APP_PATH != seg:
|
||||
lines.append(f"/{LEGACY_APP_PATH}/* /{seg}/:splat 301\n")
|
||||
lines.append(f"/{LEGACY_APP_PATH} /{seg}/ 301\n")
|
||||
(out / "_redirects").write_text("".join(lines))
|
||||
|
||||
|
||||
def _write_headers(out: Path, seg: str) -> None:
|
||||
@@ -158,7 +168,7 @@ if __name__ == "__main__":
|
||||
ap.add_argument("--out", default="dist")
|
||||
ap.add_argument("--media-out", default="dist-media")
|
||||
ap.add_argument("--media-base", default="https://static.benstull.art/")
|
||||
ap.add_argument("--app-path", default="/human-experience-simulator")
|
||||
ap.add_argument("--app-path", default="/human-machine-strata")
|
||||
a = ap.parse_args()
|
||||
r = build_static(a.out, a.media_out, media_base=a.media_base, app_path=a.app_path)
|
||||
print(json.dumps(r, indent=2))
|
||||
|
||||
Reference in New Issue
Block a user