File tree Expand file tree Collapse file tree 21 files changed +44
-32
lines changed
Expand file tree Collapse file tree 21 files changed +44
-32
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class Bin extends BaseCommand {
1515 async exec ( args ) {
1616 const b = this . npm . bin
1717 this . npm . output ( b )
18- if ( this . npm . config . get ( ' global' ) && ! path . split ( delimiter ) . includes ( b ) ) {
18+ if ( this . npm . global && ! path . split ( delimiter ) . includes ( b ) ) {
1919 log . error ( 'bin' , '(not in PATH env variable)' )
2020 }
2121 }
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ class CI extends ArboristWorkspaceCmd {
2121 ]
2222
2323 async exec ( ) {
24- if ( this . npm . config . get ( ' global' ) ) {
24+ if ( this . npm . global ) {
2525 throw Object . assign ( new Error ( '`npm ci` does not work for global packages' ) , {
2626 code : 'ECIGLOBAL' ,
2727 } )
Original file line number Diff line number Diff line change @@ -276,7 +276,7 @@ ${defData}
276276 msg . push ( '' )
277277 }
278278
279- if ( ! this . npm . config . get ( ' global' ) ) {
279+ if ( ! this . npm . global ) {
280280 const pkgPath = resolve ( this . npm . prefix , 'package.json' )
281281 const pkg = await rpj ( pkgPath ) . catch ( ( ) => ( { } ) )
282282
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class Dedupe extends ArboristWorkspaceCmd {
2222 ]
2323
2424 async exec ( args ) {
25- if ( this . npm . config . get ( ' global' ) ) {
25+ if ( this . npm . global ) {
2626 const er = new Error ( '`npm dedupe` does not work in global mode.' )
2727 er . code = 'EDEDUPEGLOBAL'
2828 throw er
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ class Diff extends BaseCommand {
5050 // node_modules is sometimes under ./lib, and in global mode we're only ever
5151 // walking through node_modules (because we will have been given a package
5252 // name already)
53- if ( this . npm . config . get ( ' global' ) ) {
53+ if ( this . npm . global ) {
5454 this . top = resolve ( this . npm . globalDir , '..' )
5555 } else {
5656 this . top = this . prefix
Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ class DistTag extends BaseCommand {
148148
149149 async list ( spec , opts ) {
150150 if ( ! spec ) {
151- if ( this . npm . config . get ( ' global' ) ) {
151+ if ( this . npm . global ) {
152152 throw this . usageError ( )
153153 }
154154 const { name } = await readPackage ( path . resolve ( this . npm . prefix , 'package.json' ) )
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ class Fund extends ArboristWorkspaceCmd {
4545 throw err
4646 }
4747
48- if ( this . npm . config . get ( ' global' ) ) {
48+ if ( this . npm . global ) {
4949 const err = new Error ( '`npm fund` does not support global packages' )
5050 err . code = 'EFUNDGLOBAL'
5151 throw err
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ class Install extends ArboristWorkspaceCmd {
106106 // the /path/to/node_modules/..
107107 const globalTop = resolve ( this . npm . globalDir , '..' )
108108 const ignoreScripts = this . npm . config . get ( 'ignore-scripts' )
109- const isGlobalInstall = this . npm . config . get ( ' global' )
109+ const isGlobalInstall = this . npm . global
110110 const where = isGlobalInstall ? globalTop : this . npm . prefix
111111 const forced = this . npm . config . get ( 'force' )
112112 const scriptShell = this . npm . config . get ( 'script-shell' ) || undefined
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ class Link extends ArboristWorkspaceCmd {
4343 }
4444
4545 async exec ( args ) {
46- if ( this . npm . config . get ( ' global' ) ) {
46+ if ( this . npm . global ) {
4747 throw Object . assign (
4848 new Error (
4949 'link should never be --global.\n' +
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ class LS extends ArboristWorkspaceCmd {
5252 const all = this . npm . config . get ( 'all' )
5353 const color = this . npm . color
5454 const depth = this . npm . config . get ( 'depth' )
55- const global = this . npm . config . get ( ' global' )
55+ const global = this . npm . global
5656 const json = this . npm . config . get ( 'json' )
5757 const link = this . npm . config . get ( 'link' )
5858 const long = this . npm . config . get ( 'long' )
You can’t perform that action at this time.
0 commit comments