Skip to content

Latest commit

 

History

History
112 lines (73 loc) · 3.13 KB

github-npm-package-strategy.md

File metadata and controls

112 lines (73 loc) · 3.13 KB

githubNpmPackageStrategy

A Strategy to publish NPM packages source controlled in GitHub.

This strategy will:

Some of the below commands will not be used when config syncRemote is false

demo

Config

Type: object literal

Optional properties are denoted by *

syncRemote*

Type: boolean
Default: false

This flag controls whether to commit and push the package.json
and, in case maintainChangelog is true, the changelog file as well.

Enabling this when the remote branch is protected will require a bypass.
See discussions/25305

stableBranchName*

Type: string
Default: main

When the branch name is equal to configured value the published npm dist tag is latest.
Additionally. this determines the GitHub prerelease flag. See "Create a release"

logger*

Type: Logger
Default: processStdoutLogger

release*

Type: Release
Default: git-tag-based-release

gitRemote*

Type: string
Default: origin

maintainChangelog*

Type: boolean
Default: false

gitActor*

Type: string
Default: process.env.RELEASE_ACTOR

A shorthand to perform Git commits using a specific author & committer email and name.

Example:

/*
 * The value must be in author format: "NAME <EMAIL>"
 */
{ gitActor: "bot <[email protected]>" }

// It is also possible to explicitly use the equivalent environment variables:
//
// GIT_COMMITTER_NAME: bot
// GIT_COMMITTER_EMAIL: [email protected]
// GIT_AUTHOR_NAME: bot
// GIT_AUTHOR_EMAIL: [email protected]

workingDirectory*

Type: string
Default: process.cwd()

changelogFilePath*

Type: string
Default: ${workingDirectory}/CHANGELOG.md

githubPersonalAccessToken*

Type: string
Default: process.env.GITHUB_PAT_TOKEN

The token to use when interacting with GitHub REST API

GitStrategy options are also applicable.

Example

const { SDK } = require("@abstracter/atomic-release");

SDK.githubNpmPackageStrategy().then(strategy => strategy.run());