Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornlf <quitlahok@gmail.com>2022-10-18 23:38:46 +0300
committerLuke Karrys <luke@lukekarrys.com>2022-10-19 00:15:51 +0300
commit353b5bb92c3f7899526536b597252b44aa8a712d (patch)
tree4edd33360cbd301d887fce3016fbc5d8ce8aa6ad
parentaa010722996ef6de46e1bb937c6f8a94dc2844fa (diff)
fix: remove chownr and mkdirp-infer-owner
closes npm/statusboard#540 BREAKING CHANGE: npm will no longer attempt to modify ownership of files it creates
-rw-r--r--DEPENDENCIES.md5
-rw-r--r--lib/commands/config.js8
-rw-r--r--lib/commands/init.js6
-rw-r--r--node_modules/.gitignore1
-rw-r--r--node_modules/mkdirp-infer-owner/LICENSE15
-rw-r--r--node_modules/mkdirp-infer-owner/index.js26
-rw-r--r--node_modules/mkdirp-infer-owner/package.json36
-rw-r--r--package-lock.json17
-rw-r--r--package.json4
-rw-r--r--test/fixtures/sandbox.js14
10 files changed, 12 insertions, 120 deletions
diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md
index 9db2b6cf9..ce0a5d454 100644
--- a/DEPENDENCIES.md
+++ b/DEPENDENCIES.md
@@ -668,9 +668,6 @@ graph LR;
minipass-sized-->minipass;
minizlib-->minipass;
minizlib-->yallist;
- mkdirp-infer-owner-->chownr;
- mkdirp-infer-owner-->infer-owner;
- mkdirp-infer-owner-->mkdirp;
node-abi-->semver;
node-gyp-->env-paths;
node-gyp-->glob;
@@ -691,7 +688,6 @@ graph LR;
npm-->archy;
npm-->cacache;
npm-->chalk;
- npm-->chownr;
npm-->cli-columns;
npm-->cli-table3;
npm-->columnify;
@@ -721,7 +717,6 @@ graph LR;
npm-->minimatch;
npm-->minipass-pipeline;
npm-->minipass;
- npm-->mkdirp-infer-owner;
npm-->mkdirp;
npm-->ms;
npm-->nock;
diff --git a/lib/commands/config.js b/lib/commands/config.js
index e6c0ba79d..ed3946880 100644
--- a/lib/commands/config.js
+++ b/lib/commands/config.js
@@ -1,12 +1,8 @@
// don't expand so that we only assemble the set of defaults when needed
const configDefs = require('../utils/config/index.js')
-const mkdirp = require('mkdirp-infer-owner')
+const { mkdir, readFile, writeFile } = require('fs/promises')
const { dirname, resolve } = require('path')
-const { promisify } = require('util')
-const fs = require('fs')
-const readFile = promisify(fs.readFile)
-const writeFile = promisify(fs.writeFile)
const { spawn } = require('child_process')
const { EOL } = require('os')
const ini = require('ini')
@@ -231,7 +227,7 @@ ${data.split('\n').sort(localeCompare).join('\n').trim()}
${defData}
`.split('\n').join(EOL)
- await mkdirp(dirname(file))
+ await mkdir(dirname(file), { recursive: true })
await writeFile(file, tmpData, 'utf8')
await new Promise((resolve, reject) => {
const [bin, ...args] = e.split(/\s+/)
diff --git a/lib/commands/init.js b/lib/commands/init.js
index 039f08e06..3762a2c83 100644
--- a/lib/commands/init.js
+++ b/lib/commands/init.js
@@ -1,6 +1,6 @@
const fs = require('fs')
const { relative, resolve } = require('path')
-const mkdirp = require('mkdirp-infer-owner')
+const { mkdir } = require('fs/promises')
const initJson = require('init-package-json')
const npa = require('npm-package-arg')
const rpj = require('read-package-json-fast')
@@ -59,7 +59,7 @@ class Init extends BaseCommand {
if (args.length) {
for (const filterArg of filters) {
const path = wPath(filterArg)
- await mkdirp(path)
+ await mkdir(path, { recursive: true })
workspacesPaths.push(path)
await this.execCreate({ args, path })
await this.setWorkspace({ pkg, workspacePath: path })
@@ -70,7 +70,7 @@ class Init extends BaseCommand {
// no args, uses classic init-package-json boilerplate
for (const filterArg of filters) {
const path = wPath(filterArg)
- await mkdirp(path)
+ await mkdir(path, { recursive: true })
workspacesPaths.push(path)
await this.template(path)
await this.setWorkspace({ pkg, workspacePath: path })
diff --git a/node_modules/.gitignore b/node_modules/.gitignore
index d01bd4031..1b56990e5 100644
--- a/node_modules/.gitignore
+++ b/node_modules/.gitignore
@@ -157,7 +157,6 @@
!/minipass-sized
!/minipass
!/minizlib
-!/mkdirp-infer-owner
!/mkdirp
!/ms
!/mute-stream
diff --git a/node_modules/mkdirp-infer-owner/LICENSE b/node_modules/mkdirp-infer-owner/LICENSE
deleted file mode 100644
index 05eeeb88c..000000000
--- a/node_modules/mkdirp-infer-owner/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/mkdirp-infer-owner/index.js b/node_modules/mkdirp-infer-owner/index.js
deleted file mode 100644
index 750743f51..000000000
--- a/node_modules/mkdirp-infer-owner/index.js
+++ /dev/null
@@ -1,26 +0,0 @@
-const inferOwner = require('infer-owner')
-const mkdirp = require('mkdirp')
-const {promisify} = require('util')
-const chownr = promisify(require('chownr'))
-
-const platform = process.env.__TESTING_MKDIRP_INFER_OWNER_PLATFORM__
- || process.platform
-const isWindows = platform === 'win32'
-const isRoot = process.getuid && process.getuid() === 0
-const doChown = !isWindows && isRoot
-
-module.exports = !doChown ? (path, opts) => mkdirp(path, opts)
- : (path, opts) => inferOwner(path).then(({uid, gid}) =>
- mkdirp(path, opts).then(made =>
- uid !== 0 || gid !== process.getgid()
- ? chownr(made || path, uid, gid).then(() => made)
- : made))
-
-module.exports.sync = !doChown ? (path, opts) => mkdirp.sync(path, opts)
- : (path, opts) => {
- const {uid, gid} = inferOwner.sync(path)
- const made = mkdirp.sync(path)
- if (uid !== 0 || gid !== process.getgid())
- chownr.sync(made || path, uid, gid)
- return made
- }
diff --git a/node_modules/mkdirp-infer-owner/package.json b/node_modules/mkdirp-infer-owner/package.json
deleted file mode 100644
index 1f67ad0ed..000000000
--- a/node_modules/mkdirp-infer-owner/package.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "name": "mkdirp-infer-owner",
- "version": "2.0.0",
- "files": [
- "index.js"
- ],
- "description": "mkdirp, but chown to the owner of the containing folder if possible and necessary",
- "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)",
- "license": "ISC",
- "scripts": {
- "test": "tap",
- "preversion": "npm test",
- "postversion": "npm publish",
- "prepublishOnly": "git push origin --follow-tags",
- "snap": "tap"
- },
- "tap": {
- "check-coverage": true
- },
- "devDependencies": {
- "require-inject": "^1.4.4",
- "tap": "^14.10.6"
- },
- "dependencies": {
- "chownr": "^2.0.0",
- "infer-owner": "^1.0.4",
- "mkdirp": "^1.0.3"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/isaacs/mkdirp-infer-owner"
- },
- "engines": {
- "node": ">=10"
- }
-}
diff --git a/package-lock.json b/package-lock.json
index 61f88a593..6bfbc6c93 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -19,7 +19,6 @@
"archy",
"cacache",
"chalk",
- "chownr",
"cli-columns",
"cli-table3",
"columnify",
@@ -48,7 +47,6 @@
"minipass",
"minipass-pipeline",
"mkdirp",
- "mkdirp-infer-owner",
"ms",
"node-gyp",
"nopt",
@@ -99,7 +97,6 @@
"archy": "~1.0.0",
"cacache": "^17.0.1",
"chalk": "^4.1.2",
- "chownr": "^2.0.0",
"cli-columns": "^4.0.0",
"cli-table3": "^0.6.2",
"columnify": "^1.6.0",
@@ -128,7 +125,6 @@
"minipass": "^3.1.6",
"minipass-pipeline": "^1.2.4",
"mkdirp": "^1.0.4",
- "mkdirp-infer-owner": "^2.0.0",
"ms": "^2.1.2",
"node-gyp": "^9.1.0",
"nopt": "^6.0.0",
@@ -7849,19 +7845,6 @@
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
},
- "node_modules/mkdirp-infer-owner": {
- "version": "2.0.0",
- "inBundle": true,
- "license": "ISC",
- "dependencies": {
- "chownr": "^2.0.0",
- "infer-owner": "^1.0.4",
- "mkdirp": "^1.0.3"
- },
- "engines": {
- "node": ">=10"
- }
- },
"node_modules/modify-values": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz",
diff --git a/package.json b/package.json
index 5ff600765..ae877de76 100644
--- a/package.json
+++ b/package.json
@@ -66,7 +66,6 @@
"archy": "~1.0.0",
"cacache": "^17.0.1",
"chalk": "^4.1.2",
- "chownr": "^2.0.0",
"cli-columns": "^4.0.0",
"cli-table3": "^0.6.2",
"columnify": "^1.6.0",
@@ -95,7 +94,6 @@
"minipass": "^3.1.6",
"minipass-pipeline": "^1.2.4",
"mkdirp": "^1.0.4",
- "mkdirp-infer-owner": "^2.0.0",
"ms": "^2.1.2",
"node-gyp": "^9.1.0",
"nopt": "^6.0.0",
@@ -140,7 +138,6 @@
"archy",
"cacache",
"chalk",
- "chownr",
"cli-columns",
"cli-table3",
"columnify",
@@ -169,7 +166,6 @@
"minipass",
"minipass-pipeline",
"mkdirp",
- "mkdirp-infer-owner",
"ms",
"node-gyp",
"nopt",
diff --git a/test/fixtures/sandbox.js b/test/fixtures/sandbox.js
index 1119a7d5f..b53c8f173 100644
--- a/test/fixtures/sandbox.js
+++ b/test/fixtures/sandbox.js
@@ -3,7 +3,7 @@ const { EventEmitter } = require('events')
const { homedir, tmpdir } = require('os')
const { dirname, join } = require('path')
const { promisify } = require('util')
-const mkdirp = require('mkdirp-infer-owner')
+const { mkdir } = require('fs/promises')
const rimraf = promisify(require('rimraf'))
const mockLogs = require('./mock-logs')
const pkg = require('../../package.json')
@@ -239,9 +239,9 @@ class Sandbox extends EventEmitter {
async run (command, argv = []) {
await Promise.all([
- mkdirp(this.project),
- mkdirp(this.home),
- mkdirp(this.global),
+ mkdir(this.project, { recursive: true }),
+ mkdir(this.home, { recursive: true }),
+ mkdir(this.global, { recursive: true }),
])
// attach the sandbox process now, doing it after the promise above is
@@ -290,9 +290,9 @@ class Sandbox extends EventEmitter {
}
await Promise.all([
- mkdirp(this.project),
- mkdirp(this.home),
- mkdirp(this.global),
+ mkdir(this.project, { recursive: true }),
+ mkdir(this.home, { recursive: true }),
+ mkdir(this.global, { recursive: true }),
])
// attach the sandbox process now, doing it after the promise above is