rrepl

An improved node REPL with support for configuration.

Usage no npm install needed!

<script type="module">
  import rrepl from 'https://cdn.skypack.dev/rrepl';
</script>

README

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 which takes a REPLServer instance as its argument. This callback is invoked when rrepl is run, thus configuring your environment.

module.exports = (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();