Skip to content

Commit a8cb081

Browse files
committed
fix(plugin-js-packages): handle empty output from yarn outdated
1 parent bf33ffa commit a8cb081

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/plugin-js-packages/src/lib/package-managers/yarn-classic/outdated-result.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import {
2020

2121
export function yarnv1ToOutdatedResult(output: string): OutdatedResult {
2222
const yarnv1Outdated = fromJsonLines<Yarnv1OutdatedResultJson>(output);
23-
const fields = yarnv1Outdated[1].data.head;
24-
const dependencies = yarnv1Outdated[1].data.body;
23+
const fields = yarnv1Outdated[1]?.data.head ?? [];
24+
const dependencies = yarnv1Outdated[1]?.data.body ?? [];
2525

2626
// no outdated dependencies
2727
if (dependencies.length === 0) {

packages/plugin-js-packages/src/lib/package-managers/yarn-classic/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ type Yarnv1Table = {
5151
};
5252
};
5353

54-
export type Yarnv1OutdatedResultJson = [Yarnv1Info, Yarnv1Table];
54+
export type Yarnv1OutdatedResultJson = [Yarnv1Info, Yarnv1Table] | [];

0 commit comments

Comments
 (0)