From aa010722996ef6de46e1bb937c6f8a94dc2844fa Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Mon, 17 Oct 2022 16:07:10 -0700 Subject: deps: update the following dependencies - @npmcli/config@6.0.1 - @npmcli/disparity-colors@3.0.0 - @npmcli/git@4.0.1 - @npmcli/installed-package-contents@2.0.0 - @npmcli/map-workspaces@3.0.0 - @npmcli/metavuln-calculator@5.0.0 - @npmcli/move-file@3.0.0 - @npmcli/node-gyp@3.0.0 - @npmcli/package-json@3.0.0 - @npmcli/promise-spawn@4.0.0 - @npmcli/query@3.0.0 - @npmcli/run-script@5.0.0 - bin-links@4.0.1 - cacache@17.0.1 - ignore-walk@6.0.0 - init-package-json@4.0.1 - json-parse-even-better-errors@3.0.0 - make-fetch-happen@11.0.1 - normalize-package-data@5.0.0 - npm-audit-report@4.0.0 - npm-install-checks@6.0.0 - npm-packlist@7.0.1 - npm-pick-manifest@8.0.1 - npm-profile@7.0.1 - npm-registry-fetch@14.0.2 - npmlog@7.0.0 - pacote@15.0.1 - parse-conflict-json@3.0.0 - proc-log@3.0.0 - read-package-json-fast@3.0.1 - read-package-json@6.0.0 - ssri@10.0.0 - treeverse@3.0.0 - validate-npm-package-name@5.0.0 - write-file-atomic@5.0.0 Removed dependencies: - `@npmcli/fs` --- lib/commands/completion.js | 2 +- lib/npm.js | 6 +++--- lib/utils/exit-handler.js | 8 ++------ lib/utils/log-file.js | 7 +------ lib/utils/timers.js | 8 ++------ 5 files changed, 9 insertions(+), 22 deletions(-) (limited to 'lib') diff --git a/lib/commands/completion.js b/lib/commands/completion.js index 7571a1442..3fc27c524 100644 --- a/lib/commands/completion.js +++ b/lib/commands/completion.js @@ -29,7 +29,7 @@ // as an array. // -const fs = require('@npmcli/fs') +const fs = require('fs/promises') const nopt = require('nopt') const { definitions, shorthands } = require('../utils/config/index.js') diff --git a/lib/npm.js b/lib/npm.js index a922aafaf..763c9b7a3 100644 --- a/lib/npm.js +++ b/lib/npm.js @@ -4,7 +4,7 @@ const { resolve, dirname, join } = require('path') const Config = require('@npmcli/config') const chalk = require('chalk') const which = require('which') -const fs = require('@npmcli/fs') +const fs = require('fs/promises') // Patch the global fs module here at the app level require('graceful-fs').gracefulify(require('fs')) @@ -246,13 +246,13 @@ class Npm extends EventEmitter { // a cache dir, but we don't want to fail immediately since // the command might not need a cache dir (like `npm --version`) await this.time('npm:load:mkdirpcache', () => - fs.mkdir(this.cache, { recursive: true, owner: 'inherit' }) + fs.mkdir(this.cache, { recursive: true }) .catch((e) => log.verbose('cache', `could not create cache: ${e}`))) // its ok if this fails. user might have specified an invalid dir // which we will tell them about at the end await this.time('npm:load:mkdirplogs', () => - fs.mkdir(this.logsDir, { recursive: true, owner: 'inherit' }) + fs.mkdir(this.logsDir, { recursive: true }) .catch((e) => log.verbose('logfile', `could not create logs-dir: ${e}`))) // note: this MUST be shorter than the actual argv length, because it diff --git a/lib/utils/exit-handler.js b/lib/utils/exit-handler.js index f1843347b..2574a83fc 100644 --- a/lib/utils/exit-handler.js +++ b/lib/utils/exit-handler.js @@ -1,5 +1,5 @@ const os = require('os') -const fs = require('@npmcli/fs') +const fs = require('fs') const log = require('./log-shim.js') const errorMessage = require('./error-message.js') @@ -186,11 +186,7 @@ const exitHandler = err => { file = `${npm.logPath}${file}` content = `'Log files:\n${npm.logFiles.join('\n')}\n\n${content.trim()}\n` try { - fs.withOwnerSync( - file, - () => fs.writeFileSync(file, content), - { owner: 'inherit' } - ) + fs.writeFileSync(file, content) detail.push(['', `\n\nFor a full report see:\n${file}`]) } catch (err) { log.warn('', `Could not write error message to ${file} due to ${err}`) diff --git a/lib/utils/log-file.js b/lib/utils/log-file.js index 3351ae6cd..2935697ac 100644 --- a/lib/utils/log-file.js +++ b/lib/utils/log-file.js @@ -5,7 +5,6 @@ const rimraf = promisify(require('rimraf')) const glob = promisify(require('glob')) const MiniPass = require('minipass') const fsMiniPass = require('fs-minipass') -const fs = require('@npmcli/fs') const log = require('./log-shim') const padZero = (n, length) => n.toString().padStart(length.toString().length, '0') @@ -174,11 +173,7 @@ class LogFiles { // during process.on('exit') which has to be synchronous. So in order // to never drop log messages, it is easiest to make it sync all the time // and this was measured to be about 1.5% slower for 40k lines of output - const logStream = fs.withOwnerSync( - f, - () => new fsMiniPass.WriteStreamSync(f, { flags: 'a' }), - { owner: 'inherit' } - ) + const logStream = new fsMiniPass.WriteStreamSync(f, { flags: 'a' }) if (count > 0) { // Reset file log count if we are opening // after our first file diff --git a/lib/utils/timers.js b/lib/utils/timers.js index c84bbba38..c215fe926 100644 --- a/lib/utils/timers.js +++ b/lib/utils/timers.js @@ -1,5 +1,5 @@ const EE = require('events') -const fs = require('@npmcli/fs') +const fs = require('fs') const log = require('./log-shim') // This is an event emiiter but on/off @@ -90,11 +90,7 @@ class Timers extends EE { return acc }, {}), } - fs.withOwnerSync( - this.file, - () => fs.writeFileSync(this.file, JSON.stringify(content) + '\n'), - { owner: 'inherit' } - ) + fs.writeFileSync(this.file, JSON.stringify(content) + '\n') } catch (e) { this.file = null log.warn('timing', `could not write timing file: ${e}`) -- cgit v1.2.3