mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 04:22:12 +00:00
[remix] Ensure the symlink directory exists in ensureSymlink() (#11205)
Customer reported an edge case where (in a monorepo) their project's `package.json` did not list any dependencies (instead they are listed at the root-level `package.json`) and this caused the `node_modules` directory to not exist in the app subdirectory, causing `ensureSymlink()` to fail.
This commit is contained in:
5
.changeset/weak-countries-pull.md
Normal file
5
.changeset/weak-countries-pull.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@vercel/remix-builder': patch
|
||||
---
|
||||
|
||||
Ensure the symlink directory exists in `ensureSymlink()`
|
||||
@@ -359,6 +359,7 @@ async function ensureSymlink(
|
||||
}
|
||||
}
|
||||
|
||||
await fs.mkdir(symlinkDir, { recursive: true });
|
||||
await fs.symlink(relativeTarget, symlinkPath);
|
||||
debug(`Created symlink for "${pkgName}"`);
|
||||
}
|
||||
|
||||
@@ -17,4 +17,17 @@ describe('ensureResolvable()', () => {
|
||||
await fs.rm(start, { recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
it('should create a symlink when the node_modules directory does not exist', async () => {
|
||||
const FIXTURE = join(FIXTURES_DIR, '00-pnpm');
|
||||
const start = join(FIXTURE, 'apps/a');
|
||||
try {
|
||||
await fs.mkdir(start, { recursive: true });
|
||||
await ensureResolvable(start, FIXTURE, 'ms');
|
||||
const stat = await fs.lstat(join(start, 'node_modules/ms'));
|
||||
expect(stat.isSymbolicLink()).toEqual(true);
|
||||
} finally {
|
||||
await fs.rm(start, { recursive: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user