@@ -424,15 +424,18 @@ const decodePnpmList = Schema.decodeUnknownOption(
424424// Unlike npm's latest tag, pnpm outdated respects minimumReleaseAge and its excludes.
425425const resolvePnpmGlobalLatestVersion = Effect . fn ( "resolvePnpmGlobalLatestVersion" ) ( function * (
426426 packageName : string ,
427+ env : NodeJS . ProcessEnv ,
427428) {
428- // Match the updater's pnpm and server environment, rather than the instance's.
429- const pnpmPath = yield * resolveCommandPath ( "pnpm" ) ;
429+ // Match the updater's pnpm and environment.
430+ const pnpmPath = yield * resolveCommandPath ( "pnpm" , {
431+ env : { ...( yield * HostProcess . Environment ) , ...env } ,
432+ } ) ;
430433 if ( ! pnpmPath ) return null ;
431434 // Silent reporting keeps project package-manager warnings out of the JSON.
432435 const outdated = yield * runProbe (
433436 pnpmPath ,
434437 [ "outdated" , "-g" , "--reporter=silent" , "--format" , "json" , packageName ] ,
435- { } ,
438+ env ,
436439 // pnpm outdated exits 1 when updates are available.
437440 [ 0 , 1 ] ,
438441 ) ;
@@ -446,7 +449,7 @@ const resolvePnpmGlobalLatestVersion = Effect.fn("resolvePnpmGlobalLatestVersion
446449 const listed = yield * runProbe (
447450 pnpmPath ,
448451 [ "ls" , "-g" , "--reporter=silent" , "--depth" , "0" , "--json" , packageName ] ,
449- { } ,
452+ env ,
450453 ) ;
451454 const listedEntries = listed ? Option . getOrUndefined ( decodePnpmList ( listed ) ) : undefined ;
452455 return nonEmptyString ( listedEntries ?. [ 0 ] ?. dependencies ?. [ packageName ] ?. version ) ;
@@ -544,6 +547,7 @@ export const resolvePackageManagedProviderMaintenance = Effect.fn(
544547 updateExecutable : "vp" ,
545548 updateArgs : [ "i" , "-g" , packageName ] ,
546549 updateLockKey : "vite-plus-global" ,
550+ env : context . env ,
547551 } ) ;
548552 }
549553 if ( commandPaths . some ( isBunGlobalCommandPath ) ) {
@@ -553,6 +557,7 @@ export const resolvePackageManagedProviderMaintenance = Effect.fn(
553557 updateExecutable : "bun" ,
554558 updateArgs : [ "i" , "-g" , `${ packageName } @latest` ] ,
555559 updateLockKey : "bun-global" ,
560+ env : context . env ,
556561 } ) ;
557562 }
558563 if ( commandPaths . some ( isPnpmGlobalCommandPath ) ) {
@@ -569,7 +574,8 @@ export const resolvePackageManagedProviderMaintenance = Effect.fn(
569574 updateExecutable : "pnpm" ,
570575 updateArgs : [ "add" , "-g" , ...allowBuild , `${ packageName } @latest` ] ,
571576 updateLockKey : "pnpm-global" ,
572- lookupLatestVersion : resolvePnpmGlobalLatestVersion ( packageName ) . pipe (
577+ env : context . env ,
578+ lookupLatestVersion : resolvePnpmGlobalLatestVersion ( packageName , context . env ) . pipe (
573579 Effect . provideContext ( services ) ,
574580 ) ,
575581 } ) ;
@@ -582,6 +588,7 @@ export const resolvePackageManagedProviderMaintenance = Effect.fn(
582588 updateExecutable : "yarn" ,
583589 updateArgs : [ "global" , "add" , `${ packageName } @latest` ] ,
584590 updateLockKey : "yarn-global" ,
591+ env : context . env ,
585592 } ) ;
586593 }
587594 if ( yield * isVoltaPackageInstall ( context , packageName ) ) {
@@ -591,6 +598,7 @@ export const resolvePackageManagedProviderMaintenance = Effect.fn(
591598 updateExecutable : "volta" ,
592599 updateArgs : [ "install" , `${ packageName } @latest` ] ,
593600 updateLockKey : "volta" ,
601+ env : context . env ,
594602 } ) ;
595603 }
596604
@@ -611,6 +619,7 @@ export const resolvePackageManagedProviderMaintenance = Effect.fn(
611619 `${ packageName } @latest` ,
612620 ] ,
613621 updateLockKey : `npm-global:${ normalizeCommandPath ( npmPrefix ) } ` ,
622+ env : context . env ,
614623 } ) ;
615624 }
616625
@@ -781,7 +790,8 @@ const withConfiguredNpmVersionLookup = Effect.fn("withConfiguredNpmVersionLookup
781790 if ( ! packageName || capabilities . latestVersion !== undefined ) {
782791 return capabilities ;
783792 }
784- const npmPath = yield * resolveCommandPath ( "npm" ) ;
793+ const env = { ...( yield * HostProcess . Environment ) , ...capabilities . update ?. env } ;
794+ const npmPath = yield * resolveCommandPath ( "npm" , { env } ) ;
785795 if ( ! npmPath ) return capabilities ;
786796 const services = yield * Effect . context < ProviderMaintenanceResolverServices > ( ) ;
787797 const update = capabilities . update ;
@@ -799,7 +809,7 @@ const withConfiguredNpmVersionLookup = Effect.fn("withConfiguredNpmVersionLookup
799809 `${ packageName } @latest` ,
800810 "version" ,
801811 ] ,
802- { } ,
812+ env ,
803813 ) . pipe (
804814 Effect . map ( ( stdout ) => {
805815 const value = stdout ? Option . getOrNull ( decodeNpmViewVersion ( stdout . trim ( ) ) ) : null ;
0 commit comments