fix: don't fail when moving packages to node_modules/.ignored (#4626)

This commit is contained in:
Zoltan Kochan
2022-04-27 11:34:20 +03:00
committed by GitHub
parent 9177ddbc9a
commit 7478cbd053
4 changed files with 11 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/resolve-dependencies": patch
"pnpm": patch
---
Installation shouldn't fail when a package from node_modules is moved to the `node_modules/.ignored` subfolder and a package with that name is already present in `node_modules/.ignored'.

View File

@@ -52,6 +52,7 @@
"is-subdir": "^1.1.1",
"path-exists": "^4.0.0",
"ramda": "^0.27.1",
"rename-overwrite": "^4.0.2",
"replace-string": "^3.1.0",
"semver": "^7.3.4",
"semver-range-intersect": "^0.3.1",

View File

@@ -1,8 +1,8 @@
import { promises as fs } from 'fs'
import path from 'path'
import logger from '@pnpm/logger'
import isInnerLink from 'is-inner-link'
import isSubdir from 'is-subdir'
import renameOverwrite from 'rename-overwrite'
export default async function safeIsInnerLink (
projectModulesDir: string,
@@ -30,8 +30,7 @@ export default async function safeIsInnerLink (
prefix: opts.projectDir,
})
const ignoredDir = path.join(projectModulesDir, '.ignored', depName)
await fs.mkdir(path.dirname(ignoredDir), { recursive: true })
await fs.rename(
await renameOverwrite(
path.join(projectModulesDir, depName),
ignoredDir
)

2
pnpm-lock.yaml generated
View File

@@ -3186,6 +3186,7 @@ importers:
is-subdir: ^1.1.1
path-exists: ^4.0.0
ramda: ^0.27.1
rename-overwrite: ^4.0.2
replace-string: ^3.1.0
semver: ^7.3.4
semver-range-intersect: ^0.3.1
@@ -3214,6 +3215,7 @@ importers:
is-subdir: 1.2.0
path-exists: 4.0.0
ramda: 0.27.2
rename-overwrite: 4.0.2
replace-string: 3.1.0
semver: 7.3.7
semver-range-intersect: 0.3.1