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

grunt-forever-multi

v0.5.0

Published

Run one or more forever scripts/actions (forked/based on grunt-forever)

Downloads

20

Readme

grunt-forever-multi

Credit to @bustardcelly and grunt-forever, which this plugin is forked from / based on. This is just that but as a multi task, with a bug or two fixed, and some added features. https://github.com/bustardcelly/grunt-forever

Getting Started

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-forever-multi --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-forever-multi');

Forever Multi task

Usage Examples

Gruntfile.js

	foreverMulti: {
		basic: {
			file: 'test/run.js'
		},
		appServer: {
			action: 'restart',
			file: 'test/run.js',
			options: ["-m '"+cfgJson.app.name+" port "+cfgJson.server.port+"'"]
		},
		testServer: {
			// action: 'restart',		//default is restart if no action specified
			file: 'test/run.js',
			options: ["config=test", "-m '"+cfgTestJson.app.name+" port "+cfgTestJson.server.port+"'"]
		}
	}

Command Line

  • command line arguments (grunt.option)
    • action to override the action (i.e. --action=start will run the forever start action even if the task config is set to restart or stop action)
# run all tasks in this multiTask with their defaults / standard config
grunt foreverMulti
# force a forever restart irregardless of what the config action is
grunt foreverMulti --action=restart
# run just one of the tasks
grunt foreverMulti:appServer

Options

The options / keys for each task mimic forever-monitor/forever: https://github.com/nodejitsu/forever-monitor including file and action keys. The only supported options currently are:

  • file The file/script to run (i.e. index.js or server.js)
  • action What to run forever with - see: https://npmjs.org/package/forever. Only start, restart, stop are supported currently.
  • options Command line arguments to pass to forever

Other options including, but not limited to, silent, uid, max, command, sourceDir, watch, logFile, outFile, errFile are NOT currently supported.

Why? (Use Cases)

  • For Continuous Integration - to restart your server(s) after a git push/webhook to get the file changes.
    • i.e.: Use grunt to: 1. build new files/assets with the new code, 2. restart forever to update the running server/processes with the new code, 3. wait/timeout (sometimes necessary to allow the server time to fully restart), 4. run automated tests on the new code

Development

See https://npmjs.org/doc/developers.html for notes on publishing npm modules in general.

  • run grunt to ensure no issues
  • bump version number in package.json
  • update CHANGELOG.md (and potentially this README.md) file
  • git commit changes
  • npm publish
  • push to github (to update there as well)

TODO

  • async / forever issues intermittently.. sometimes forever.startDaemon is called but grunt finishes WITHOUT done() being called (from this.async()) - this causes the script to exit - sometimes before the forever process is started and it stops future execution of any other tasks in the multi-task.. I'm not sure what's going on here or how to fix..
  • add support for more (all?) forever options - i.e. uid, command, watch