Skip to content

Commit

Permalink
deps: @npmcli/fs@3.1.0
Browse files Browse the repository at this point in the history
This also removes `readdir-scoped-modules` and `@npmcli/fs` since those
are now a part of `@npmcli/fs`
  • Loading branch information
lukekarrys committed Nov 7, 2022
1 parent 50d2ec2 commit b58d396
Show file tree
Hide file tree
Showing 30 changed files with 169 additions and 995 deletions.
22 changes: 5 additions & 17 deletions DEPENDENCIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ graph LR;
cacache-->npmcli-move-file["@npmcli/move-file"];
cacache-->ssri;
cacache-->unique-filename;
dezalgo-->wrappy;
init-package-json-->npm-package-arg;
init-package-json-->promzard;
init-package-json-->read-package-json;
Expand Down Expand Up @@ -133,7 +132,6 @@ graph LR;
npm-->read-package-json-fast;
npm-->read-package-json;
npm-->read;
npm-->readdir-scoped-modules;
npm-->semver;
npm-->ssri;
npm-->treeverse;
Expand Down Expand Up @@ -167,10 +165,10 @@ graph LR;
npmcli-arborist-->npm-pick-manifest;
npmcli-arborist-->npm-registry-fetch;
npmcli-arborist-->npmcli-eslint-config["@npmcli/eslint-config"];
npmcli-arborist-->npmcli-fs["@npmcli/fs"];
npmcli-arborist-->npmcli-installed-package-contents["@npmcli/installed-package-contents"];
npmcli-arborist-->npmcli-map-workspaces["@npmcli/map-workspaces"];
npmcli-arborist-->npmcli-metavuln-calculator["@npmcli/metavuln-calculator"];
npmcli-arborist-->npmcli-move-file["@npmcli/move-file"];
npmcli-arborist-->npmcli-name-from-folder["@npmcli/name-from-folder"];
npmcli-arborist-->npmcli-node-gyp["@npmcli/node-gyp"];
npmcli-arborist-->npmcli-package-json["@npmcli/package-json"];
Expand All @@ -182,7 +180,6 @@ graph LR;
npmcli-arborist-->parse-conflict-json;
npmcli-arborist-->proc-log;
npmcli-arborist-->read-package-json-fast;
npmcli-arborist-->readdir-scoped-modules;
npmcli-arborist-->semver;
npmcli-arborist-->ssri;
npmcli-arborist-->treeverse;
Expand Down Expand Up @@ -238,7 +235,6 @@ graph LR;
read-package-json-->npm-normalize-package-bin;
read-package-json-fast-->json-parse-even-better-errors;
read-package-json-fast-->npm-normalize-package-bin;
readdir-scoped-modules-->dezalgo;
unique-filename-->unique-slug;
```

Expand Down Expand Up @@ -290,8 +286,6 @@ graph LR;
columnify-->wcwidth;
debug-->ms;
defaults-->clone;
dezalgo-->asap;
dezalgo-->wrappy;
encoding-->iconv-lite;
fs-minipass-->minipass;
gauge-->aproba;
Expand Down Expand Up @@ -535,7 +529,6 @@ graph LR;
npm-->read-package-json-fast;
npm-->read-package-json;
npm-->read;
npm-->readdir-scoped-modules;
npm-->remark-gfm;
npm-->remark-github;
npm-->remark;
Expand Down Expand Up @@ -591,10 +584,10 @@ graph LR;
npmcli-arborist-->npm-pick-manifest;
npmcli-arborist-->npm-registry-fetch;
npmcli-arborist-->npmcli-eslint-config["@npmcli/eslint-config"];
npmcli-arborist-->npmcli-fs["@npmcli/fs"];
npmcli-arborist-->npmcli-installed-package-contents["@npmcli/installed-package-contents"];
npmcli-arborist-->npmcli-map-workspaces["@npmcli/map-workspaces"];
npmcli-arborist-->npmcli-metavuln-calculator["@npmcli/metavuln-calculator"];
npmcli-arborist-->npmcli-move-file["@npmcli/move-file"];
npmcli-arborist-->npmcli-name-from-folder["@npmcli/name-from-folder"];
npmcli-arborist-->npmcli-node-gyp["@npmcli/node-gyp"];
npmcli-arborist-->npmcli-package-json["@npmcli/package-json"];
Expand All @@ -608,7 +601,6 @@ graph LR;
npmcli-arborist-->promise-all-reject-late;
npmcli-arborist-->promise-call-limit;
npmcli-arborist-->read-package-json-fast;
npmcli-arborist-->readdir-scoped-modules;
npmcli-arborist-->semver;
npmcli-arborist-->ssri;
npmcli-arborist-->tap;
Expand Down Expand Up @@ -708,10 +700,6 @@ graph LR;
readable-stream-->inherits;
readable-stream-->string_decoder;
readable-stream-->util-deprecate;
readdir-scoped-modules-->debuglog;
readdir-scoped-modules-->dezalgo;
readdir-scoped-modules-->graceful-fs;
readdir-scoped-modules-->once;
rimraf-->glob;
semver-->lru-cache;
smoke-tests-->minify-registry-metadata;
Expand Down Expand Up @@ -769,6 +757,6 @@ packages higher up the chain.
- pacote, libnpmaccess, libnpmhook, libnpmorg, libnpmsearch, libnpmteam, npm-profile
- npm-registry-fetch, libnpmversion
- @npmcli/git, make-fetch-happen, @npmcli/config, init-package-json
- @npmcli/installed-package-contents, @npmcli/map-workspaces, cacache, npm-pick-manifest, @npmcli/run-script, read-package-json, readdir-scoped-modules, promzard
- @npmcli/docs, npm-bundled, read-package-json-fast, @npmcli/fs, unique-filename, npm-install-checks, npm-package-arg, npm-packlist, normalize-package-data, @npmcli/package-json, bin-links, nopt, npmlog, parse-conflict-json, dezalgo, read
- @npmcli/eslint-config, @npmcli/template-oss, ignore-walk, npm-normalize-package-bin, @npmcli/name-from-folder, json-parse-even-better-errors, semver, @npmcli/move-file, fs-minipass, ssri, unique-slug, @npmcli/promise-spawn, hosted-git-info, proc-log, validate-npm-package-name, @npmcli/node-gyp, minipass-fetch, @npmcli/query, cmd-shim, read-cmd-shim, write-file-atomic, abbrev, are-we-there-yet, gauge, wrappy, treeverse, minify-registry-metadata, ini, @npmcli/disparity-colors, @npmcli/ci-detect, mute-stream, npm-audit-report, npm-user-validate
- @npmcli/installed-package-contents, @npmcli/map-workspaces, cacache, npm-pick-manifest, @npmcli/run-script, read-package-json, promzard
- @npmcli/docs, @npmcli/fs, npm-bundled, read-package-json-fast, unique-filename, npm-install-checks, npm-package-arg, npm-packlist, normalize-package-data, @npmcli/package-json, bin-links, nopt, npmlog, parse-conflict-json, read
- @npmcli/eslint-config, @npmcli/template-oss, ignore-walk, semver, npm-normalize-package-bin, @npmcli/name-from-folder, json-parse-even-better-errors, @npmcli/move-file, fs-minipass, ssri, unique-slug, @npmcli/promise-spawn, hosted-git-info, proc-log, validate-npm-package-name, @npmcli/node-gyp, minipass-fetch, @npmcli/query, cmd-shim, read-cmd-shim, write-file-atomic, abbrev, are-we-there-yet, gauge, treeverse, minify-registry-metadata, ini, @npmcli/disparity-colors, @npmcli/ci-detect, mute-stream, npm-audit-report, npm-user-validate
7 changes: 4 additions & 3 deletions lib/utils/completion/installed-shallow.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const { promisify } = require('util')
const readdir = promisify(require('readdir-scoped-modules'))
const { readdirScoped } = require('@npmcli/fs')
const { posix } = require('path')

const installedShallow = async (npm, opts) => {
const names = global => readdir(global ? npm.globalDir : npm.localDir)
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
Expand Down
4 changes: 0 additions & 4 deletions node_modules/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
/are-we-there-yet/node_modules/*
!/are-we-there-yet/node_modules/buffer
!/are-we-there-yet/node_modules/readable-stream
!/asap
!/balanced-match
!/base64-js
!/bin-links
Expand Down Expand Up @@ -75,11 +74,9 @@
!/debug/node_modules/
/debug/node_modules/*
!/debug/node_modules/ms
!/debuglog
!/defaults
!/delegates
!/depd
!/dezalgo
!/diff
!/emoji-regex
!/encoding
Expand Down Expand Up @@ -209,7 +206,6 @@
!/read-package-json
!/read
!/readable-stream
!/readdir-scoped-modules
!/retry
!/rimraf
!/rimraf/node_modules/
Expand Down
4 changes: 4 additions & 0 deletions node_modules/@npmcli/fs/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

const cp = require('./cp/index.js')
const withTempDir = require('./with-temp-dir.js')
const readdirScoped = require('./readdir-scoped.js')
const moveFile = require('./move-file.js')

module.exports = {
cp,
withTempDir,
readdirScoped,
moveFile,
}
78 changes: 78 additions & 0 deletions node_modules/@npmcli/fs/lib/move-file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
const { dirname, join, resolve, relative, isAbsolute } = require('path')
const fs = require('fs/promises')

const pathExists = async path => {
try {
await fs.access(path)
return true
} catch (er) {
return er.code !== 'ENOENT'
}
}

const moveFile = async (source, destination, options = {}, root = true, symlinks = []) => {
if (!source || !destination) {
throw new TypeError('`source` and `destination` file required')
}

options = {
overwrite: true,
...options,
}

if (!options.overwrite && await pathExists(destination)) {
throw new Error(`The destination file exists: ${destination}`)
}

await fs.mkdir(dirname(destination), { recursive: true })

try {
await fs.rename(source, destination)
} catch (error) {
if (error.code === 'EXDEV' || error.code === 'EPERM') {
const sourceStat = await fs.lstat(source)
if (sourceStat.isDirectory()) {
const files = await fs.readdir(source)
await Promise.all(files.map((file) =>
moveFile(join(source, file), join(destination, file), options, false, symlinks)
))
} else if (sourceStat.isSymbolicLink()) {
symlinks.push({ source, destination })
} else {
await fs.copyFile(source, destination)
}
} else {
throw error
}
}

if (root) {
await Promise.all(symlinks.map(async ({ source: symSource, destination: symDestination }) => {
let target = await fs.readlink(symSource)
// junction symlinks in windows will be absolute paths, so we need to
// make sure they point to the symlink destination
if (isAbsolute(target)) {
target = resolve(symDestination, relative(symSource, target))
}
// try to determine what the actual file is so we can create the correct
// type of symlink in windows
let targetStat = 'file'
try {
targetStat = await fs.stat(resolve(dirname(symSource), target))
if (targetStat.isDirectory()) {
targetStat = 'junction'
}
} catch {
// targetStat remains 'file'
}
await fs.symlink(
target,
symDestination,
targetStat
)
}))
await fs.rm(source, { recursive: true, force: true })
}
}

module.exports = moveFile
20 changes: 20 additions & 0 deletions node_modules/@npmcli/fs/lib/readdir-scoped.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { readdir } = require('fs/promises')
const { join } = require('path')

const readdirScoped = async (dir) => {
const results = []

for (const item of await readdir(dir)) {
if (item.startsWith('@')) {
for (const scopedItem of await readdir(join(dir, item))) {
results.push(join(item, scopedItem))
}
} else {
results.push(item)
}
}

return results
}

module.exports = readdirScoped
8 changes: 4 additions & 4 deletions node_modules/@npmcli/fs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@npmcli/fs",
"version": "3.0.0",
"version": "3.1.0",
"description": "filesystem utilities for the npm cli",
"main": "lib/index.js",
"files": [
Expand Down Expand Up @@ -29,8 +29,8 @@
"author": "GitHub Inc.",
"license": "ISC",
"devDependencies": {
"@npmcli/eslint-config": "^3.0.1",
"@npmcli/template-oss": "4.5.1",
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.8.0",
"tap": "^16.0.1"
},
"dependencies": {
Expand All @@ -41,7 +41,7 @@
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.5.1"
"version": "4.8.0"
},
"tap": {
"nyc-arg": [
Expand Down
70 changes: 0 additions & 70 deletions node_modules/asap/CHANGES.md

This file was deleted.

21 changes: 0 additions & 21 deletions node_modules/asap/LICENSE.md

This file was deleted.

Loading

0 comments on commit b58d396

Please sign in to comment.