Skip to content

itw-creative-works/node-power-user

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

64 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation




Site | NPM Module | GitHub Repo

Node Power User is the CLI that NPM should have had!

πŸ“¦ Install Node Power User

First, install the package via npm:

npm i -g node-power-user

πŸ¦„ Features

  • Clean and reinstall your node project
  • Easily bump your NPM project's version without opening an editor

πŸ“˜ Example Setup

After installing via NPM, you can use the CLI with the npu command.

πŸ’» Example CLI Usage

Bump Version

Bump your project's version by the specified level.

npu bump <level>
  • npu bump patch: Bump the last number
  • npu bump minor: Bump the middle number
  • npu bump major: Bump the first number

Clean Project

Clean your node project (runs rm -fr node_modules && rm -fr package-lock.json && npm cache clean --force && npm install && npm rb).

npu clean

Global Packages

List all global packages for all versions of Node.js on your machine (you must have NVM installed).

npu global

Install Packages

Install packages with supply chain protection via Socket. Every install is wrapped with Socket to detect malicious or compromised packages β€” including transitive dependencies β€” before they're added to your project. After install, a full socket npm audit runs against your entire dependency tree.

npu install
npu i <package>
npu i <package> --save-dev
npu i <package> --save-exact

If Socket CLI is not installed, npu install will refuse to run. Install it globally to enable protection:

npm install -g @socketsecurity/cli --save-exact

Use --force to bypass Socket protection (not recommended):

npu i <package> --force

Audit

Run a Socket supply chain audit on your current dependency tree.

npu audit

Outdated Packages

Compare the versions of installed modules to those in your package.json. When you choose to update, the install step and a full post-install audit are both wrapped with Socket for supply chain protection.

npu outdated
npu out --heal        # skip the menu: reinstall copies that don't match package-lock.json
npu out --sync        # skip the menu: install packages to match package.json
npu out -r            # skip the menu: reconcile package.json to installed versions
npu out -P | -m | -M  # skip the menu: apply patch / minor / major updates
npu out --force       # bypass Socket protection

Every run starts with an integrity check: npu compares what node_modules/.package-lock.json claims is installed against the packages physically on disk β€” including transitive deps the table can't show. Desynced copies (stale or partially-extracted installs, typically left behind by an interrupted or Socket-blocked install) make npm silently no-op (npm install trusts the lockfile over the disk), so npu warns about them and offers to heal.

When problems are found, the menu offers context-aware actions:

  • Heal β€” when disk copies don't match package-lock.json, removes them and reinstalls so reality matches the lockfile again.
  • Sync β€” when node_modules is behind package.json, installs packages to match what package.json declares.
  • Reconcile β€” when node_modules is ahead of package.json, updates package.json to match installed versions. Strictly ahead-only β€” it never downgrades package.json to match a stale install.

Installs remove the targeted node_modules copies first so npm actually re-fetches them (instead of trusting a stale lockfile and reporting "up to date"), then npu verifies the new versions physically landed in node_modules. If an install fails or Socket blocks it, both package.json and package-lock.json are restored β€” npu never leaves the lockfile advanced past the files on disk.

List Packages

List all packages in your project.

npu packages

Sync Changes

Pull the latest changes from the remote repository and push your changes. You can optionally supply a --message="Your commit message here" flag.

npu sync

Open Repository

Open the current repository's remote URL in your default browser.

npu open

Check Version

Check the version of node-power-user.

npu -v

Wait

Wait for a specified number of ms.

npu wait <ms>

Global flags

  • -C <dir>, --cwd <dir>: Run as if invoked from <dir> (e.g. npu -C /path/to/project out)
  • --debug: Log the commands and flags before they are executed

πŸ› οΈ Development

To test commands locally while developing:

npm start -- <command> [options]

For example:

npm start -- outdated
npm start -- bump patch
npm start -- -v

πŸ—¨οΈ Final Words

If you are still having difficulty, we would love for you to post a question to the Node Power User issues page. It is much easier to answer questions that include your code and relevant files! So if you can provide them, we'd be extremely grateful (and more likely to help you find the answer!)

πŸ“š Projects Using this Library

Somiibo: A Social Media Bot with an open-source module library.
JekyllUp: A website devoted to sharing the best Jekyll themes.
Slapform: A backend processor for your HTML forms on static sites.
Proxifly: A backend processor for your HTML forms on static sites.
Optiic: A backend processor for your HTML forms on static sites.
SoundGrail Music App: A resource for producers, musicians, and DJs.
Hammock Report: An API for exploring and listing backyard products.

Ask us to have your project listed! :)

Contributors