Socket
Socket
Sign inDemoInstall

project-repl

Package Overview
Dependencies
5
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    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.


Version published
Weekly downloads
2K
decreased by-0.1%
Maintainers
1
Install size
91.8 kB
Created
Weekly downloads
 

Readme

Source

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,
  }

FAQs

Last updated on 02 May 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc