mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-27 18:46:18 -04:00
perf(modules-cleaner): don't use fs-vacuum
This commit is contained in:
5
.changeset/breezy-radios-sort.md
Normal file
5
.changeset/breezy-radios-sort.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/modules-cleaner": minor
|
||||
---
|
||||
|
||||
Don't try to remove empty branches of a directory tree, when pruning `node_modules`.
|
||||
@@ -39,7 +39,6 @@
|
||||
"@pnpm/types": "workspace:5.0.0",
|
||||
"@zkochan/rimraf": "1.0.0",
|
||||
"dependency-path": "workspace:4.0.6",
|
||||
"fs-vacuum": "1.2.10",
|
||||
"is-windows": "1.0.2",
|
||||
"ramda": "0.27.0"
|
||||
},
|
||||
|
||||
@@ -18,15 +18,12 @@ import {
|
||||
DEPENDENCIES_FIELDS,
|
||||
Registries,
|
||||
} from '@pnpm/types'
|
||||
import rimraf = require('@zkochan/rimraf')
|
||||
import * as dp from 'dependency-path'
|
||||
import vacuumCB = require('fs-vacuum')
|
||||
import path = require('path')
|
||||
import R = require('ramda')
|
||||
import { promisify } from 'util'
|
||||
import removeDirectDependency from './removeDirectDependency'
|
||||
|
||||
const vacuum = promisify(vacuumCB)
|
||||
|
||||
export default async function prune (
|
||||
importers: Array<{
|
||||
binsDir: string,
|
||||
@@ -141,13 +138,10 @@ export default async function prune (
|
||||
}
|
||||
|
||||
await Promise.all(orphanDepPaths.map(async (orphanDepPath) => {
|
||||
const pathToRemove = path.join(opts.virtualStoreDir, pkgIdToFilename(orphanDepPath, opts.lockfileDir), 'node_modules')
|
||||
const pathToRemove = path.join(opts.virtualStoreDir, pkgIdToFilename(orphanDepPath, opts.lockfileDir))
|
||||
removalLogger.debug(pathToRemove)
|
||||
try {
|
||||
await vacuum(pathToRemove, {
|
||||
base: opts.virtualStoreDir,
|
||||
purge: true,
|
||||
})
|
||||
await rimraf(pathToRemove)
|
||||
} catch (err) {
|
||||
logger.warn({
|
||||
error: err,
|
||||
|
||||
14
pnpm-lock.yaml
generated
14
pnpm-lock.yaml
generated
@@ -998,7 +998,6 @@ importers:
|
||||
'@pnpm/types': 'link:../types'
|
||||
'@zkochan/rimraf': 1.0.0
|
||||
dependency-path: 'link:../dependency-path'
|
||||
fs-vacuum: 1.2.10
|
||||
is-windows: 1.0.2
|
||||
ramda: 0.27.0
|
||||
devDependencies:
|
||||
@@ -1023,7 +1022,6 @@ importers:
|
||||
'@types/ramda': ^0.27.4
|
||||
'@zkochan/rimraf': 1.0.0
|
||||
dependency-path: 'workspace:4.0.6'
|
||||
fs-vacuum: 1.2.10
|
||||
is-windows: 1.0.2
|
||||
ramda: 0.27.0
|
||||
packages/modules-yaml:
|
||||
@@ -6755,14 +6753,6 @@ packages:
|
||||
node: '>= 0.10'
|
||||
resolution:
|
||||
integrity: sha1-C3gV/DIBxqaeFNuYzgmMFpNSWes=
|
||||
/fs-vacuum/1.2.10:
|
||||
dependencies:
|
||||
graceful-fs: 4.2.4
|
||||
path-is-inside: 1.0.2
|
||||
rimraf: 2.7.1
|
||||
dev: false
|
||||
resolution:
|
||||
integrity: sha1-t2Kb7AekAxolSP35n17PHMizHjY=
|
||||
/fs.realpath/1.0.0:
|
||||
resolution:
|
||||
integrity: sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
|
||||
@@ -9805,10 +9795,6 @@ packages:
|
||||
node: '>=0.10.0'
|
||||
resolution:
|
||||
integrity: sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
|
||||
/path-is-inside/1.0.2:
|
||||
dev: false
|
||||
resolution:
|
||||
integrity: sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=
|
||||
/path-key/2.0.1:
|
||||
dev: true
|
||||
engines:
|
||||
|
||||
Reference in New Issue
Block a user