2.2.2 • Published 4 months ago

@das.laboratory/nps-i v2.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Interactive mode for nps

Differences From Original Package

  • If you use an .npmrs or .npmrs.json file, it will load the nps config from there.
  • You can now use scripts that require user input.
  • Adding hiddenFromInteractive: true hides a script from the menu
  • Adding pageSize: <number> sets the number of options shown without scrolling
  • Grouped scripts are divided by a separator
  • Scripts without description don't show 'undefined' anymore
  • In ESM workspaces you can rename package-scripts file to package-scripts.cjs (see below).

Install

npm install -D @das.laboratory/nps-i

or install it globally

npm install -g @das.laboratory/nps-i

ESM projects

If your workspace is set up as module (i.e. the nearest parent package.json contains "type": "module"), node will give you an ERR_REQUIRE_ESM error. This means that it refuses to require your package-scripts.js file because it assumes that all .js files are ESM modules.

In this case simply rename package-scripts.js to package-scripts.cjs (note the .cjs file extension). This will tell node that the file is to be treated as a CommonJS module.

Simple example

package-scripts.js:
See examples/simple/package-scripts.js.

? How can I help you today?

 (Use arrow keys or type to search)
❯ server.start        Start the server
  server.restart      Restart the server
  server.stop         Stop the server
  ──────────────
  db.commit           Diffs the local database with current migrations
(Move up and down to reveal more choices)

Fancy example

package-scripts.js:
See examples/fancy/package-scripts.js.

Output:

 **************************
 ** SERVER SCRIPTS 3000™ **
 **************************

 Choose wisely...

 (Use arrow keys or type to search)
❯ server.start                  Start the server and insert dummy files into the buckets
  server.restart                Restart the server and insert dummy files into the buckets
  server.stop                   Stop the server
  ──────────────
  backup-db.full.local          Full backup of the local database
  backup-db.full.server1        Full backup of the database on server 1
  backup-db.full.server2        Full backup of the database on server 2
  backup-db.full.all            Full backup of all databases
  ──────────────
  backup-db.schema.local        Schema backup of the local database
  backup-db.schema.server1      Schema backup of the database on server 1
  backup-db.schema.server2      Schema backup of the database on server 2
  backup-db.schema.all          Schema backup of all databases
  ──────────────
  backup-db.data.local          Data backup of the local database
  backup-db.data.server1        Data backup of the database on server 1
  backup-db.data.server2        Data backup of the database on server 2
  backup-db.data.all            Data backup of all databases
  ──────────────
  backup-db.split.local         Separate schema & data backup of the local database
(Move up and down to reveal more choices)

Original Authors

See the following for more:

Also includes updates / inspiration from:

Original README

license

MIT © siddharthkp

 

install

npm install nps-i

or install it globally

npm install -g nps-i

 

usage

Replace nps with nps-i in your package.json

{
	"scripts": {
		"start": "nps-i"
	}
}

You can also use it with the shorthand ni when installed globally.

 

like it?

:star: this repo

 

license

MIT © siddharthkp