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

sailsrun

v0.0.1

Published

sailsrun is the `sails run` cli revival of the sailsjs.org 0.9 branch

Downloads

6

Readme

sailsrun

The revival of the sails run cli from the sails 0.9 branch

Command handlers are now in separate files instead of commands/index.js allowing different scopes when the app is loading

npm install -g sailsrun

simple command handler

// commands/mycommand.js
module.exports = function(sails, cb) {
    sails.log.info('Welcome back!');
    cb();
};
$ sailsrun mycommand
info: Welcome back!
$

complete usage

# create ./run.js and commands/
$ sailsrun init
# copy the boilerplate to commands/mycommand.js
$ sailsrun generate command mycommand
module.exports = {

  scope: function(rconf) {
    // you can access command line aguments and rc configuration from rconf

    return {
      // define you level of logging here
      log: {
        noShip: true
      },

      // ignore application bootstrap
      // or define your own
      bootstrap: function(done) {
        return done();
      },

      hooks: {
        // custom hook to empty the router
        noRoutes: function(sails) {
          return {
            initialize: function(cb) {
              sails.config.routes = {};
              return cb();
            }
          };
        }

        // you can disable hooks here
        // e.g. grunt: false
      },

      // or you can disable all hooks
      // and choose only the ones you need to start
      loadHooks: [
        'moduleloader',
        'logger',
        'orm',
        'services',
        'userconfig',
        'userhooks'
      ]
    };
  },

  run: function(sails, cb) {
    /**
     * Sample command and subcommands handler
     */

    var identity = sails.config.args[0];
    sails.log.info('Sails is ready, running `' + identity + '`');


    var subcommands = {

      /**
       * define sub commands here
       */
      foo: function(args, cb) {
        sails.log('bar');

        // use cb(err) to quit or report an error
        cb();
      },



      initialize: function(args, cb) {
        if(subcommands[args[0]]) {
          return subcommands[args[0]](_.rest(args), cb);
        }
        cb(identity + ': missing function `' +args[0]+ '`');
      }

    };

    if( sails.config.args.length < 1 ) {
      return cb(identity + ': missing parameter');
    }

    subcommands.initialize(_.rest(sails.config.args), cb);
  }
};
$ node ./run.js mycommand foo --prod
Sails is ready, running `mycommand`
bar