startup - Start up script for node.js repl -
is there way configure node.js's repl? want require jquery , underscore automatically whenever repl starts. there file (noderc?) node.js loads when starts repl?
the equivalent in python edit ~/.ipython/ipy_user_conf.py
with:
import_mod('sys os datetime re itertools functools')
i don't know of such configuration file, if want have modules foo
, bar
available in repl, can create file myrepl.js
containing:
var myrepl = require("repl").start(); ["foo", "bar"].foreach(function(modname){ myrepl.context[modname] = require(modname); });
and when execute node myrepl.js
repl modules available.
armed knowledge can put #!/path/to/node
@ top , make executable directly, or modify version of repl.js module (source available @ https://github.com/joyent/node/blob/master/lib/repl.js inspection) or whatever :)
Comments
Post a Comment