npm / npm/rfcs

[RRFC] New --ci flag for npm outdated command

Open
#619 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
777
Forks
267
PR merge metrics
No merged PRs in 30d

Description

Motivation ("The Why")

Using NPM, we can check for outdated packages:

khalyomede@ubuntu:~/programming/test npm outdated

Package             Current  Wanted  Latest  Location                         Depended by
workbox-core          6.5.3   6.5.3   6.5.4  node_modules/workbox-core        node
workbox-routing       6.5.3   6.5.3   6.5.4  node_modules/workbox-routing     node
workbox-strategies    6.5.3   6.5.3   6.5.4  node_modules/workbox-strategies  node

khalyomede@ubuntu:~/programming/test echo $?
0

I also have a CI that is running everytime I push a commit on the main branch, and will check for missing updates to pull. Unfortunately, no flags exists to make this command to return a non zero code when it finds outdated packages.

Example

I suggest to have a new --ci flag (inspired by npm ci command), to make the outdated check to return a non-zero code when some packages have been found for greater versions.

khalyomede@ubuntu:~/programming/test npm outdated --ci

Package             Current  Wanted  Latest  Location                         Depended by
workbox-core          6.5.3   6.5.3   6.5.4  node_modules/workbox-core        node
workbox-routing       6.5.3   6.5.3   6.5.4  node_modules/workbox-routing     node
workbox-strategies    6.5.3   6.5.3   6.5.4  node_modules/workbox-strategies  node

khalyomede@ubuntu:~/programming/test echo $?
1
How
Current Behaviour

No flags exist to return a non-zero code.

Desired Behaviour

An flag is available to return a non-zero code.

References

Split from

https://github.com/npm/cli/issues/5208

Existing arts

Composer (PHP) is providing a flag for it behind the --strict flag:

khalyomede@ubuntu:~/programming/test-php composer outdated --direct 
Info from https://repo.packagist.org: #StandWithUkraine
Color legend:
- patch or minor release available - update recommended
- major release available - update possible
aws/aws-sdk-php 3.231.15 3.231.17 AWS SDK for PHP - Use Amazon Web Services in your PHP project
laravel/sanctum v2.15.1  v3.0.0   Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs.

khalyomede@ubuntu:~/programming/test-php echo $?
0

khalyomede@ubuntu:~/programming/test-php composer outdated --direct --strict
Info from https://repo.packagist.org: #StandWithUkraine
Color legend:
- patch or minor release available - update recommended
- major release available - update possible
aws/aws-sdk-php 3.231.15 3.231.17 AWS SDK for PHP - Use Amazon Web Services in your PHP project
laravel/sanctum v2.15.1  v3.0.0   Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs.

khalyomede@ubuntu:~/programming/test-php echo $?
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with npm's outdated command and its current exit-code behavior. The issue provides no file or test names, so locating the command implementation and test coverage is part of the initial work; done means defining and validating --ci behavior for outdated packages, including zero and non-zero exits.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.