Skip to content

Commit

Permalink
fixup! deps: @npmcli/fs@3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Nov 7, 2022
1 parent 6cf597a commit 6946b52
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions lib/utils/completion/installed-shallow.js
@@ -1,9 +1,10 @@
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 names = async global => {
const paths = await readdirScoped(global ? npm.globalDir : npm.localDir)
return paths.map(p => p.replace(/\\/g, '/'))
}
const { conf: { argv: { remain } } } = opts
if (remain.length > 3) {
return null
Expand Down
6 changes: 3 additions & 3 deletions workspaces/arborist/lib/arborist/build-ideal-tree.js
Expand Up @@ -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, posix } = require('path')
const { resolve, dirname } = require('path')
const treeCheck = require('../tree-check.js')
const { readdirScoped } = require('@npmcli/fs')
const { lstat, readlink } = require('fs/promises')
Expand Down Expand Up @@ -446,8 +446,8 @@ 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 namePath of await readdirScoped(nm).catch(() => [])) {
const name = posix.join(namePath)
const paths = await readdirScoped(nm).catch(() => [])
for (const name of paths.map((p) => p.replace(/\\/g, '/'))) {
tree.package.dependencies = tree.package.dependencies || {}
const updateName = this[_updateNames].includes(name)
if (this[_updateAll] || updateName) {
Expand Down
6 changes: 3 additions & 3 deletions workspaces/arborist/lib/arborist/load-actual.js
@@ -1,6 +1,6 @@
// mix-in implementing the loadActual method

const { relative, dirname, resolve, join, normalize, posix } = require('path')
const { relative, dirname, resolve, join, normalize } = require('path')

const rpj = require('read-package-json-fast')
const { readdirScoped } = require('@npmcli/fs')
Expand Down Expand Up @@ -361,7 +361,7 @@ module.exports = cls => class ActualLoader extends cls {
async [_loadFSChildren] (node) {
const nm = resolve(node.realpath, 'node_modules')
try {
const kids = await readdirScoped(nm).then(list => list.map(i => posix.join(i)))
const kids = await readdirScoped(nm).then(paths => paths.map(p => p.replace(/\\/g, '/')))
return Promise.all(
// ignore . dirs and retired scoped package folders
kids.filter(kid => !/^(@[^/]+\/)?\./.test(kid))
Expand Down Expand Up @@ -411,7 +411,7 @@ module.exports = cls => class ActualLoader extends cls {
}

const entries = nmContents.get(p) || await readdirScoped(p + '/node_modules')
.catch(() => []).then(list => list.map(i => posix.join(i)))
.catch(() => []).then(paths => paths.map(p => p.replace(/\\/g, '/')))
nmContents.set(p, entries)
if (!entries.includes(name)) {
continue
Expand Down

0 comments on commit 6946b52

Please sign in to comment.