publishing-a-new-package

Publishes monorepo packages to npm and verifies consumer installation end to end.

2.0k|679|Updated Jun 13, 2024
One-click install
npx skills add https://github.com/Comfy-Org/ComfyUI_frontend --skill publishing-a-new-package
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: publishing-a-new-package
Source: https://github.com/Comfy-Org/ComfyUI_frontend/tree/main/.claude/skills/publishing-a-new-package
Command: npx skills add https://github.com/Comfy-Org/ComfyUI_frontend --skill publishing-a-new-package

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Publishing a new package from a pnpm monorepo to npm fails in non-obvious ways: first-publish 404 errors from token scoping, broken tarballs from catalog: specifiers, missing export targets, and OIDC misconfiguration. This Skill walks through the entire lifecycle so the package is actually installable from another repository, not just green in CI.

Core Features & Use Cases

  • First-publish guidance: Diagnoses the npm 404 on PUT for brand-new package names and explains token scoping versus manual first publish.
  • Workflow scaffolding: Replicates the four-workflow GitHub Actions set (publish, on-merge, version-bump, pack check) from an existing package like design-system.
  • Consumer smoke test: Verifies the published package by installing it in a separate npm-based repo, importing every export entry, and grepping build output.
  • Use Case: You add a new package under packages/ in the ComfyUI_frontend monorepo and need it published under @comfyorg with trusted publishing (OIDC) configured correctly.

Quick Start

Publish the new package in packages/ to npm under @comfyorg and verify it installs and builds correctly from a separate consumer repository.

Frequently Asked Questions about publishing-a-new-package

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does npm publish return 404 for a new package?

A 404 on PUT for a brand-new package name means the CI token lacks permission to create new names in the scope. Granular tokens limited to a hand-picked package list cannot include a package that does not exist yet. Grant read+write on the whole scope or publish once manually.

How do I publish a pnpm workspace package to npm?

Always use pnpm publish, never npm publish, in a pnpm monorepo. pnpm rewrites catalog: specifiers to real version ranges when packing, while npm publish ships the literal catalog: string and breaks every consumer install.

Can npm trusted publishing (OIDC) be used for the first publish?

No. npm requires the package to already exist before a trusted publisher can be configured. The order is: first publish by token, then configure the trusted publisher on npmjs.com, then switch CI to OIDC.

Why does my published package fail with ERR_PACKAGE_PATH_NOT_EXPORTED?

The exports map likely omits ./package.json or points to paths not covered by the files field, so targets are missing from the tarball. Neither npm pack nor npm install catches this; it only surfaces when a consumer imports that entry.

How do I verify an npm package works after publishing?

Install it in a different repository, ideally npm-based rather than pnpm, then import every entry in the exports map, build, and grep the build output to confirm the imported values reached the bundle. A green build alone does not prove the values landed.

Why does OIDC publishing silently fall back to NPM_TOKEN?

The id-token: write permission must be granted at both the caller job and the reusable workflow's publish job, since a called workflow cannot exceed the caller's permissions. Also check pnpm/action-setup versions, as v4.4.0 broke pnpm's OIDC publish.