Skip to content

Commit 74ca0fd

Browse files
committed
fix: remove unused lib/npm relics
npm being an instance of EventEmitter and have a tmp public getter were both unused. Since we do not have a public API we can make these changes without it being a breaking change.
1 parent 173bc89 commit 74ca0fd

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

lib/npm.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const EventEmitter = require('events')
21
const { resolve, dirname, join } = require('path')
32
const Config = require('@npmcli/config')
43
const chalk = require('chalk')
@@ -20,7 +19,7 @@ const updateNotifier = require('./utils/update-notifier.js')
2019
const pkg = require('../package.json')
2120
const { commands, aliases } = require('./utils/cmd-list.js')
2221

23-
class Npm extends EventEmitter {
22+
class Npm {
2423
static get version () {
2524
return pkg.version
2625
}
@@ -32,7 +31,6 @@ class Npm extends EventEmitter {
3231
#command = null
3332
#runId = new Date().toISOString().replace(/[.:]/g, '_')
3433
#loadPromise = null
35-
#tmpFolder = null
3634
#title = 'npm'
3735
#argvClean = []
3836
#chalk = null
@@ -66,7 +64,6 @@ class Npm extends EventEmitter {
6664
// prefix to `npmRoot` since that is the first dir it would encounter when
6765
// doing implicit detection
6866
constructor ({ npmRoot = dirname(__dirname), argv = [], excludeNpmCwd = false } = {}) {
69-
super()
7067
this.#npmRoot = npmRoot
7168
this.config = new Config({
7269
npmPath: this.#npmRoot,
@@ -462,15 +459,6 @@ class Npm extends EventEmitter {
462459
return usage(this)
463460
}
464461

465-
// XXX add logging to see if we actually use this
466-
get tmp () {
467-
if (!this.#tmpFolder) {
468-
const rand = require('crypto').randomBytes(4).toString('hex')
469-
this.#tmpFolder = `npm-${process.pid}-${rand}`
470-
}
471-
return resolve(this.config.get('tmp'), this.#tmpFolder)
472-
}
473-
474462
// output to stdout in a progress bar compatible way
475463
output (...msg) {
476464
log.clearProgress()

0 commit comments

Comments
 (0)