project-repl
Adds a REPL to the codebase of a project that will require all the project's depdendencies and all its source files and store them in global variables you can access from the REPL.
Last updated 3 months ago by ccheever .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install project-repl 
SYNC missed versions from official npm registry.

project-repl

Adds a REPL to the codebase of a project that will require all the project's depdendencies and all its source files and store them in global variables you can access from the REPL.

Usage:

To add to a project:

yarn add --dev project-repl
npx make-repl

To run the repl:

./repl

Or if you didn't want to do npx make-repl, you can just do

npx repl

The repl will startup and require all your dependencies and .js files and tell you how long they took to require.

You'll see a Node shell that looks something like this:

ccheever@Charlies-MacBook-Pro:~/projects/ghost-server$./repl
> // ghost-server v1.0.0 // node v10.9.0
6 npm modules and 6 files required in 185ms
express(124ms) pg(39ms) body-parser(6ms) node-fetch(6ms) @expo/time thin-server
Api db index secret users/AuthApi users/ExpoApiV2Client
>

The times in parentheses are how long it took to require each module and file that takes longer than 4ms (configurable) to require.

If you have a main specified in your package.json, the exports of that will be assigned to the global namespace as well, and listed in the output at the top of the REPL.

Configuration

The easiest way to configure the project REPL is to add a repl section to your package.json.

Ignoring modules or files

You can ignore modules and files by adding to the modules and files and globs keys under repl.ignore.


  ...
  "repl": {
    "ignore": {
      "modules": [
        "nodemon", "ignoreme"
      ],
      "files": [
        "BigAndUnimportantFile.js"
      ],
      "globs": [
        "big_data_files",
        "**/*.generated.js",
      ]
    }
  ...

devDependencies

devDependencies are not included by default, but can be by adding the key devDependencies under repl.

  "repl": {
    "devDependencies": true
  }

Other Options

Use populateGlobalWithMain to control whether the exports of main are added to the global object. The default is true.

  "repl": {
    "populateGlobalWithMain": false,
  }

threshold, filesThreshold, and modulesThreshold can be used to control the minimum number of ms before the REPL will print out how many ms it took to load that file or module. The default is 4ms.

If you want no threshold, use -1 instead of 0. 0 will be interpreted as falsy and the default will be used.

  "repl": {
    "threshold": -1,
  }

Current Tags

  • 1.6.1                                ...           latest (3 months ago)

14 Versions

  • 1.6.1                                ...           3 months ago
  • 1.6.0                                ...           3 months ago
  • 1.5.0                                ...           2 years ago
  • 1.4.3                                ...           2 years ago
  • 1.4.2                                ...           2 years ago
  • 1.4.1                                ...           2 years ago
  • 1.4.0                                ...           2 years ago
  • 1.3.1                                ...           2 years ago
  • 1.3.0                                ...           2 years ago
  • 1.2.1                                ...           2 years ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 1
This Week 1
This Month 2
Last Day 0
Last Week 1
Last Month 44
Dependencies (1)
Dev Dependencies (1)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |