Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.