fix(cms): replace symlinks with rsync copy; drop stale zod v3 override

src/ and scripts/ were symlinked into the Astro project root pointing
into the nullfs-mounted bootstrap dir. Vite resolves symlink targets and
then can't find node_modules at the mount path, breaking builds. Switch
to rsync -a --delete so the working copy is always a real directory.

Remove the zod 3.25.76 override from package.json and setup/cms.ts —
it was a v3/v4 conflict workaround that no longer applies and was
breaking fresh npm installs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mevy Assistant 2026-04-21 21:20:09 +02:00
parent f3b2c0189a
commit 99fa229ae5
2 changed files with 23 additions and 19 deletions

View file

@ -21,8 +21,5 @@
"@astrojs/check": "^0.9.6",
"typescript": "^5.9.3",
"tsx": "^4.19.2"
},
"overrides": {
"zod": "3.25.76"
}
}

View file

@ -161,14 +161,29 @@ function ensureCmsDocsBootstrapMounted(
}
}
ensureSymlinkOnlyWhenMissing(
path.join(astroRootOnHost, 'src'),
`${mountTarget}/src`,
);
ensureSymlinkOnlyWhenMissing(
path.join(astroRootOnHost, 'scripts'),
`${mountTarget}/scripts`,
);
for (const dir of ['src', 'scripts']) {
const destPath = path.join(astroRootOnHost, dir);
const srcPath = path.join(mountTargetOnHost, dir);
if (!fs.existsSync(srcPath)) continue;
// Remove stale symlink if present — symlinks break Vite path resolution
try {
if (fs.lstatSync(destPath).isSymbolicLink()) {
fs.rmSync(destPath, { force: true });
}
} catch (err) {
const e = err as NodeJS.ErrnoException;
if (e.code !== 'ENOENT') throw e;
}
fs.mkdirSync(destPath, { recursive: true });
const result = spawnSync(
'rsync',
['-a', '--delete', `${srcPath}/`, `${destPath}/`],
{ encoding: 'utf-8', stdio: ['ignore', 'pipe', 'pipe'] },
);
if ((result.status ?? 1) !== 0) {
logger.warn({ dir, error: result.stderr }, `Failed to sync ${dir} from bootstrap`);
}
}
}
// ── Starlight project template content ──────────────────────────────────
@ -196,9 +211,6 @@ function starlightPackageJson(): string {
typescript: '^5.9.3',
tsx: '^4.19.2',
},
overrides: {
zod: '3.25.76',
},
},
null,
2,
@ -424,7 +436,6 @@ function ensureStarlightPackage(astroRoot: string): boolean {
const updated = JSON.parse(JSON.stringify(pkg)) as {
dependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
overrides?: Record<string, string>;
};
updated.dependencies = updated.dependencies || {};
@ -443,10 +454,6 @@ function ensureStarlightPackage(astroRoot: string): boolean {
ensureDep(updated.devDependencies, '@astrojs/check', '^0.9.6');
ensureDep(updated.devDependencies, 'typescript', '^5.9.3');
ensureDep(updated.devDependencies, 'tsx', '^4.19.2');
updated.overrides = updated.overrides || {};
if (!updated.overrides.zod) {
updated.overrides.zod = '3.25.76';
}
const next = JSON.stringify(updated, null, 2);
if (next !== currentNormalized) {