Skip to content
/ node-DJs Public
forked from louisremi/node-DJs

Restart a server after each change in main script and dependencies

Notifications You must be signed in to change notification settings

gdb/node-DJs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

node-DJs

Tired of restarting a script every time you modify it or its dependencies? Drop a DJ in da place!

> node d.js myNodeServer.js
DJs: "Party time!" Press [enter] anytime to restart
	24 May 18:50:07 - Server listening on port 8000

Now modify myNodeServer.js or any of the require()d files and hit Ctrl-S.

DJs: playlist updated
6 May 11:29:22 - Server listening on port 8000

If your main script is named app.js you can use the short syntax:

	> node d.js

How it Works/Limitations

DJs recursively parses your scripts to find require()d files, looking for lines such as

var CSV = require(./csv);

It adds them to its playlist and watch all of these files for changes, using the fs.watchFile function. It is currently unable to watch dynamically loaded dependencies:

var dep = './csv';
require(dep);

In the above case, changes occuring on 'csv.js' will not cause your script to restart.

Continuous-Testing

DJs can run a test file for you after every modifications:

> node d.js app.js --test test.js

If your test file is test.js or test/test.js you can use the short syntax:

> node d.js app.js -t

DJs can now be effectively used as an equivalent to watchr for nodejs!

Package manager compatibility

DJs intend to be compatible with the mains node packages managers, one way or another.

About

Restart a server after each change in main script and dependencies

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%