Socket
Socket
Sign inDemoInstall

npm-ls-scripts

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    npm-ls-scripts

List runnable npm scripts in package.json


Version published
Maintainers
1
Install size
23.8 kB
Created

Readme

Source

npm-ls-scripts

List runnable npm scripts

Inspired by rake -T, which will show you all the tasks runnable by rake, this script will show you all the runnable scripts that npm's package.json knows about.

Usage

Npm lets you define scripts that npm can run. Your package.json will include:

{
  "scripts": {
    "start": "node app.js",
    "job": "node my/one-off/job.js"
  }
}

You could cat package.json, but that's lame. Instead, install npm-ls-scripts:

npm install npm-ls-scripts --save

And run:

ls-scripts

And see the scripts in a nice list:

NPM - ls scripts
---
start - node app.js
job   - node my/one-off/job.js
---

Note: ls-scripts is the binary that comes with this package. To use, adjust your path to include:

export PATH=./node_modules/.bin:$PATH

Alternately, after installation, you could type:

node_modules/.bin/ls-scripts

Or different still, you make a script to run npm-ls-scripts in your package.json:

{
  "scripts": {
    "ls": "node_modules/.bin/ls-scripts"
  }
}

And run with:

npm run ls

Config

You can make the output even nice by adding a verbal description to scripts that may be helped by it. Add config via your package.json:

{
  "config": {
    "scripts": {
      "job": "I would gladly do the job"
    }
  },
  "scripts": {
    "start": "node app.js",
    "job": "node my/one-off/job.js"
  }
}

Make sure the script names match between config and scripts.

Run with this config, and you should see:

NPM - ls scripts
---
start - node app.js
job   - I would gladly do the job
---

Note that you do not need to specify a description for all scripts if it's not useful or your fingers are tired.

Keywords

FAQs

Last updated on 09 Apr 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc