Skip to content

An improved node REPL with support for configuration.

License

Notifications You must be signed in to change notification settings

tough-griff/rrepl

Repository files navigation

rrepl

npm build codecov

An improved node REPL with support for configuration.

Usage

npm install -g rrepl
rrepl

or

npx rrepl

Configuration

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!

NODE_OPTIONS

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.

Programmatic Usage

Furthermore, you can programmatically create a repl with the following:

import { createRepl } from 'rrepl';
// or
const { createRepl } = require('rrepl');

const repl = await createRepl();