@@ -111,7 +111,7 @@ function lifecycle (pkg, stage, wd, opts) {
111
111
function lifecycle_ ( pkg , stage , wd , opts , env , cb ) {
112
112
env [ PATH ] = extendPath ( wd , env [ PATH ] , path . join ( __dirname , 'node-gyp-bin' ) , opts )
113
113
114
- let packageLifecycle = pkg . scripts && pkg . scripts . hasOwnProperty ( stage )
114
+ let packageLifecycle = pkg . scripts && Object . prototype . hasOwnProperty . call ( pkg . scripts , stage )
115
115
116
116
if ( opts . ignoreScripts ) {
117
117
opts . log . info ( 'lifecycle' , logid ( pkg , stage ) , 'ignored because ignore-scripts is set to true' , pkg . _id )
@@ -219,8 +219,8 @@ function runCmd_ (cmd, pkg, env, wd, opts, stage, unsafe, uid, gid, cb_) {
219
219
220
220
const conf = {
221
221
cwd : wd ,
222
- env : env ,
223
- stdio : opts . stdio || [ 0 , 1 , 2 ]
222
+ env,
223
+ stdio : opts . stdio || [ 0 , 1 , 2 ]
224
224
}
225
225
226
226
if ( ! unsafe ) {
@@ -262,8 +262,9 @@ function runCmd_ (cmd, pkg, env, wd, opts, stage, unsafe, uid, gid, cb_) {
262
262
execute ( cmd , [ ] , execOpts )
263
263
. then ( ( code ) => {
264
264
opts . log . silly ( 'lifecycle' , logid ( pkg , stage ) , 'Returned: code:' , code )
265
+ let er
265
266
if ( code ) {
266
- var er = new Error ( `Exit status ${ code } ` )
267
+ er = new Error ( `Exit status ${ code } ` )
267
268
er . errno = code
268
269
}
269
270
procError ( er )
@@ -278,12 +279,12 @@ function runCmd_ (cmd, pkg, env, wd, opts, stage, unsafe, uid, gid, cb_) {
278
279
proc . on ( 'close' , ( code , signal ) => {
279
280
opts . log . silly ( 'lifecycle' , logid ( pkg , stage ) , 'Returned: code:' , code , ' signal:' , signal )
280
281
let err
281
- if ( signal && signal !== " SIGINT" ) {
282
+ if ( signal && signal !== ' SIGINT' ) {
282
283
err = new PnpmError ( 'CHILD_PROCESS_FAILED' , `Command failed with signal "${ signal } "` )
283
284
process . kill ( process . pid , signal )
284
285
} else if ( code ) {
285
- err = new PnpmError ( 'CHILD_PROCESS_FAILED' , `Exit status ${ code } ` )
286
- err . errno = code
286
+ err = new PnpmError ( 'CHILD_PROCESS_FAILED' , `Exit status ${ code } ` )
287
+ err . errno = code
287
288
}
288
289
procError ( err )
289
290
} )
@@ -347,15 +348,15 @@ function makeEnv (data, opts, prefix, env) {
347
348
prefix = prefix || 'npm_package_'
348
349
if ( ! env ) {
349
350
env = { }
350
- for ( var i in process . env ) {
351
+ for ( const i in process . env ) {
351
352
if ( ! i . match ( / ^ n p m _ / ) && ( ! i . match ( / ^ P A T H $ / i) || i === PATH ) ) {
352
353
env [ i ] = process . env [ i ]
353
354
}
354
355
}
355
356
356
357
// express and others respect the NODE_ENV value.
357
358
if ( opts . production ) env . NODE_ENV = 'production'
358
- } else if ( ! data . hasOwnProperty ( '_lifecycleEnv' ) ) {
359
+ } else if ( ! Object . prototype . hasOwnProperty . call ( data , '_lifecycleEnv' ) ) {
359
360
Object . defineProperty ( data , '_lifecycleEnv' ,
360
361
{
361
362
value : env ,
@@ -366,7 +367,7 @@ function makeEnv (data, opts, prefix, env) {
366
367
367
368
if ( opts . nodeOptions ) env . NODE_OPTIONS = opts . nodeOptions
368
369
369
- for ( i in data ) {
370
+ for ( const i in data ) {
370
371
if ( i . charAt ( 0 ) !== '_' ) {
371
372
const envKey = ( prefix + i ) . replace ( / [ ^ a - z A - Z 0 - 9 _ ] / g, '_' )
372
373
if ( i === 'readme' ) {
0 commit comments