@invisit/nest-repl
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

@invisit/nest-repl

REPL: Interact with Nest Services, Controllers, Providers, Modules, etc in a Simple Interactive Repo

Simple library for NestJS to interact with your runtime env to make development inside of the Nest ecosystem easy to debug

Quickstart

To get started, install dependencies:

yarn add @invisit/nest-repl
# OR - dev only

A simple example

import { Injectable, Module } from "@nestjs/common"
import * as _ from "lodash"
import * as Prelude from "@3fv/prelude-ts"

import { NestReplModule } from "@invisit/nest-repl"
import { NestApplication, NestFactory } from "@nestjs/core"

const log = console.log.bind(console)

@Module({
  imports: [
    NestReplModule.register({
      // Optionally, you can configured the repl to not autostart, up to u
      // autostart: false // default is autostart=true
      prompt: "InvisitREPL >>",
      context: {
        mainGlobal: global,
        Lodash: _,
        Prelude
      }
    })
  ]
})
export class SimpleReplExampleModule {}

/**
 * Boilerplate cli below
 */ 
async function run() {
  const app = await NestFactory.create<NestApplication>(SimpleReplExampleModule,{})
  await app.init()

  // If autostart = false - by default autostart=true so this is not needed
  // const repl = await app.resolve(NodeRepl)
  // await repl.start()
}

run().catch(err => {
  console.error(`Failed to run SimpleReplExample`, err)
})

Readme

Keywords

none

Package Sidebar

Install

npm i @invisit/nest-repl

Weekly Downloads

0

Version

1.0.10

License

MIT

Unpacked Size

695 kB

Total Files

71

Last publish

Collaborators

  • invisit-user
  • jglanz
  • emery-dev