Skip to content

feat: add u as alias for update command#9163

Open
Ausoj wants to merge 2 commits intonpm:latestfrom
Ausoj:feat/add-u-alias-for-update
Open

feat: add u as alias for update command#9163
Ausoj wants to merge 2 commits intonpm:latestfrom
Ausoj:feat/add-u-alias-for-update

Conversation

@Ausoj
Copy link
Copy Markdown

@Ausoj Ausoj commented Mar 30, 2026

Summary

Adds u as a short alias for the update command, making it consistent with i for install.

Motivation

npm i is the canonical short form for npm install — the most commonly used npm command. However, npm update lacks an equivalent single-character alias. The existing npm up alias works, but feels inconsistent compared to i.

Adding u makes the CLI more ergonomic and intuitive:

npm i    # install   ✅ already exists
npm u    # update    ✅ this PR

Changes

  • Added u: 'update' alias in lib/utils/cmd-list.js, grouped alongside the existing up: 'update' alias

Notes

  • u is not currently used by any other alias or command, so there is no conflict
  • Follows the same pattern as other single-character aliases (i, r, t, c, s, v, x)

@Ausoj Ausoj requested a review from a team as a code owner March 30, 2026 11:46
@Ausoj Ausoj force-pushed the feat/add-u-alias-for-update branch from 14c8a21 to 8bce7f3 Compare March 30, 2026 11:50
@ItsAMirko
Copy link
Copy Markdown

I would love that. Always running in the same problem and would really like to have that additional shortcut.

@arnemileswinter
Copy link
Copy Markdown

second this, a mitigation to RSI as well.

@owlstronaut
Copy link
Copy Markdown
Contributor

I'm not sure about this. My brain tells me npm u means uninstall. I don't think the u is unambiguous enough to add it here. I find the existing r equally misleading, but we're already here.

@KevinExtremo
Copy link
Copy Markdown

I think this is a great idea! I love using the shorthands.

I also do not believe that the argument about u standing for uninstall to be a counter. Uninstall is a destructive action while the other shorthands are constructive actions.

I understand one could argue that an update can change contracts but to me its not the same as a full on removal.

So in that sense I am actually happy that uninstall does not come with a shorthand.

@larsmenzel
Copy link
Copy Markdown

Actually a regular thing I run into. Seems like a neat addition which wouldn't hurt to add :)

@wraithgar
Copy link
Copy Markdown
Member

What about npm uninstall?

@KevinExtremo
Copy link
Copy Markdown

KevinExtremo commented Apr 8, 2026

What about npm uninstall?

Did you read the discussion? This was already addressed.

@wraithgar
Copy link
Copy Markdown
Member

Ah yes I missed the very end there, sorry

@Ausoj
Copy link
Copy Markdown
Author

Ausoj commented Apr 8, 2026

I think the need here is straightforward: update is common enough to deserve the same shorthand treatment that npm already gives to other frequently used commands.

Today, install has i, while update is left with up. That is an inconsistency in regards to UX between two very commonly used commands. This PR aims to address that inconsistency in the most minimal way possible: by adding a single new alias, with no behaviour changes and no conflicts with existing commands.

As others have already mentioned, I do not think "someone might imagine another meaning for u" is a particularly strong argument against it, because npm already accepts aliases that are short, learnable and not always fully self-evident at first glance.

For example, the install command already has quite a few aliases, such as i, in, ins, inst, as well as typo-tolerant variants as well as isnt and isntall. Likewise, ci is also available as ic. So npm's current alias design is already based on practicality and ergonomics, not on every shorthand being uniquely obvious to first-time readers.

This shows that npm has already been willing to optimize for convenience where the tradeoff is low. Against that backdrop, u for update is a small, consistent, and entirely reasonable addition to npm's existing alias conventions.

@owlstronaut
Copy link
Copy Markdown
Contributor

owlstronaut commented Apr 9, 2026

not sure where CI went on this, closing and reopening to try and trigger it...

I think you make good points. I'm good with this

@owlstronaut owlstronaut closed this Apr 9, 2026
@owlstronaut owlstronaut reopened this Apr 9, 2026
@owlstronaut
Copy link
Copy Markdown
Contributor

@Ausoj Will need an npm run snap on this to update the snapshots

@Ausoj
Copy link
Copy Markdown
Author

Ausoj commented Apr 9, 2026

@owlstronaut done - 2fd83ac

  🌈 SUMMARY RESULTS 🌈

 SKIP  test/bin/windows-shims.js 7 skip of 17 60.553ms
 ~ cmd - test not relevant on platform
 ~ powershell - test not relevant on platform
 ~ pwsh - test not relevant on platform
 ~ git bash - test not relevant on platform
 ~ user git bash - test not relevant on platform
 ~ wsl bash - test not relevant on platform
 ~ cygwin bash - test not relevant on platform


Suites:   109 passed, 109 of 109 completed
Asserts:  5122 passed, 7 skip, of 5129

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants