Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: symlink local dep even when target dir does not exist (#5253)
close #5219
- Loading branch information
Showing
7 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@pnpm/symlink-dependency": patch | ||
"pnpm": patch | ||
--- | ||
|
||
Symlink a local dependency to `node_modules`, even if the target directory doesn't exist [#5219](https://github.com/pnpm/pnpm/issues/5219). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('../../jest.config.js') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/symlink-dependency/test/symlinkDirectRootDependency.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import fs from 'fs' | ||
import path from 'path' | ||
import { tempDir } from '@pnpm/prepare' | ||
import { symlinkDirectRootDependency } from '@pnpm/symlink-dependency' | ||
|
||
test('symlink is created to directory that does not yet exist', async () => { | ||
const tmp = tempDir(false) | ||
const destModulesDir = path.join(tmp, 'node_modules') | ||
const dependencyLocation = path.join(tmp, 'dep') | ||
fs.mkdirSync(destModulesDir) | ||
await symlinkDirectRootDependency(dependencyLocation, destModulesDir, 'dep', { | ||
linkedPackage: { | ||
name: 'dep', | ||
version: '1.0.0', | ||
}, | ||
prefix: '', | ||
}) | ||
fs.mkdirSync(dependencyLocation) | ||
fs.writeFileSync(path.join(dependencyLocation, 'index.js'), 'module.exports = {}') | ||
expect(fs.existsSync(path.join(destModulesDir, 'dep/index.js'))).toBe(true) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.