Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/commands/outdated.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class Outdated extends ArboristWorkspaceCmd {
const long = this.npm.config.get('long')
const { bold, yellow, red, cyan, blue } = this.npm.chalk

return table([
const tableOutput = table([
[
'Package',
'Current',
Expand All @@ -245,6 +245,13 @@ class Outdated extends ArboristWorkspaceCmd {
align: ['l', 'r', 'r', 'r', 'l'],
stringLength: s => stripVTControlCharacters(s).length,
})

if (this.npm.chalk.level !== 0) {
const legend = `\n${red('Red')} = Updateable within your version range\n${yellow('Yellow')} = Update available but requires semver-major bump`
return tableOutput + legend
}

return tableOutput
}

// --parseable creates output like this:
Expand Down
10 changes: 10 additions & 0 deletions tap-snapshots/test/lib/commands/outdated.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated
cat 1.0.0 1.0.1 1.0.1 node_modules/cat prefix
dog 1.0.1 1.0.1 2.0.0 node_modules/dog prefix
theta MISSING 1.0.1 1.0.1 - prefix
Red = Updateable within your version range
Yellow = Update available but requires semver-major bump
`

exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated --omit=dev > must match snapshot 1`] = `
Expand All @@ -145,13 +147,17 @@ exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated
chai 1.0.0 1.0.1 1.0.1 node_modules/chai prefix
dog 1.0.1 1.0.1 2.0.0 node_modules/dog prefix
theta MISSING 1.0.1 1.0.1 - prefix
Red = Updateable within your version range
Yellow = Update available but requires semver-major bump
`

exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated --omit=prod > must match snapshot 1`] = `
Package Current Wanted Latest Location Depended by
cat 1.0.0 1.0.1 1.0.1 node_modules/cat prefix
chai 1.0.0 1.0.1 1.0.1 node_modules/chai prefix
dog 1.0.1 1.0.1 2.0.0 node_modules/dog prefix
Red = Updateable within your version range
Yellow = Update available but requires semver-major bump
`

exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated --parseable --long > must match snapshot 1`] = `
Expand All @@ -174,6 +180,8 @@ exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated
chai 1.0.0 1.0.1 1.0.1 node_modules/chai prefix
dog 1.0.1 1.0.1 2.0.0 node_modules/dog prefix
theta MISSING 1.0.1 1.0.1 - prefix
Red = Updateable within your version range
Yellow = Update available but requires semver-major bump
`

exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated global > must match snapshot 1`] = `
Expand Down Expand Up @@ -296,4 +304,6 @@ exports[`test/lib/commands/outdated.js TAP workspaces should highlight ws in dep
theta MISSING 1.0.1 1.0.1 - [[email protected]
theta MISSING 1.0.1 1.0.1 - [[email protected]
theta MISSING 1.0.1 1.0.1 - [[email protected]
Red = Updateable within your version range
Yellow = Update available but requires semver-major bump
`
Loading