2.0.0 • Published 16 days ago

@simple-release/pnpm v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
16 days ago

@simple-release/pnpm

ESM-only package NPM version Node version Dependencies status Install size Build status Coverage status

A pnpm addon for simple-release.

Install

# pnpm
pnpm add @simple-release/pnpm
# yarn
yarn add @simple-release/pnpm
# npm
npm i @simple-release/pnpm

Usage

import { Releaser } from '@simple-release/core'
import { PnpmProject } from '@simple-release/pnpm'

const project = new PnpmProject()

await new Releaser(project)
  .bump()
  .commit()
  .tag()
  .push()
  .publish()
  .run()

Workspaces example:

import { Releaser } from '@simple-release/core'
import { PnpmWorkspacesProject } from '@simple-release/pnpm'

const project = new PnpmWorkspacesProject({
  mode: 'independent'
})

await new Releaser(project)
  .bump()
  .commit()
  .tag()
  .push()
  .publish()
  .run()

PnpmWorkspacesProject will read workspaces from the pnpm-workspace.yaml in the root of the project.

Options

PnpmProject

path

Path to the package.json manifest file. Defaults to 'package.json'.

changelogFile

Path to the changelog file. Defaults to 'CHANGELOG.md'.

compose

Function to compose the main manifest with secondaries. It can be needed if you have some secondary manifests where version also should be updated. Optional.

import { ComposedProjectManifest } from '@simple-release/core'
import { PnpmProject } from '@simple-release/pnpm'

new PnpmProject({
  compose: main => new ComposedProjectManifest(main, [
    new SomeManifest(/* ... */)
  ])
})

PnpmWorkspacesProject

mode

Mode to determine how to bump versions in the monorepo. Required.

  • independent - each package can have its own version.
  • fixed - all packages have the same version.

root

Path to the monorepo root. Defaults to the current working directory.

changelogFile

Path to the changelog file. Defaults to 'CHANGELOG.md'.

compose

Function to compose the main manifest with secondaries. It can be needed if you have some secondary manifests where version also should be updated. Will be called for each manifest in monorepo. Optional.

import { ComposedProjectManifest } from '@simple-release/core'
import { PnpmProject } from '@simple-release/pnpm'

new PnpmProject({
  compose: (main, isRoot) => (
    isRoot
      ? main
      : new ComposedProjectManifest(main, [
        new SomeManifest(/* ... */)
      ])
  )
})

scope

Function to format scope name from the package name. By default, scope part of the package name will dropped (@scope/pkg-name -> pkg-name).

tagPrefix

Function to format tag prefix from scope name. By default, tag prefix will be the scope name with @ sign (pkg-name -> pkg-name@) for independent mode and empty string for fixed mode.

publish

Publish options for PnpmProject and PnpmWorkspacesProject.

access

Access level for the package. Optional.

tag

String or function to format tag name. Function accepts version string and prerelease versions. Optional.

otp

One-time password for publishing. Optional.

gitChecks

Whether to run git checks before publishing. Defaults to true.

env

Environment variables to set before publishing. Defaults to process.env.