From abcec7af254ee298d91a020ac7a6beceaa1fc4eb Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Fri, 4 Nov 2022 19:17:16 -0700 Subject: [PATCH] fixup! deps: @npmcli/fs@3.1.0 --- lib/utils/completion/installed-shallow.js | 2 ++ workspaces/arborist/lib/arborist/build-ideal-tree.js | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/utils/completion/installed-shallow.js b/lib/utils/completion/installed-shallow.js index cff12f1f30736..3e4342a4aaa8a 100644 --- a/lib/utils/completion/installed-shallow.js +++ b/lib/utils/completion/installed-shallow.js @@ -1,7 +1,9 @@ const { readdirScoped } = require('@npmcli/fs') +const { posix } = require('path') const installedShallow = async (npm, opts) => { const names = global => readdirScoped(global ? npm.globalDir : npm.localDir) + .then(list => list.map(i => posix.join(i))) const { conf: { argv: { remain } } } = opts if (remain.length > 3) { return null diff --git a/workspaces/arborist/lib/arborist/build-ideal-tree.js b/workspaces/arborist/lib/arborist/build-ideal-tree.js index 09d3a37d9c3f8..2408f3741f297 100644 --- a/workspaces/arborist/lib/arborist/build-ideal-tree.js +++ b/workspaces/arborist/lib/arborist/build-ideal-tree.js @@ -6,7 +6,7 @@ const pacote = require('pacote') const cacache = require('cacache') const promiseCallLimit = require('promise-call-limit') const realpath = require('../../lib/realpath.js') -const { resolve, dirname } = require('path') +const { resolve, dirname, posix } = require('path') const treeCheck = require('../tree-check.js') const { readdirScoped } = require('@npmcli/fs') const { lstat, readlink } = require('fs/promises') @@ -446,14 +446,15 @@ module.exports = cls => class IdealTreeBuilder extends cls { const globalExplicitUpdateNames = [] if (this[_global] && (this[_updateAll] || this[_updateNames].length)) { const nm = resolve(this.path, 'node_modules') - for (const name of await readdirScoped(nm).catch(() => [])) { + for (const namePath of await readdirScoped(nm).catch(() => [])) { + const name = posix.join(namePath) tree.package.dependencies = tree.package.dependencies || {} const updateName = this[_updateNames].includes(name) if (this[_updateAll] || updateName) { if (updateName) { globalExplicitUpdateNames.push(name) } - const dir = resolve(nm, name) + const dir = resolve(nm, namePath) const st = await lstat(dir) .catch(/* istanbul ignore next */ er => null) if (st && st.isSymbolicLink()) {