Skip to content

Commit

Permalink
fix: remove chownr and mkdirp-infer-owner
Browse files Browse the repository at this point in the history
closes npm/statusboard#540

BREAKING CHANGE: npm will no longer attempt to modify ownership of files it creates
  • Loading branch information
nlf authored and lukekarrys committed Oct 18, 2022
1 parent aa01072 commit 353b5bb
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 120 deletions.
5 changes: 0 additions & 5 deletions DEPENDENCIES.md
Expand Up @@ -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;
Expand All @@ -691,7 +688,6 @@ graph LR;
npm-->archy;
npm-->cacache;
npm-->chalk;
npm-->chownr;
npm-->cli-columns;
npm-->cli-table3;
npm-->columnify;
Expand Down Expand Up @@ -721,7 +717,6 @@ graph LR;
npm-->minimatch;
npm-->minipass-pipeline;
npm-->minipass;
npm-->mkdirp-infer-owner;
npm-->mkdirp;
npm-->ms;
npm-->nock;
Expand Down
8 changes: 2 additions & 6 deletions 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')
Expand Down Expand Up @@ -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+/)
Expand Down
6 changes: 3 additions & 3 deletions 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')
Expand Down Expand Up @@ -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 })
Expand All @@ -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 })
Expand Down
1 change: 0 additions & 1 deletion node_modules/.gitignore
Expand Up @@ -157,7 +157,6 @@
!/minipass-sized
!/minipass
!/minizlib
!/mkdirp-infer-owner
!/mkdirp
!/ms
!/mute-stream
Expand Down
15 changes: 0 additions & 15 deletions node_modules/mkdirp-infer-owner/LICENSE

This file was deleted.

26 changes: 0 additions & 26 deletions node_modules/mkdirp-infer-owner/index.js

This file was deleted.

36 changes: 0 additions & 36 deletions node_modules/mkdirp-infer-owner/package.json

This file was deleted.

17 changes: 0 additions & 17 deletions package-lock.json
Expand Up @@ -19,7 +19,6 @@
"archy",
"cacache",
"chalk",
"chownr",
"cli-columns",
"cli-table3",
"columnify",
Expand Down Expand Up @@ -48,7 +47,6 @@
"minipass",
"minipass-pipeline",
"mkdirp",
"mkdirp-infer-owner",
"ms",
"node-gyp",
"nopt",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 0 additions & 4 deletions package.json
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -140,7 +138,6 @@
"archy",
"cacache",
"chalk",
"chownr",
"cli-columns",
"cli-table3",
"columnify",
Expand Down Expand Up @@ -169,7 +166,6 @@
"minipass",
"minipass-pipeline",
"mkdirp",
"mkdirp-infer-owner",
"ms",
"node-gyp",
"nopt",
Expand Down
14 changes: 7 additions & 7 deletions test/fixtures/sandbox.js
Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 353b5bb

Please sign in to comment.