Skip to content

Commit

Permalink
global: Program error on getInstalledPackages error.
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed Jan 26, 2024
1 parent 7c88f2d commit a86905b
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions src/lib/runGlobal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Options } from '../types/Options'
import chalk from './chalk'
import getInstalledPackages from './getInstalledPackages'
import { keyValueBy } from './keyValueBy'
import programError from './programError'
import upgradePackageDefinitions from './upgradePackageDefinitions'

/** Checks global dependencies for upgrades. */
Expand All @@ -13,19 +14,24 @@ async function runGlobal(options: Options): Promise<Index<string> | void> {
printSorted(options, options, 'verbose')

print(options, '\nGetting installed packages', 'verbose')
const globalPackages = await getInstalledPackages(
pick(options, [
'cli',
'cwd',
'filter',
'filterVersion',
'global',
'packageManager',
'prefix',
'reject',
'rejectVersion',
]),
)
let globalPackages: Index<string> = {}
try {
globalPackages = await getInstalledPackages(
pick(options, [
'cli',
'cwd',
'filter',
'filterVersion',
'global',
'packageManager',
'prefix',
'reject',
'rejectVersion',
]),
)
} catch (e: any) {
programError(options, e.message)
}

print(options, 'globalPackages:', 'verbose')
print(options, globalPackages, 'verbose')
Expand Down

0 comments on commit a86905b

Please sign in to comment.