Extension Icon

PM2

Advanced, production process manager for Node.js.
AvatarLitoMore
70 Installs
Overview

PM2

Adavnced, producing process manager for Node.js.

raycast-cross-extension-badge

Features

  • View PM2 process list
  • Manage PM2 processes (start, stop, restart, reload, delete)
  • Run any Raycast Node.js application in PM2 through Cross-Extension

Requirements

  • Get Node.js and npm installed on your machine
  • Get PM2 installed on your machine

Principles

Due to runtime reasons, the pm2 package won't work in Raycast extension. We used a PM2 wrapper application under the assets folder to bypass this problem. The extension will run npm install under the pm2-wrapper folder during the first run.

API

This extensions follows Raycast Cross-Extension Conventions. You can send Node.js application to PM2 through crossLaunchCommand.

The API command is disabled by default. Remember to enable it from from your extension configuration before using.

command

Type: "start" | "stop" | "restart" | "reload" | "delete"

options

Type: StartOptions | Pm2Process

Options for running the pm2.start(), pm2.stop(), pm2.restart(), pm2.reload(), and pm2.delete().

RuntimeOptions

Type: RuntimeOptions

Optional. Use this option for specifying the runtime properties. The nodePath defaults to Raycast's Node.js process.execPath. The default nodePath can be changed from extension configuration.

Example

You can use raycast-pm2 to easily access the API:

import path from "node:path";
import { LaunchType, environment } from "@raycast/api";
import { runPm2Command } from "raycast-pm2";

runPm2Command(
  {
    command: "start",
    options: {
      script: path.join(environment.assetsPath, "path-to/your-script.js"),
      name: "your-script",
    },
  },
  {},
  {
    name: "main",
    type: LaunchType.UserInitiated,
    extensionName: "pm2",
    ownerOrAuthorName: "litomore",
  },
);

Contributing

See CONTRIBUTING.md.

License

MIT