Extension Icon

PM2

Advanced, production process manager for Node.js.
AvatarLitoMore
234 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 installed on your machine
  • Get PM2 installed on your machine

Principles

The extension uses the pm2 package directly through PM2's programmatic API. Some optional PM2 CLI dependencies are marked as external for Raycast's build step because they are not used by this extension's list and process-management commands.

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