Skip to content

Commit b3462d1

Browse files
committed
fix: fix dependencies updater
1 parent 135f06b commit b3462d1

1 file changed

Lines changed: 4 additions & 21 deletions

File tree

lib/package.js

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -639,27 +639,11 @@ export default class Package {
639639
async getOutdatedDependencies ( { all } = {} ) {
640640
if ( !this.dependencies.hasDependencies ) return result( 200 );
641641

642-
return new Promise( resolve => {
643-
childProcess.exec(
644-
"npm outdated --json" + ( all
645-
? " --all"
646-
: "" ),
647-
{
648-
"cwd": this.root,
649-
"maxBuffer": Infinity,
650-
},
651-
( error, stdout ) => {
652-
try {
653-
const dependencies = JSON.parse( stdout );
642+
const args = [ "outdated" ];
654643

655-
resolve( result( 200, dependencies ) );
656-
}
657-
catch {
658-
resolve( result( 500 ) );
659-
}
660-
}
661-
);
662-
} );
644+
if ( all ) args.push( "--all" );
645+
646+
return this.npm.api.exec( args );
663647
}
664648

665649
async updateDependencies ( { all, outdated, linked, missing, install, reinstall, commit, quiet, confirmInstall, outdatedDependencies, cache = {} } = {} ) {
@@ -670,7 +654,6 @@ export default class Package {
670654
// get outdated dependencies
671655
if ( !outdatedDependencies ) {
672656
res = await this.getOutdatedDependencies( { all } );
673-
674657
if ( !res.ok ) return res;
675658

676659
outdatedDependencies = res.data;

0 commit comments

Comments
 (0)