npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nsrun

v1.4.1

Published

A utility that will run npm scripts without all the logs from npm run-script.

Downloads

15

Readme

nsrun

Greenkeeper badge

A utility that will run npm scripts without all the logs from npm run-script. Build Status

USAGE

Install:
  npm install -g nsrun

Run a script defined in package.json:
  nsrun <script-name> <arguments-for-your-script>

List all the scripts defined in package.json:
  nsrun

FEATURES

  • Steps right into the background and allows your script to take over. The only output you see is whatever the script itself outputs.

  • Just like npm run-script, augments your $PATH with the binaries in ./node_modules/.bin/, so you can use mocha without worrying about installing it globally (for example).

  • Passes arguments right through to your script (no need for --).

  • Uses nsrun whenever it sees npm run-script or npm run in one of your script definitions.

  • Uses $* and/or $1,$2,... wherever in your npm script definitions. The argument of a positional parameter is cleared from the list of arguments.

"coveralls": "npm run-script cover && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage"
"publish-release": "npm version $1 && npm publish && git push origin $2 && npm run coveralls"
...
$ nsrun publish-release patch master

WHY?

I love npm's run-script feature. It feels right to put all the "scripts" that go along with your code in one simple place, right next to all the other metadata about your project, in package.json. Your scripts are expressed as shell scripts, nice and easy. (Want to learn more about why I prefer this over something like grunt or gulp as a script runner? Here is one justification that I agree with.)

There's a small problem with npm run-script though. When your script exits with a nonzero exit code, indicating that there was an error, you see lines and lines of copy written by npm basically saying "this error is probably because the script is bad, not because npm messed up... but in case npm did mess up, here's how you can most helpfully report a bug!"

Now, from npm's perspective this makes a lot of sense... I am sure they get a lot of bug reports from clueless users, especially when npm install x goes wrong or something. But in my use case, this output is often very frustrating. You see, I like to use npm run-script to run my tests (usually with the shorthand, npm test). If the test fails, the script will fail with a nonzero exit code. And npm then outputs all the boilerplate that we've been discussing.

But before all that boilerplate output is output from my script itself, including information about which test failed and why. And that's the information I really want to see.

I wrote this utility to replace npm run-script -- the only difference is that this one doesn't print out any output at all. In fact, it uses kexec to just become whatever process your script should be.

TESTING

npm install
nsrun test