@@ -5,6 +5,7 @@ const nopt = require('nopt')
55const mkdirp = require ( 'mkdirp-infer-owner' )
66const mapWorkspaces = require ( '@npmcli/map-workspaces' )
77const rpj = require ( 'read-package-json-fast' )
8+ const log = require ( 'proc-log' )
89
910/* istanbul ignore next */
1011const myUid = process . getuid && process . getuid ( )
@@ -88,7 +89,6 @@ class Config {
8889 // options just to override in tests, mostly
8990 env = process . env ,
9091 argv = process . argv ,
91- log = require ( './proc-log.js' ) ,
9292 platform = process . platform ,
9393 execPath = process . execPath ,
9494 cwd = process . cwd ( ) ,
@@ -114,7 +114,6 @@ class Config {
114114 this . defaults = defaults
115115
116116 this . npmPath = npmPath
117- this . log = log
118117 this . argv = argv
119118 this . env = env
120119 this . execPath = execPath
@@ -436,7 +435,7 @@ class Config {
436435 }
437436
438437 invalidHandler ( k , val , type , source , where ) {
439- this . log . warn (
438+ log . warn (
440439 'invalid config' ,
441440 k + '=' + JSON . stringify ( val ) ,
442441 `set in ${ source } `
@@ -469,7 +468,7 @@ class Config {
469468 : mustBe . filter ( m => m !== Array )
470469 . map ( n => typeof n === 'string' ? n : JSON . stringify ( n ) )
471470 . join ( ', ' )
472- this . log . warn ( 'invalid config' , msg , desc )
471+ log . warn ( 'invalid config' , msg , desc )
473472 }
474473
475474 [ _loadObject ] ( obj , where , source , er = null ) {
@@ -491,7 +490,7 @@ class Config {
491490 if ( er ) {
492491 conf . loadError = er
493492 if ( er . code !== 'ENOENT' ) {
494- this . log . verbose ( 'config' , `error loading ${ where } config` , er )
493+ log . verbose ( 'config' , `error loading ${ where } config` , er )
495494 }
496495 } else {
497496 conf . raw = obj
@@ -510,7 +509,7 @@ class Config {
510509 // XXX a future npm version will make this a warning.
511510 // An even more future npm version will make this an error.
512511 if ( this . deprecated [ key ] ) {
513- this . log . verbose ( 'config' , key , this . deprecated [ key ] )
512+ log . verbose ( 'config' , key , this . deprecated [ key ] )
514513 }
515514 }
516515
@@ -607,14 +606,14 @@ class Config {
607606 . catch ( ( ) => false )
608607
609608 if ( hasNpmrc ) {
610- this . log . warn ( `ignoring workspace config at ${ this . localPrefix } /.npmrc` )
609+ log . warn ( `ignoring workspace config at ${ this . localPrefix } /.npmrc` )
611610 }
612611
613612 // set the workspace in the default layer, which allows it to be overridden easily
614613 const { data } = this . data . get ( 'default' )
615614 data . workspace = [ this . localPrefix ]
616615 this . localPrefix = p
617- this . log . info ( `found workspace root at ${ this . localPrefix } ` )
616+ log . info ( `found workspace root at ${ this . localPrefix } ` )
618617 // we found a root, so we return now
619618 return
620619 }
0 commit comments