← All procedures

pnpm.run

Run package scripts using pnpm

CLI
Package
@procedures/pnpm · README
Path
["pnpm","run"]
CLI
mark pnpm run --script <string>
As data
{"$proc":["pnpm","run"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/pnpm"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["pnpm","run"], { script: "<script>" });
console.log(JSON.stringify(result));

From the command line

$ mark pnpm run --script <string>

As data, in a program

{ "$proc": ["pnpm", "run"], "input": { "script": "<script>" } }

Input

FieldTypeRequiredDefaultDescription
scriptstringyesScript name to run
argsstring[]noAdditional arguments to pass to the script
cwdstringnoWorking directory
timeoutnumbernoTimeout in milliseconds

Output

FieldTypeRequiredDefaultDescription
exitCodenumberyesThe exit code of pnpm (0 is success)
stdoutstringyesThe standard output of pnpm
stderrstringyesThe standard error of pnpm
successbooleanyesTrue when the exit code is 0
durationnumberyesThe time of the command, in milliseconds
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "script": {
        "type": "string",
        "description": "Script name to run"
      },
      "args": {
        "description": "Additional arguments to pass to the script",
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "cwd": {
        "description": "Working directory",
        "type": "string"
      },
      "timeout": {
        "description": "Timeout in milliseconds",
        "type": "number"
      }
    },
    "required": [
      "script"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "exitCode": {
        "type": "number",
        "description": "The exit code of pnpm (0 is success)"
      },
      "stdout": {
        "type": "string",
        "description": "The standard output of pnpm"
      },
      "stderr": {
        "type": "string",
        "description": "The standard error of pnpm"
      },
      "success": {
        "type": "boolean",
        "description": "True when the exit code is 0"
      },
      "duration": {
        "type": "number",
        "description": "The time of the command, in milliseconds"
      }
    },
    "required": [
      "exitCode",
      "stdout",
      "stderr",
      "success",
      "duration"
    ],
    "additionalProperties": {}
  }
}