Skip to main content
Version: Next

cngpac init

Initialize Cngpac for your project. This command scaffolds the configuration file and a CI workflow.

Usage

npx cngpac init

What It Does

  1. Detects your GitHub repository from package.json's repository field. If not found, prompts you for the owner and name.
  2. Creates cngpac.config.ts — a pre-configured release pipeline with:
    • Changelog generator (using GitHub API)
    • npm publisher (with provenance)
    • GitHub releaser
  3. Creates .github/workflows/version.yml — a GitHub Actions workflow that triggers on changes to .changenotes/prepare.json on the main branch.

Generated Files

FilePurpose
cngpac.config.tsRelease pipeline configuration
.github/workflows/version.ymlCI workflow for automated releases

Package Manager Detection

The command auto-detects your package manager from npm_config_user_agent and configures the CI workflow accordingly:

Package ManagerInstall CommandRuntime Action
npmnpm ciactions/setup-node@v6
pnpmpnpm install --frozen-lockfileactions/setup-node@v6
yarnyarn install --frozen-lockfileactions/setup-node@v6
bunbun install --frozen-lockfileoven-sh/setup-bun@v2

Behavior

  • If cngpac.config.ts already exists, the command skips it with a warning instead of overwriting.
  • Same for the CI workflow — existing files are never overwritten.

Example

$ npx cngpac init
◇ Initializing Cngpac
│ Detected repository: cngpac/cngpac
✔ Created cngpac.config.ts
✔ Created .github/workflows/version.yml
◇ Cngpac initialized!