Get the FREE Ultimate OpenClaw Setup Guide →

npm-publish-config

npx machina-cli add skill a5c-ai/babysitter/npm-publish-config --openclaw
Files (1)
SKILL.md
751 B

NPM Publish Config

Configure npm publishing for CLI packages.

Generated Patterns

{
  "name": "@myorg/mycli",
  "version": "1.0.0",
  "bin": { "mycli": "./dist/index.js" },
  "files": ["dist", "README.md", "LICENSE"],
  "main": "./dist/index.js",
  "types": "./dist/index.d.ts",
  "engines": { "node": ">=18" },
  "publishConfig": {
    "access": "public",
    "registry": "https://registry.npmjs.org/"
  },
  "scripts": {
    "prepublishOnly": "npm run build && npm test"
  }
}

Target Processes

  • package-manager-publishing
  • cli-binary-distribution

Source

git clone https://github.com/a5c-ai/babysitter/blob/main/plugins/babysitter/skills/babysit/process/specializations/cli-mcp-development/skills/npm-publish-config/SKILL.mdView on GitHub

Overview

Configures a publish-ready package.json for CLI packages, ensuring proper bin entries, published files, engine requirements, and registry settings. This helps CLI tools publish reliably to npm with consistent distribution.

How This Skill Works

Generates a package.json fragment containing key fields such as name, version, bin, files, main, types, engines, publishConfig, and a prepublishOnly script. The bin entry maps a CLI command to the built dist index.js, while files, main, and types point to dist assets and type declarations.

When to Use It

  • Preparing a new CLI package for public npm publish
  • Updating dist output or bin path after a build
  • Configuring public access or a scoped registry for your package
  • Enforcing Node.js version compatibility with engines
  • Automating publish steps in CI with prepublishOnly

Quick Start

  1. Step 1: Create or update package.json with name, version, bin, files, main, types, engines, publishConfig, and prepublishOnly
  2. Step 2: Ensure dist/index.js and dist/index.d.ts are produced by your build
  3. Step 3: Run npm publish (or run via CI) after npm run build and tests

Best Practices

  • Keep bin names in sync with the published CLI command
  • Include dist, README.md, and LICENSE in files to publish
  • Pin engines to the minimum supported Node version (for example >=18)
  • Use prepublishOnly to build, test, and verify before publish
  • Use a clear publishConfig for registry access and visibility

Example Use Cases

  • Publishing @myorg/mycli with bin and dist outputs
  • Publishing a TypeScript CLI where main and types point to dist/index.js and dist/index.d.ts
  • Public CLI published to npm registry with access: public
  • CI publishes after build using prepublishOnly script
  • Scoped CLI package with engines >=18 and a public registry

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers