@aravindc26/velu 0.11.19 → 0.11.20
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/src/cli.ts +15 -1
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolve, join, dirname, delimiter } from "node:path";
|
|
2
|
-
import { existsSync, mkdirSync, writeFileSync, readdirSync, copyFileSync, rmSync, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { existsSync, mkdirSync, writeFileSync, readdirSync, copyFileSync, rmSync, readFileSync, statSync, symlinkSync } from "node:fs";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
|
|
@@ -230,6 +230,20 @@ async function generateProject(docsDir: string): Promise<string> {
|
|
|
230
230
|
// Generate into the active docs project directory.
|
|
231
231
|
const outDir = join(docsDir, ".velu-out");
|
|
232
232
|
build(docsDir, outDir);
|
|
233
|
+
|
|
234
|
+
// Symlink the package's node_modules into the output directory so ESM imports
|
|
235
|
+
// (e.g. fumadocs-mdx in next.config.mjs) resolve correctly when building
|
|
236
|
+
// from a temp directory outside the package root.
|
|
237
|
+
const outNodeModules = join(outDir, "node_modules");
|
|
238
|
+
if (!existsSync(outNodeModules)) {
|
|
239
|
+
try {
|
|
240
|
+
symlinkSync(NODE_MODULES_PATH, outNodeModules, "junction");
|
|
241
|
+
} catch {
|
|
242
|
+
// Fall back to dir symlink on Linux if junction is unsupported
|
|
243
|
+
try { symlinkSync(NODE_MODULES_PATH, outNodeModules, "dir"); } catch {}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
233
247
|
return outDir;
|
|
234
248
|
}
|
|
235
249
|
|