An improved node REPL with support for configuration.
npm install -g rrepl
rrepl
or
npx rrepl
Add a .noderc
file in your home directory. You can also specify a different
configuration file with the -c
or --config
option. The .noderc
file should
export a function named rrepl which takes a
REPLServer
instance
as its argument. This callback is invoked when rrepl
is run, thus configuring
your environment.
module.exports.rrepl = (repl) => {
repl.setPrompt('>> ');
};
See .noderc.example.js
as a sample of what you can do with rrepl
!
You can pass additional arguments to node
with the
NODE_OPTIONS
environment variable. For example, run:
env NODE_OPTIONS="--experimental-repl-await" rrepl
to enable top-level await keyword support.
Furthermore, you can programmatically create a repl with the following:
import { createRepl } from 'rrepl';
// or
const { createRepl } = require('rrepl');
const repl = await createRepl();