← All procedures

npm.distTags.add

Set a dist-tag of a package to a version, in the registry. It needs confirm: true

CLI
Package
@procedures/npm · README
Path
["npm","distTags","add"]
CLI
mark npm distTags add --package <string> --version <string> --tag <string> --confirm <boolean>
As data
{"$proc":["npm","distTags","add"],"input":{}}

Use it

In TypeScript

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

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["npm","distTags","add"], { package: "<package>", version: "<version>", tag: "<tag>", confirm: true });
console.log(JSON.stringify(result));

From the command line

$ mark npm distTags add --package <string> --version <string> --tag <string> --confirm <boolean>

As data, in a program

{
  "$proc": ["npm", "distTags", "add"],
  "input": {
    "package": "<package>",
    "version": "<version>",
    "tag": "<tag>",
    "confirm": true
  }
}

Input

FieldTypeRequiredDefaultDescription
packagestringyesThe package, for example zod or @scope/name
versionstringyesThe version that gets the tag, for example 1.2.0
tagstringyesThe dist-tag, for example latest or next. It moves from its earlier version
confirmbooleanyesMust be true: the call changes the registry for each user of the package
otpstringnoA one-time password, when the account has two-factor authentication
registrystringnoThe URL of the registry (default: the registry of the npm configuration)
cwdstringnoWorking directory
timeoutnumbernoTimeout in milliseconds

Output

FieldTypeRequiredDefaultDescription
exitCodenumberyesThe exit code of npm (0 is success)
stdoutstringyesThe standard output of npm
stderrstringyesThe standard error of npm, or the error message when npm did not start
successbooleanyesTrue when the exit code is 0
durationnumberyesThe time of the command, in milliseconds
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "package": {
        "type": "string",
        "description": "The package, for example zod or @scope/name"
      },
      "version": {
        "type": "string",
        "description": "The version that gets the tag, for example 1.2.0"
      },
      "tag": {
        "type": "string",
        "description": "The dist-tag, for example latest or next. It moves from its earlier version"
      },
      "confirm": {
        "type": "boolean",
        "const": true,
        "description": "Must be true: the call changes the registry for each user of the package"
      },
      "otp": {
        "description": "A one-time password, when the account has two-factor authentication",
        "type": "string"
      },
      "registry": {
        "description": "The URL of the registry (default: the registry of the npm configuration)",
        "type": "string"
      },
      "cwd": {
        "description": "Working directory",
        "type": "string"
      },
      "timeout": {
        "description": "Timeout in milliseconds",
        "type": "number"
      }
    },
    "required": [
      "package",
      "version",
      "tag",
      "confirm"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "exitCode": {
        "type": "number",
        "description": "The exit code of npm (0 is success)"
      },
      "stdout": {
        "type": "string",
        "description": "The standard output of npm"
      },
      "stderr": {
        "type": "string",
        "description": "The standard error of npm, or the error message when npm did not start"
      },
      "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": {}
  }
}