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

@bluecadet/launchpad-monitor

v1.8.0

Published

The [`@bluecadet/launchpad-monitor`](https://www.npmjs.com/package/@bluecadet/launchpad-monitor) package launches and monitors any number of apps.

Downloads

7

Readme

Launchpad Monitor

The @bluecadet/launchpad-monitor package launches and monitors any number of apps.

Under the hood, it uses PM2 for process management, and adds a few features like window foregrounding and minimizing.

Configuration

  1. Create a monitor section in your launchpad.json (see MonitorOptions).
  2. Add a list of app option objects in monitor.apps (see AppOptions).
  3. Each app requires a pm2 block, which requires a name and script as a minimum. See PM2 docs for all supported settings.
  4. Run npx launchpad monitor (or npx launchpad to update content first if configured)
{
  "monitor": {
    "apps": [
      {
        "pm2": {
          "name": "my-app",
          "script": "my-app.exe"
        }
      }
    ]
  }
}

Apps will be relaunched individually as soon as they exit.

MonitorOptions

Top-level options of Launchpad Monitor.

| Property | Type | Default | Description | | - | - | - | - | | apps | Array.<AppOptions>| [] | A list of AppOptions to configure which apps to launch and monitor. | | deleteExistingBeforeConnect | boolean| false | Set this to true to delete existing PM2 processes before connecting. If you're running volatile apps or your node process might be quit unexpectedly, this can be helpful to start with a clean slate on startup. | | windowsApi | WindowsApiOptions| | Advanced configuration for the Windows API, e.g. for managing foreground/minimized/hidden windows. |

AppOptions

Options for an individual app to monitor.

| Property | Type | Default | Description | | - | - | - | - | | pm2 | pm2.StartOptions| null | Configure which app to launch and how to monitor it here.See: https://pm2.keymetrics.io/docs/usage/application-declaration/#attributes-available | | windows | WindowOptions| new WindowOptions() | Optional settings for moving this app's main windows to the foreground, minimize or hide them. | | logging | AppLogOptions| new AppLogOptions() | Optional settings for how to log this app's output. |

WindowOptions

Options for how an app's windows should be managed.

| Property | Type | Default | Description | | - | - | - | - | | foreground | boolean| false | Move this app to the foreground once all apps have been launched. | | minimize | boolean| false | Minimize this app's windows once all apps have been launched. | | hide | boolean| false | Completely hide this app's windows once all apps have been launched. Helpful for headless apps, but note that this might cause issues with GUI-based apps. |

Example: Monitor Two Apps

The following launchpad.json will launch and monitor two apps. The first app window will be foregrounded after launch, the second app will be minimized. If any of the apps exit, PM2 will relaunch them.

{
  "monitor": {
    "apps": [
      {
        "pm2": {
          "name": "main-app",
          "script": "my-main-app.exe",
          "cwd": "../apps/"
        },
        "windows": {
          "foreground": true
        }
      },
      {
        "pm2": {
          "name": "side-app",
          "script": "my-side-app.exe",
          "cwd": "../apps/",
          "args": "--custom-arg=true"
        },
        "windows": {
          "minimize": true
        }
      }
    ]
  }
}

Logging App Output

To capture your apps' logs in Launchpad Monitor you need to ensure that your apps are routing them to stdout and stderr.

Unity

To redirect Unity's logs to stdout and stderr, launch your app using the -logfile - argument:

{
  "monitor": {
    "apps": [
      {
        "name": "unity-app",
        "script": "UnityPM2Test.exe",
        "args": "-logfile -"
      }
    ]
  }
}

Cinder

  • Cinder doesn't route logs directly to std::cout and std::cerr by default, so this has to be done manually. See here for an example for how to create one, and here for how to add it.
  • If you use Cinder-BluecadetViews, all logs are routed to stdout/stderr via the logToStdOut setting. This is set to true by default and can otherwise be configured in settings.json or via cli flag: my-app.exe console=false logToStdOut=true

Adanced Configuration

See below for further settings that can be configured globally and on a per-app level.

WindowsApiOptions

Global options for how window order should be managed.

| Property | Type | Default | Description | | - | - | - | - | | nodeVersion | string| '>=17.4.0' | The minimum major node version to support window ordering.Node versions < 17 seem to have a fatal bug with the nativeAPI, which will intermittently cause V8 to crash hard.See: https://github.com/node-ffi-napi/ref-napi/issues/54#issuecomment-1029639256 | | debounceDelay | number| 3000 | The delay until windows are ordered after launch of in ms.If your app takes a long time to open all of its windows, set this number to a higher value to ensure it can be on top of the launchpad terminal window.Keeping this high also reduces the CPU load if apps relaunch often. |

AppLogOptions

Options for how an app's logs should be saved, routed and displayed.

| Property | Type | Default | Description | | - | - | - | - | | logToLaunchpadDir | boolean| true | Route application logs to launchpad's log dir instead of pm2's log dir. | | mode | 'bus' | 'file'| 'bus' | How to grab the app's logs. Supported values:- 'bus': Logs directly from the app's stdout/stderr bus. Can result in interrupted logs if the buffer isn't consistently flushed by an app.- 'file': Logs by tailing the app's log files. Slight lag, but can result in better formatting than bus. Not recommended, as logs cannot be rotated by launchpad. | | showStdout | boolean| true | Whether or not to include output from stdout | | showStderr | boolean| true | Whether or not to include output from stderr |