Skip to content

Commit

Permalink
fix: don't fail when moving packages to node_modules/.ignored (#4626)
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Apr 27, 2022
1 parent 104663a commit 7dcabeb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/strong-bears-own.md
@@ -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'.
1 change: 1 addition & 0 deletions packages/resolve-dependencies/package.json
Expand Up @@ -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",
Expand Down
5 changes: 2 additions & 3 deletions packages/resolve-dependencies/src/safeIsInnerLink.ts
@@ -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,
Expand Down Expand Up @@ -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
)
Expand Down
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7dcabeb

Please sign in to comment.