Giter Site home page Giter Site logo

connectionmaster / ndb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlechromelabs/ndb

0.0 0.0 0.0 802 KB

ndb is an improved debugging experience for Node.js, enabled by Chrome DevTools

License: Apache License 2.0

JavaScript 97.47% HTML 0.29% CSS 2.24%

ndb's Introduction

ndb

Build Status NPM ndb package

ndb is an improved debugging experience for Node.js, enabled by Chrome DevTools

Installation

Compatibility: ndb requires Node >=8.0.0. It works best with Node >=10.

Installation: ndb depends on Puppeteer which downloads a recent version of Chromium (~170MB Mac, ~280MB Linux, ~280MB Win).

# global install with npm:
npm install -g ndb


# alternatively, with yarn:
yarn global add ndb

Global installation may fail with different permission errors, you can find help in this thread.

Windows users: Installation may fail on Windows during compilation the native dependencies. The following command may help: npm install -g windows-build-tools

Local install

If you want ndb available from an npm script (eg. npm run debug runs ndb index.js), you can install it as a development dependency:

# local install with npm:
npm install --save-dev ndb


# alternatively, with yarn:
yarn add ndb --dev

You can then set up an npm script. In this case, ndb will not be available in your system path.

Getting Started

You can start debugging your Node.js application using one of the following ways:

  • Use ndb instead of the node command
ndb server.js

# Alternatively, you can prepend `ndb`
ndb node server.js
  • Prepend ndb in front of any other binary
# If you use some other binary, just prepend `ndb`
## npm run unit
ndb npm run unit

# Debug any globally installed package
## mocha
ndb mocha

# To use a local binary, use `npx` and prepend before it
ndb npx mocha
  • Launch ndb as a standalone application
    • Then, debug any npm script from your package.json, e.g. unit tests
# cd to your project folder (with a package.json)
ndb .
# In Sources panel > "NPM Scripts" sidebar, click the selected "Run" button 
  • Use Ctrl/Cmd + R to restart last run

  • Run any node command from within ndb's integrated terminal and ndb will connect automatically

  • Run any open script source by using 'Run this script' context menu item, ndb will connect automatically as well

  • Use --prof flag to profile your app, Ctrl/Cmd + R restarts profiling

ndb --prof npm run unit

What can I do?

ndb has some powerful features exclusively for Node.js:

  1. Child processes are detected and attached to.
  2. You can place breakpoints before the modules are required.
  3. You can edit your files within the UI. On Ctrl-S/Cmd-S, DevTools will save the changes to disk.
  4. By default, ndb blackboxes all scripts outside current working directory to improve focus. This includes node internal libraries (like _stream_wrap.js, async_hooks.js, fs.js) This behaviour may be changed by "Blackbox anything outside working dir" setting.

In addition, you can use all the DevTools functionality that you've used in typical Node debugging:

  • breakpoint debugging, async stacks (AKA long stack traces), async stepping, etc...
  • console (top-level await, object inspection, advanced filtering)
  • eager evaluation in console (requires Node >= 10)
  • JS sampling profiler
  • memory profiler

Screenshot

image

Contributing

Check out contributing guide to get an overview of ndb development.

Thanks to the 'OG' ndb

In early 2011, @smtlaissezfaire released the first serious debugger for Node.js, under the ndb package name. It's still preserved at github.com/smtlaissezfaire/ndb. We thank Scott for generously donating the package name.

ndb's People

Contributors

ak239 avatar connorjclark avatar d4nyll avatar jdalton avatar johnjbarton avatar kumarvi avatar mkg20001 avatar mohamed3on avatar paulirish avatar pavelfeldman avatar penguinput avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.