@simple-release/npm v2.0.0
@simple-release/npm
A npm addon for simple-release.
Install
# pnpm
pnpm add @simple-release/npm
# yarn
yarn add @simple-release/npm
# npm
npm i @simple-release/npm
Usage
import { Releaser } from '@simple-release/core'
import { NpmProject } from '@simple-release/npm'
const project = new NpmProject()
await new Releaser(project)
.bump()
.commit()
.tag()
.push()
.publish()
.run()
Workspaces example:
import { Releaser } from '@simple-release/core'
import { NpmWorkspacesProject } from '@simple-release/npm'
const project = new NpmWorkspacesProject({
mode: 'independent'
})
await new Releaser(project)
.bump()
.commit()
.tag()
.push()
.publish()
.run()
NpmWorkspacesProject
will read workspaces from the package.json
in the root of the project.
Options
NpmProject
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 { NpmProject } from '@simple-release/npm'
new NpmProject({
compose: main => new ComposedProjectManifest(main, [
new SomeManifest(/* ... */)
])
})
NpmWorkspacesProject
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 { NpmProject } from '@simple-release/npm'
new NpmProject({
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 NpmProject
and NpmWorkspacesProject
.
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.
env
Environment variables to set before publishing. Defaults to process.env
.
9 days ago