Skip to content

LitoMore/raycast-pm2

Repository files navigation

raycast-pm2

PM2 utilities for Raycast Extensions

raycast-cross-extension-badge

Install

npm i raycast-pm2

Usages

This package follows Raycast Cross-Extension Conventions.

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

Example

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",
	},
);

API

runPm2Command(commandOptions, launchOptions?, callbackOptions?)

commandOptions

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().

launchOptions

Type: Partial<LaunchOptions>

Optional. Options for launch the target command. It has default values for launching the PM2 extension:

  • name defaults to api
  • type defaults to LaunchType.Background
  • extensionName defaults to pm2
  • ownerOrUserName defaults to litomore

callbackOptions

Optional. Same as the raycast-cross-extension's callbackOptions.

Related

License

CC0-1.0