Fix: don't copy 9 GB data dir into dist/ during production builds
BINCIO_DATA_DIR is already set in the build env, so manifest.ts reads the data root directly at build time without needing public/data. Moving _link_data() into the serve-only branch prevents Astro from following the symlink and copying the full data dir into dist/. Any leftover symlink from a previous dev session is removed before build. Dev mode is unchanged.
This commit is contained in:
@@ -201,15 +201,23 @@ def render(
|
|||||||
return
|
return
|
||||||
|
|
||||||
_ensure_npm(site)
|
_ensure_npm(site)
|
||||||
_link_data(site, data)
|
|
||||||
|
|
||||||
env = {**os.environ, "BINCIO_DATA_DIR": str(data)}
|
env = {**os.environ, "BINCIO_DATA_DIR": str(data)}
|
||||||
|
|
||||||
if serve:
|
if serve:
|
||||||
|
# Dev server needs to serve /data/ files at runtime from public/
|
||||||
|
_link_data(site, data)
|
||||||
console.print("Starting [cyan]astro dev[/cyan]…")
|
console.print("Starting [cyan]astro dev[/cyan]…")
|
||||||
subprocess.run(["npm", "run", "dev"], cwd=site, env=env)
|
subprocess.run(["npm", "run", "dev"], cwd=site, env=env)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Production build: BINCIO_DATA_DIR is already set so manifest.ts reads
|
||||||
|
# data directly; remove any leftover public/data symlink so Astro doesn't
|
||||||
|
# copy the full data directory (9+ GB) into dist/.
|
||||||
|
public_data = site / "public" / "data"
|
||||||
|
if public_data.is_symlink():
|
||||||
|
public_data.unlink()
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
cmd = ["npm", "run", "build"]
|
cmd = ["npm", "run", "build"]
|
||||||
if out_dir:
|
if out_dir:
|
||||||
|
|||||||
Reference in New Issue
Block a user