Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dev

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dev

Reruns the given file whenever the current working dir subtree has modifications.

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

What does it do?

It autoreloads Node.JS in case of any file changes.

$ npm install dev -g

$ node-dev app.js

Starting: app.js
> server is listening on http://127.0.0.1:8080</pre>

node-dev will rerun app.js whenever one of the watched files is changed.

The module is based on inotify. So, unlike most other modules of this kind, it starts watching new files automatically.

A number of additional options make the module really flexible and extendible.

Install

npm install dev -g

Global installation is preferred to have node-dev utility in path.

Advanced usage

The node-dev is a tiny file which basically contains:

var manager = require("dev")(options);
manager.start();

The options are:

Running
  • run: the js file to run, e.g ./app.js, it is the only required option.
Watch/Ignore
  • watchDir: the folder to watch recursively, default: .
  • ignoredPaths [ paths ]: array of ignored paths, which are not watched, members can be:
    • string, matched exactly against path, like ./public,
    • RegExp, e.g an extension check: /\.gif$/
    • function(path), which takes the path and returns true if it should be ignored
Logging
  • debug: enables additional logging output about watches and changes, default: false
  • logger: custom logger object, must have error(...) and debug(...) methods, delegates to console.log by default. Can use any other logger.
Info
  • onRunOutput: callback function(output), called for stdout data from the running process
  • onRunError: callback function(output), called for stderr data from the running process

You can use these to send error notifications and integrate with your development environment if you wish.

Troubleshooting

There are limits on the number of watched files in inotify. So make sure that you only watch your modules, not all 3rd-party npm stuff.

To change the limit:

$ echo 16384 > /proc/sys/fs/inotify/max_user_watches

Or:

$ sudo sysctl fs.inotify.max_user_watches=16364

To make the change permanent, edit the file /etc/sysctl.conf and add this line to the end of the file:

fs.inotify.max_user_watches=16384

TODO

Tell me which features you miss?

Use Github issue tracker for that.

Thank you.

FAQs

Package last updated on 22 May 2011

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc