npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mage-console

v0.4.0

Published

Alternative MAGE development console, with REPL interface

Downloads

18

Readme

mage-console

Alternative MAGE development console, with REPL interface.

screen capture

Features

  • Activates debugging (--debug for Node.js < 8.0.0, --inspect otherwise)
  • REPL interface which lets you introspect your MAGE application
  • Watches your './lib' folder and automatically reloads the worker on file changes
  • Works for both JavaScript and TypeScript projects

Requirements

MAGE Version

This module is compatible with MAGE >= 1.0.0. Note that if you have upgraded an older MAGE application to MAGE 1.0.0, you will need to make sure that your ./lib/index.js follows the new initialisation pattern.

Application configuration

mage-console will only work when your application is configured in cluster mode to start a single process:

### Make sure `config/development.yml is configured as such
server:
  cluster: 1

Installation

In your MAGE project:

npm install --save mage-console

Then, in your project's package.json, update the develop script job from npm run mage to mage-console:

{
    "scripts": {
        "develop": "mage-console"
    }
}

If your project is a TypeScript project, set the value to ts-mage-console instead:

{
    "scripts": {
        "develop": "ts-mage-console"
    }
}

Then simply run npm run develop like you would normally do.

Configuration

You may configure mage-console by adding configuration entries into your MAGE configuration. See MAGE's documentation for more details.

config/default.yaml

external:
  mage-console:
    # Where to put the socket file for the console.
    # Default: [project-dir]/node_modules/mage-console/mage-console.sock
    sockfile: /tmp/mage-console.sock

    # Watch additional files; we will always watch `./config' and './lib',
    # but you may want to watch additional folders as well.
    watch:
      - /tmp/file
      - ./www

Debugging

Ports

The following ports are used automatically for debugging:

  • TypeScript: 9229 (inspect protocol, using --inspect flags);
  • Node 8.0 and up: 9229 (inspect protocol, using --inspect flags);
  • Node less than 8.0: 5858 (legacy protocol, using --debug flags);

The debugging interface is activated on workers: this means that when you will save code, the worker will be restarted, and your debugging session will be terminated.

Remote debugging (docker)

While debugging is activated by default, debugging is attached to localhost; if you develop in a Docker container, this means you won't be able to connect remotely to the debugging port.

To solve this issue, you can set the DEBUG_HOST environment variable, as follow:

DEBUG_HOST="0.0.0.0" npm run develop

This will instruct mage-console to have the worker bind the debugging interface on all available interfaces instead of only on localhost.

Visual Studio Code configuration

The default debugging port selection is made to match the behaviour of VSCode. However, if you are using TypeScript, you will need to specifically mention that you are using the new inspect protocol:

.vscode/launch.json

{
  "version": "0.2.0",
  "configurations": [{
    "name": "Attach to MAGE instance",
    "type": "node",
    "request": "attach",
    "sourceMaps": true,
    "outDir": "${workspaceRoot}/dist",
    "protocol": "inspector",
    "internalConsoleOptions": "neverOpen"
  }]
}

License

MIT.