# new ReleaseScript(options)
This script automates the process of creating and pushing new releases. It handles version updates, commit messages, and optionally publishes to NPM. The script supports semantic versioning and can work in both CI and non-CI environments.
A command-line script for managing releases and version updates.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object
|
Configuration options for the script |
ci |
boolean
|
Whether the script is running in a CI environment (default: true) |
message |
string
|
The release message (short: 'm') |
tag |
string
|
The version tag to use (short: 't', default: undefined) |
Extends
Members
Methods
# async protected checkRequirements() → {Promise.<void>}
Retrieves the list of dependencies and compares it against the required dependencies for the command.
Checks if all required dependencies are present.
- Overrides:
A promise that resolves when the check is complete.
Promise.<void>
# async execute() → {Promise.<(R|string|void)>}
This method handles the overall execution flow of the command, including parsing arguments, setting up logging, checking for version or help requests, and running the command.
Executes the command.
- Overrides:
A promise that resolves with the command's result.
Promise.<(R|string|void)>
# protected help(args) → {void}
This method should be overridden in derived classes to provide specific help information.
Provides help information for the command.
Parameters:
Name | Type | Description |
---|---|---|
args |
ParseArgsResult
|
The parsed command-line arguments. |
- Overrides:
void
# async prepareMessage(messageopt) → {Promise.<string>}
This method either returns the provided message or prompts the user for a new one if not provided.
Prepares the release message.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
string
|
<optional> |
The release message |
The prepared release message
Promise.<string>
# async prepareVersion(tag) → {Promise.<string>}
This method validates the provided tag or prompts the user for a new one if not provided or invalid. It also displays the latest git tags for reference.
Prepares the version for the release.
Parameters:
Name | Type | Description |
---|---|---|
tag |
string
|
The version tag to prepare |
The prepared version tag
Promise.<string>
# async run(args) → {Promise.<void>}
This method orchestrates the entire release process, including version preparation, message creation, git operations, and npm publishing (if not in CI environment).
Runs the release script.
Parameters:
Name | Type | Description |
---|---|---|
args |
ParseArgsResult
|
The parsed command-line arguments |
- Overrides:
Promise.<void>
# testVersion(version) → {string|undefined}
This method checks if the version is a valid semantic version or a predefined update type (PATCH, MINOR, MAJOR).
Tests if the provided version is valid.
Parameters:
Name | Type | Description |
---|---|---|
version |
string
|
The version to test |
The validated version or undefined if invalid
string
|
undefined