Skip to content

Commit 878ddfb

Browse files
committed
deps: @npmcli/[email protected]
This also removes `readdir-scoped-modules` and `@npmcli/fs` since those are now a part of `@npmcli/fs`
1 parent 1bff064 commit 878ddfb

30 files changed

+168
-993
lines changed

DEPENDENCIES.md

+5-17
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ graph LR;
1212
cacache-->npmcli-move-file["@npmcli/move-file"];
1313
cacache-->ssri;
1414
cacache-->unique-filename;
15-
dezalgo-->wrappy;
1615
init-package-json-->npm-package-arg;
1716
init-package-json-->promzard;
1817
init-package-json-->read-package-json;
@@ -133,7 +132,6 @@ graph LR;
133132
npm-->read-package-json-fast;
134133
npm-->read-package-json;
135134
npm-->read;
136-
npm-->readdir-scoped-modules;
137135
npm-->semver;
138136
npm-->ssri;
139137
npm-->treeverse;
@@ -167,10 +165,10 @@ graph LR;
167165
npmcli-arborist-->npm-pick-manifest;
168166
npmcli-arborist-->npm-registry-fetch;
169167
npmcli-arborist-->npmcli-eslint-config["@npmcli/eslint-config"];
168+
npmcli-arborist-->npmcli-fs["@npmcli/fs"];
170169
npmcli-arborist-->npmcli-installed-package-contents["@npmcli/installed-package-contents"];
171170
npmcli-arborist-->npmcli-map-workspaces["@npmcli/map-workspaces"];
172171
npmcli-arborist-->npmcli-metavuln-calculator["@npmcli/metavuln-calculator"];
173-
npmcli-arborist-->npmcli-move-file["@npmcli/move-file"];
174172
npmcli-arborist-->npmcli-name-from-folder["@npmcli/name-from-folder"];
175173
npmcli-arborist-->npmcli-node-gyp["@npmcli/node-gyp"];
176174
npmcli-arborist-->npmcli-package-json["@npmcli/package-json"];
@@ -182,7 +180,6 @@ graph LR;
182180
npmcli-arborist-->parse-conflict-json;
183181
npmcli-arborist-->proc-log;
184182
npmcli-arborist-->read-package-json-fast;
185-
npmcli-arborist-->readdir-scoped-modules;
186183
npmcli-arborist-->semver;
187184
npmcli-arborist-->ssri;
188185
npmcli-arborist-->treeverse;
@@ -238,7 +235,6 @@ graph LR;
238235
read-package-json-->npm-normalize-package-bin;
239236
read-package-json-fast-->json-parse-even-better-errors;
240237
read-package-json-fast-->npm-normalize-package-bin;
241-
readdir-scoped-modules-->dezalgo;
242238
unique-filename-->unique-slug;
243239
```
244240

@@ -290,8 +286,6 @@ graph LR;
290286
columnify-->wcwidth;
291287
debug-->ms;
292288
defaults-->clone;
293-
dezalgo-->asap;
294-
dezalgo-->wrappy;
295289
encoding-->iconv-lite;
296290
fs-minipass-->minipass;
297291
gauge-->aproba;
@@ -535,7 +529,6 @@ graph LR;
535529
npm-->read-package-json-fast;
536530
npm-->read-package-json;
537531
npm-->read;
538-
npm-->readdir-scoped-modules;
539532
npm-->remark-gfm;
540533
npm-->remark-github;
541534
npm-->remark;
@@ -591,10 +584,10 @@ graph LR;
591584
npmcli-arborist-->npm-pick-manifest;
592585
npmcli-arborist-->npm-registry-fetch;
593586
npmcli-arborist-->npmcli-eslint-config["@npmcli/eslint-config"];
587+
npmcli-arborist-->npmcli-fs["@npmcli/fs"];
594588
npmcli-arborist-->npmcli-installed-package-contents["@npmcli/installed-package-contents"];
595589
npmcli-arborist-->npmcli-map-workspaces["@npmcli/map-workspaces"];
596590
npmcli-arborist-->npmcli-metavuln-calculator["@npmcli/metavuln-calculator"];
597-
npmcli-arborist-->npmcli-move-file["@npmcli/move-file"];
598591
npmcli-arborist-->npmcli-name-from-folder["@npmcli/name-from-folder"];
599592
npmcli-arborist-->npmcli-node-gyp["@npmcli/node-gyp"];
600593
npmcli-arborist-->npmcli-package-json["@npmcli/package-json"];
@@ -608,7 +601,6 @@ graph LR;
608601
npmcli-arborist-->promise-all-reject-late;
609602
npmcli-arborist-->promise-call-limit;
610603
npmcli-arborist-->read-package-json-fast;
611-
npmcli-arborist-->readdir-scoped-modules;
612604
npmcli-arborist-->semver;
613605
npmcli-arborist-->ssri;
614606
npmcli-arborist-->tap;
@@ -708,10 +700,6 @@ graph LR;
708700
readable-stream-->inherits;
709701
readable-stream-->string_decoder;
710702
readable-stream-->util-deprecate;
711-
readdir-scoped-modules-->debuglog;
712-
readdir-scoped-modules-->dezalgo;
713-
readdir-scoped-modules-->graceful-fs;
714-
readdir-scoped-modules-->once;
715703
rimraf-->glob;
716704
semver-->lru-cache;
717705
smoke-tests-->minify-registry-metadata;
@@ -769,6 +757,6 @@ packages higher up the chain.
769757
- pacote, libnpmaccess, libnpmhook, libnpmorg, libnpmsearch, libnpmteam, npm-profile
770758
- npm-registry-fetch, libnpmversion
771759
- @npmcli/git, make-fetch-happen, @npmcli/config, init-package-json
772-
- @npmcli/installed-package-contents, @npmcli/map-workspaces, cacache, npm-pick-manifest, @npmcli/run-script, read-package-json, readdir-scoped-modules, promzard
773-
- @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
774-
- @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
760+
- @npmcli/installed-package-contents, @npmcli/map-workspaces, cacache, npm-pick-manifest, @npmcli/run-script, read-package-json, promzard
761+
- @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
762+
- @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

lib/utils/completion/installed-shallow.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
const { promisify } = require('util')
2-
const readdir = promisify(require('readdir-scoped-modules'))
1+
const { readdirScoped } = require('@npmcli/fs')
32

43
const installedShallow = async (npm, opts) => {
5-
const names = global => readdir(global ? npm.globalDir : npm.localDir)
4+
const names = async global => {
5+
const paths = await readdirScoped(global ? npm.globalDir : npm.localDir)
6+
return paths.map(p => p.replace(/\\/g, '/'))
7+
}
68
const { conf: { argv: { remain } } } = opts
79
if (remain.length > 3) {
810
return null

node_modules/.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
/are-we-there-yet/node_modules/*
4848
!/are-we-there-yet/node_modules/buffer
4949
!/are-we-there-yet/node_modules/readable-stream
50-
!/asap
5150
!/balanced-match
5251
!/base64-js
5352
!/bin-links
@@ -75,11 +74,9 @@
7574
!/debug/node_modules/
7675
/debug/node_modules/*
7776
!/debug/node_modules/ms
78-
!/debuglog
7977
!/defaults
8078
!/delegates
8179
!/depd
82-
!/dezalgo
8380
!/diff
8481
!/emoji-regex
8582
!/encoding
@@ -209,7 +206,6 @@
209206
!/read-package-json
210207
!/read
211208
!/readable-stream
212-
!/readdir-scoped-modules
213209
!/retry
214210
!/rimraf
215211
!/rimraf/node_modules/

node_modules/@npmcli/fs/lib/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
const cp = require('./cp/index.js')
44
const withTempDir = require('./with-temp-dir.js')
5+
const readdirScoped = require('./readdir-scoped.js')
6+
const moveFile = require('./move-file.js')
57

68
module.exports = {
79
cp,
810
withTempDir,
11+
readdirScoped,
12+
moveFile,
913
}
+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
const { dirname, join, resolve, relative, isAbsolute } = require('path')
2+
const fs = require('fs/promises')
3+
4+
const pathExists = async path => {
5+
try {
6+
await fs.access(path)
7+
return true
8+
} catch (er) {
9+
return er.code !== 'ENOENT'
10+
}
11+
}
12+
13+
const moveFile = async (source, destination, options = {}, root = true, symlinks = []) => {
14+
if (!source || !destination) {
15+
throw new TypeError('`source` and `destination` file required')
16+
}
17+
18+
options = {
19+
overwrite: true,
20+
...options,
21+
}
22+
23+
if (!options.overwrite && await pathExists(destination)) {
24+
throw new Error(`The destination file exists: ${destination}`)
25+
}
26+
27+
await fs.mkdir(dirname(destination), { recursive: true })
28+
29+
try {
30+
await fs.rename(source, destination)
31+
} catch (error) {
32+
if (error.code === 'EXDEV' || error.code === 'EPERM') {
33+
const sourceStat = await fs.lstat(source)
34+
if (sourceStat.isDirectory()) {
35+
const files = await fs.readdir(source)
36+
await Promise.all(files.map((file) =>
37+
moveFile(join(source, file), join(destination, file), options, false, symlinks)
38+
))
39+
} else if (sourceStat.isSymbolicLink()) {
40+
symlinks.push({ source, destination })
41+
} else {
42+
await fs.copyFile(source, destination)
43+
}
44+
} else {
45+
throw error
46+
}
47+
}
48+
49+
if (root) {
50+
await Promise.all(symlinks.map(async ({ source: symSource, destination: symDestination }) => {
51+
let target = await fs.readlink(symSource)
52+
// junction symlinks in windows will be absolute paths, so we need to
53+
// make sure they point to the symlink destination
54+
if (isAbsolute(target)) {
55+
target = resolve(symDestination, relative(symSource, target))
56+
}
57+
// try to determine what the actual file is so we can create the correct
58+
// type of symlink in windows
59+
let targetStat = 'file'
60+
try {
61+
targetStat = await fs.stat(resolve(dirname(symSource), target))
62+
if (targetStat.isDirectory()) {
63+
targetStat = 'junction'
64+
}
65+
} catch {
66+
// targetStat remains 'file'
67+
}
68+
await fs.symlink(
69+
target,
70+
symDestination,
71+
targetStat
72+
)
73+
}))
74+
await fs.rm(source, { recursive: true, force: true })
75+
}
76+
}
77+
78+
module.exports = moveFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const { readdir } = require('fs/promises')
2+
const { join } = require('path')
3+
4+
const readdirScoped = async (dir) => {
5+
const results = []
6+
7+
for (const item of await readdir(dir)) {
8+
if (item.startsWith('@')) {
9+
for (const scopedItem of await readdir(join(dir, item))) {
10+
results.push(join(item, scopedItem))
11+
}
12+
} else {
13+
results.push(item)
14+
}
15+
}
16+
17+
return results
18+
}
19+
20+
module.exports = readdirScoped

node_modules/@npmcli/fs/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@npmcli/fs",
3-
"version": "3.0.0",
3+
"version": "3.1.0",
44
"description": "filesystem utilities for the npm cli",
55
"main": "lib/index.js",
66
"files": [
@@ -29,8 +29,8 @@
2929
"author": "GitHub Inc.",
3030
"license": "ISC",
3131
"devDependencies": {
32-
"@npmcli/eslint-config": "^3.0.1",
33-
"@npmcli/template-oss": "4.5.1",
32+
"@npmcli/eslint-config": "^4.0.0",
33+
"@npmcli/template-oss": "4.8.0",
3434
"tap": "^16.0.1"
3535
},
3636
"dependencies": {
@@ -41,7 +41,7 @@
4141
},
4242
"templateOSS": {
4343
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
44-
"version": "4.5.1"
44+
"version": "4.8.0"
4545
},
4646
"tap": {
4747
"nyc-arg": [

node_modules/asap/CHANGES.md

-70
This file was deleted.

node_modules/asap/LICENSE.md

-21
This file was deleted.

0 commit comments

Comments
 (0)