UNPKG

@elgato/streamdeck

Version:

The official Node.js SDK for creating Stream Deck plugins.

26 lines (25 loc) 1.11 kB
import path from "node:path"; let __isDebugMode = undefined; /** * Determines whether the current plugin is running in a debug environment; this is determined by the command-line arguments supplied to the plugin by Stream. Specifically, the result * is `true` when either `--inspect`, `--inspect-brk` or `--inspect-port` are present as part of the processes' arguments. * @returns `true` when the plugin is running in debug mode; otherwise `false`. */ export function isDebugMode() { if (__isDebugMode === undefined) { __isDebugMode = process.execArgv.some((arg) => { const name = arg.split("=")[0]; return name === "--inspect" || name === "--inspect-brk" || name === "--inspect-port"; }); } return __isDebugMode; } /** * Gets the plugin's unique-identifier from the current working directory. * @returns The plugin's unique-identifier. */ export function getPluginUUID() { const name = path.basename(process.cwd()); const suffixIndex = name.lastIndexOf(".sdPlugin"); return suffixIndex < 0 ? name : name.substring(0, suffixIndex); }