Compare commits
52
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95af1e40f9 | ||
|
|
f634b8c3ca | ||
|
|
d9e5bc0604 | ||
|
|
dd7d664aa1 | ||
|
|
cd6136d67e | ||
|
|
e62c83d805 | ||
|
|
5d78fa4045 | ||
|
|
b64855fc57 | ||
|
|
09bcf7a86d | ||
|
|
8e96b23a60 | ||
|
|
5535268ad0 | ||
|
|
7f971f3a4c | ||
|
|
e6366211bb | ||
|
|
f2a2deffc1 | ||
|
|
628e29e413 | ||
|
|
8fda7fd423 | ||
|
|
52d76a2a97 | ||
|
|
f092dd1e44 | ||
|
|
03aa7d0d50 | ||
|
|
bc146e49b1 | ||
|
|
5f9d1d17ab | ||
|
|
7ff71ad55f | ||
|
|
d3958b80bf | ||
|
|
4ae9209b1c | ||
|
|
32d0ab3003 | ||
|
|
0e0705937d | ||
|
|
b2b07bfc00 | ||
|
|
2ef403eb98 | ||
|
|
0d0e0a1d8f | ||
|
|
1e54e9e79a | ||
|
|
aa866838a8 | ||
|
|
8db804b7dc | ||
|
|
a50dc996b5 | ||
|
|
0495cb67b2 | ||
|
|
74671f809c | ||
|
|
7faa7993eb | ||
|
|
f79e27f588 | ||
|
|
685d2b5455 | ||
|
|
0ce4846b68 | ||
|
|
eb32d79ce4 | ||
|
|
20034829d9 | ||
|
|
66cc2b4c7f | ||
|
|
1632e1adac | ||
|
|
0390af32b6 | ||
|
|
e58b76e700 | ||
|
|
5e228a1cd1 | ||
|
|
23d2bc2842 | ||
|
|
b4200b05cd | ||
|
|
ea52e1775a | ||
|
|
5edff69580 | ||
|
|
6e4beb8314 | ||
|
|
ebad322318 |
@@ -1,12 +1,11 @@
|
||||
name: Release
|
||||
on:
|
||||
"on":
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- next
|
||||
- beta
|
||||
- "*.x" # maintenance releases branches
|
||||
|
||||
- "*.x"
|
||||
jobs:
|
||||
release:
|
||||
name: release
|
||||
@@ -16,6 +15,7 @@ jobs:
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
cache: npm
|
||||
node-version: 16
|
||||
- run: npm ci
|
||||
- run: npx semantic-release
|
||||
env:
|
||||
|
||||
@@ -18,7 +18,8 @@ jobs:
|
||||
matrix:
|
||||
node-version:
|
||||
- 14.17
|
||||
- 16
|
||||
- 16.0.0
|
||||
- 17
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -31,8 +32,6 @@ jobs:
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: npm
|
||||
- name: Ensure dependencies are compatible with the version of node
|
||||
run: echo 'engine-strict=true' >> .npmrc
|
||||
- run: npm ci
|
||||
- run: npm run test:ci
|
||||
|
||||
@@ -45,6 +44,9 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16
|
||||
cache: npm
|
||||
- run: npm ci
|
||||
- name: Ensure dependencies are compatible with the version of node
|
||||
run: npx ls-engines@0.4
|
||||
- run: npm run lint
|
||||
|
||||
+32
-16
@@ -20,45 +20,55 @@ Help us keep **semantic-release** open and inclusive. Please read and follow our
|
||||
|
||||
### Improve documentation
|
||||
|
||||
As a **semantic-release** user, you are the perfect candidate to help us improve our documentation: typo corrections, clarifications, more examples, new [recipes](docs/recipes/README.md), etc. Take a look at the [documentation issues that need help](https://github.com/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+user%3Asemantic-release+archived%3Afalse+label%3A%22help+wanted%22+label%3Adocs+).
|
||||
As a **semantic-release** user, you are the perfect candidate to help us improve our documentation: typo corrections, clarifications, more examples, new [recipes](docs/recipes), etc. Take a look at the [documentation issues that need help](https://github.com/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+user%3Asemantic-release+archived%3Afalse+label%3A%22help+wanted%22+label%3Adocs+).
|
||||
|
||||
Please follow the [Documentation guidelines](#documentation).
|
||||
|
||||
### Give feedback on issues
|
||||
|
||||
Some issues are created without information requested in the [Bug report guideline](#bug-report). Help make them easier to resolve by adding any relevant information.
|
||||
Some issues are created without information requested in the [Bug report guideline](#bug-report).
|
||||
Help make them easier to resolve by adding any relevant information.
|
||||
|
||||
Issues with the [design label](https://github.com/issues?q=is%3Aopen+is%3Aissue+user%3Asemantic-release+archived%3Afalse+label%3Adesign) are meant to discuss the implementation of new features. Participating in the discussion is a good opportunity to get involved and influence the future direction of **semantic-release**.
|
||||
Issues with the [design label](https://github.com/issues?q=is%3Aopen+is%3Aissue+user%3Asemantic-release+archived%3Afalse+label%3Adesign) are meant to discuss the implementation of new features.
|
||||
Participating in the discussion is a good opportunity to get involved and influence the future direction of **semantic-release**.
|
||||
|
||||
### Fix bugs and implement features
|
||||
|
||||
Confirmed bugs and ready-to-implement features are marked with the [help wanted label](https://github.com/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+user%3Asemantic-release+archived%3Afalse+label%3A%22help+wanted%22). Post a comment on an issue to indicate you would like to work on it and to request help from the [@semantic-release/maintainers](https://github.com/orgs/semantic-release/teams/contributors) and the community.
|
||||
Confirmed bugs and ready-to-implement features are marked with the [help wanted label](https://github.com/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+user%3Asemantic-release+archived%3Afalse+label%3A%22help+wanted%22).
|
||||
Post a comment on an issue to indicate you would like to work on it and to request help from the [@semantic-release/maintainers](https://github.com/orgs/semantic-release/teams/contributors) and the community.
|
||||
|
||||
## Using the issue tracker
|
||||
|
||||
The issue tracker is the channel for [bug reports](#bug-report), [features requests](#feature-request) and [submitting pull requests](#submitting-a-pull-request) only. Please use the [Support](docs/support/README.md) and [Get help](README.md#get-help) sections for support, troubleshooting and questions.
|
||||
The issue tracker is the channel for [bug reports](#bug-report), [features requests](#feature-request) and [submitting pull requests](#submitting-a-pull-request) only.
|
||||
Please use the [Support](docs/support/README.md) and [Get help](README.md#get-help) sections for support, troubleshooting and questions.
|
||||
|
||||
Before opening an issue or a Pull Request, please use the [GitHub issue search](https://github.com/issues?utf8=%E2%9C%93&q=user%3Asemantic-release) to make sure the bug or feature request hasn't been already reported or fixed.
|
||||
|
||||
### Bug report
|
||||
|
||||
A good bug report shouldn't leave others needing to chase you for more information. Please try to be as detailed as possible in your report and fill the information requested in the [Bug report template](https://github.com/semantic-release/semantic-release/issues/new?template=bug-report.md).
|
||||
A good bug report shouldn't leave others needing to chase you for more information.
|
||||
Please try to be as detailed as possible in your report and fill the information requested in the [bug report template](https://github.com/semantic-release/semantic-release/issues/new?template=01_bug_report.md).
|
||||
|
||||
### Feature request
|
||||
|
||||
Feature requests are welcome, but take a moment to find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible and fill the information requested in the [Feature request template](https://github.com/semantic-release/semantic-release/issues/new?template=feature-request.md).
|
||||
Feature requests are welcome, but take a moment to find out whether your idea fits with the scope and aims of the project.
|
||||
It's up to you to make a strong case to convince the project's developers of the merits of this feature.
|
||||
Please provide as much detail and context as possible and fill the information requested in the [feature request template](https://github.com/semantic-release/semantic-release/issues/new?template=02_feature_request.md).
|
||||
|
||||
### New plugin request
|
||||
|
||||
[Plugins](docs/usage/plugins.md) are a great way to extend **semantic-release** capabilities, integrate with other systems and support new project type. Please provide as much detail and context as possible and fill the information requested in the [New plugin request template](https://github.com/semantic-release/semantic-release/issues/new?template=plugin-request.md).
|
||||
[Plugins](docs/usage/plugins.md) are a great way to extend **semantic-release** capabilities, integrate with other systems and support new project type.
|
||||
Please provide as much detail and context as possible and fill the information requested in the [plugin suggestion template](https://github.com/semantic-release/semantic-release/issues/new?template=03_plugin_suggestion.md).
|
||||
|
||||
## Submitting a Pull Request
|
||||
|
||||
Good pull requests, whether patches, improvements, or new features, are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
|
||||
Good pull requests, whether patches, improvements, or new features, are a fantastic help.
|
||||
They should remain focused in scope and avoid containing unrelated commits.
|
||||
|
||||
**Please ask first** before embarking on any significant pull requests (e.g. implementing features, refactoring code), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.
|
||||
**Please ask first** before embarking on any significant pull requests (e.g. implementing features, refactoring code), otherwise you risk spending a lot of time working on something that the project's maintainers might not want to merge into the project.
|
||||
|
||||
If you have never created a pull request before, welcome 🎉 😄. [Here is a great tutorial](https://opensource.guide/how-to-contribute/#opening-a-pull-request) on how to send one :)
|
||||
If you have never created a pull request before, welcome 🎉 😄.
|
||||
[Here is a great tutorial](https://opensource.guide/how-to-contribute/#opening-a-pull-request) on how to send one :)
|
||||
|
||||
Here is a summary of the steps to follow:
|
||||
|
||||
@@ -83,7 +93,9 @@ $ git push origin <topic-branch-name>
|
||||
|
||||
**Tips**:
|
||||
- For ambitious tasks, open a Pull Request as soon as possible with the `[WIP]` prefix in the title, in order to get feedback and help from the community.
|
||||
- [Allow semantic-release maintainers to make changes to your Pull Request branch](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork). This way, we can rebase it and make some minor changes if necessary. All changes we make will be done in new commit and we'll ask for your approval before merging them.
|
||||
- [Allow semantic-release maintainers to make changes to your Pull Request branch](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork).
|
||||
This way, we can rebase it and make some minor changes if necessary.
|
||||
All changes we make will be done in new commit, and we'll ask for your approval before merging them.
|
||||
|
||||
## Coding rules
|
||||
|
||||
@@ -129,7 +141,8 @@ A complex feature can be broken down into multiple commits as long as each one m
|
||||
|
||||
#### Commit message format
|
||||
|
||||
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special format that includes a **type**, a **scope** and a **subject**:
|
||||
Each commit message consists of a **header**, a **body** and a **footer**.
|
||||
The header has a special format that includes a **type**, a **scope** and a **subject**:
|
||||
|
||||
```commit
|
||||
<type>(<scope>): <subject>
|
||||
@@ -145,7 +158,8 @@ The **footer** can contain a [closing reference to an issue](https://help.github
|
||||
|
||||
#### Revert
|
||||
|
||||
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
|
||||
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit.
|
||||
In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
|
||||
|
||||
#### Type
|
||||
|
||||
@@ -178,7 +192,8 @@ The body should include the motivation for the change and contrast this with pre
|
||||
#### Footer
|
||||
The footer should contain any information about **Breaking Changes** and is also the place to reference GitHub issues that this commit **Closes**.
|
||||
|
||||
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.
|
||||
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines.
|
||||
The rest of the commit message is then used for this.
|
||||
|
||||
#### Examples
|
||||
|
||||
@@ -219,7 +234,8 @@ $ npm install
|
||||
|
||||
### Lint
|
||||
|
||||
All the [semantic-release](https://github.com/semantic-release) repositories use [XO](https://github.com/sindresorhus/xo) for linting and [Prettier](https://prettier.io) for formatting. Prettier formatting will be automatically verified and fixed by XO.
|
||||
All the [semantic-release](https://github.com/semantic-release) repositories use [XO](https://github.com/sindresorhus/xo) for linting and [Prettier](https://prettier.io) for formatting.
|
||||
Prettier formatting will be automatically verified and fixed by XO.
|
||||
|
||||
Before pushing your code changes make sure there are no linting errors with `npm run lint`.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<img alt="Build states" src="https://github.com/semantic-release/semantic-release/workflows/Test/badge.svg">
|
||||
</a>
|
||||
<a href="#badge">
|
||||
<img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
|
||||
<img alt="semantic-release: angular" src="https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release">
|
||||
</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
@@ -23,9 +23,9 @@
|
||||
</a>
|
||||
</p>
|
||||
|
||||
**semantic-release** automates the whole package release workflow including: determining the next version number, generating the release notes and publishing the package.
|
||||
**semantic-release** automates the whole package release workflow including: determining the next version number, generating the release notes, and publishing the package.
|
||||
|
||||
This removes the immediate connection between human emotions and version numbers, strictly following the [Semantic Versioning](http://semver.org) specification.
|
||||
This removes the immediate connection between human emotions and version numbers, strictly following the [Semantic Versioning](http://semver.org) specification and communicating the **impact** of changes to consumers.
|
||||
|
||||
> Trust us, this will change your workflow for the better. – [egghead.io](https://egghead.io/lessons/javascript-how-to-write-a-javascript-library-automating-releases-with-semantic-release)
|
||||
|
||||
@@ -37,18 +37,20 @@ This removes the immediate connection between human emotions and version numbers
|
||||
- Notify maintainers and users of new releases
|
||||
- Use formalized commit message convention to document changes in the codebase
|
||||
- Publish on different distribution channels (such as [npm dist-tags](https://docs.npmjs.com/cli/dist-tag)) based on git merges
|
||||
- Integrate with your [continuous integration workflow](docs/recipes/README.md#ci-configurations)
|
||||
- Integrate with your [continuous integration workflow](docs/recipes/release-workflow/README.md#ci-configurations)
|
||||
- Avoid potential errors associated with manual releases
|
||||
- Support any [package managers and languages](docs/recipes/README.md#package-managers-and-languages) via [plugins](docs/usage/plugins.md)
|
||||
- Support any [package managers and languages](docs/recipes/release-workflow/README.md#package-managers-and-languages) via [plugins](docs/usage/plugins.md)
|
||||
- Simple and reusable configuration via [shareable configurations](docs/usage/shareable-configurations.md)
|
||||
|
||||
## How does it work?
|
||||
|
||||
### Commit message format
|
||||
|
||||
**semantic-release** uses the commit messages to determine the type of changes in the codebase. Following formalized conventions for commit messages, **semantic-release** automatically determines the next [semantic version](https://semver.org) number, generates a changelog and publishes the release.
|
||||
**semantic-release** uses the commit messages to determine the consumer impact of changes in the codebase.
|
||||
Following formalized conventions for commit messages, **semantic-release** automatically determines the next [semantic version](https://semver.org) number, generates a changelog and publishes the release.
|
||||
|
||||
By default **semantic-release** uses [Angular Commit Message Conventions](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format). The commit message format can be changed with the [`preset` or `config` options](docs/usage/configuration.md#options) of the [@semantic-release/commit-analyzer](https://github.com/semantic-release/commit-analyzer#options) and [@semantic-release/release-notes-generator](https://github.com/semantic-release/release-notes-generator#options) plugins.
|
||||
By default, **semantic-release** uses [Angular Commit Message Conventions](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format).
|
||||
The commit message format can be changed with the [`preset` or `config` options](docs/usage/configuration.md#options) of the [@semantic-release/commit-analyzer](https://github.com/semantic-release/commit-analyzer#options) and [@semantic-release/release-notes-generator](https://github.com/semantic-release/release-notes-generator#options) plugins.
|
||||
|
||||
Tools such as [commitizen](https://github.com/commitizen/cz-cli) or [commitlint](https://github.com/conventional-changelog/commitlint) can be used to help contributors and enforce valid commit messages.
|
||||
|
||||
@@ -56,23 +58,25 @@ The table below shows which commit message gets you which release type when `sem
|
||||
|
||||
| Commit message | Release type |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------- |
|
||||
| `fix(pencil): stop graphite breaking when too much pressure applied` | Patch Release |
|
||||
| `fix(pencil): stop graphite breaking when too much pressure applied` | ~~Patch~~ Fix Release |
|
||||
| `feat(pencil): add 'graphiteWidth' option` | ~~Minor~~ Feature Release |
|
||||
| `perf(pencil): remove graphiteWidth option`<br><br>`BREAKING CHANGE: The graphiteWidth option has been removed.`<br>`The default graphite width of 10mm is always used for performance reasons.` | ~~Major~~ Breaking Release |
|
||||
| `perf(pencil): remove graphiteWidth option`<br><br>`BREAKING CHANGE: The graphiteWidth option has been removed.`<br>`The default graphite width of 10mm is always used for performance reasons.` | ~~Major~~ Breaking Release <br /> (Note that the `BREAKING CHANGE: ` token must be in the footer of the commit) |
|
||||
|
||||
### Automation with CI
|
||||
|
||||
**semantic-release** is meant to be executed on the CI environment after every successful build on the release branch. This way no human is directly involved in the release process and the releases are guaranteed to be [unromantic and unsentimental](http://sentimentalversioning.org).
|
||||
**semantic-release** is meant to be executed on the CI environment after every successful build on the release branch.
|
||||
This way no human is directly involved in the release process and the releases are guaranteed to be [unromantic and unsentimental](http://sentimentalversioning.org).
|
||||
|
||||
### Triggering a release
|
||||
|
||||
For each new commits added to one of the release branches (for example `master`, `next`, `beta`), with `git push` or by merging a pull request or merging from another branch, a CI build is triggered and runs the `semantic-release` command to make a release if there are codebase changes since the last release that affect the package functionalities.
|
||||
For each new commit added to one of the release branches (for example: `master`, `next`, `beta`), with `git push` or by merging a pull request or merging from another branch, a CI build is triggered and runs the `semantic-release` command to make a release if there are codebase changes since the last release that affect the package functionalities.
|
||||
|
||||
**semantic-release** offers various ways to control the timing, the content and the audience of published releases. See example workflows in the following recipes:
|
||||
**semantic-release** offers various ways to control the timing, the content and the audience of published releases.
|
||||
See example workflows in the following recipes:
|
||||
|
||||
- [Using distribution channels](docs/recipes/distribution-channels.md#publishing-on-distribution-channels)
|
||||
- [Maintenance releases](docs/recipes/maintenance-releases.md#publishing-maintenance-releases)
|
||||
- [Pre-releases](docs/recipes/pre-releases.md#publishing-pre-releases)
|
||||
- [Using distribution channels](docs/recipes/release-workflow/distribution-channels.md#publishing-on-distribution-channels)
|
||||
- [Maintenance releases](docs/recipes/release-workflow/maintenance-releases.md#publishing-maintenance-releases)
|
||||
- [Pre-releases](docs/recipes/release-workflow/pre-releases.md#publishing-pre-releases)
|
||||
|
||||
### Release steps
|
||||
|
||||
@@ -96,8 +100,8 @@ In order to use **semantic-release** you need:
|
||||
|
||||
- To host your code in a [Git repository](https://git-scm.com)
|
||||
- Use a Continuous Integration service that allows you to [securely set up credentials](docs/usage/ci-configuration.md#authentication)
|
||||
- Git CLI version [2.7.1 or higher](docs/support/FAQ.md#why-does-semantic-release-require-git-version--271) installed in your Continuous Integration environment
|
||||
- [Node.js](https://nodejs.org) version [14.17 or higher](docs/support/FAQ.md#why-does-semantic-release-require-node-version--1417) installed in your Continuous Integration environment
|
||||
- A Git CLI version that meets [our version requirement](docs/support/git-version.md) installed in your Continuous Integration environment
|
||||
- A [Node.js](https://nodejs.org) version that meets [our version requirement](docs/support/node-version.md) installed in your Continuous Integration environment
|
||||
|
||||
## Documentation
|
||||
|
||||
@@ -113,10 +117,9 @@ In order to use **semantic-release** you need:
|
||||
- [Plugins](docs/extending/plugins-list.md)
|
||||
- [Shareable configuration](docs/extending/shareable-configurations-list.md)
|
||||
- Recipes
|
||||
- [CI configurations](docs/recipes/README.md)
|
||||
- [Git hosted services](docs/recipes/README.md)
|
||||
- [Release workflow](docs/recipes/README.md)
|
||||
- [Package managers and languages](docs/recipes/README.md)
|
||||
- [CI configurations](docs/recipes/ci-configurations/README.md)
|
||||
- [Git hosted services](docs/recipes/git-hosted-services/README.md)
|
||||
- [Release workflow](docs/recipes/release-workflow/README.md)
|
||||
- Developer guide
|
||||
- [JavaScript API](docs/developer-guide/js-api.md)
|
||||
- [Plugins development](docs/developer-guide/plugin.md)
|
||||
@@ -130,18 +133,19 @@ In order to use **semantic-release** you need:
|
||||
|
||||
## Get help
|
||||
|
||||
- [Stack Overflow](https://stackoverflow.com/questions/tagged/semantic-release)
|
||||
- [GitHub Discussions](https://github.com/semantic-release/semantic-release/discussions)
|
||||
- [Stack Overflow](https://stackoverflow.com/questions/tagged/semantic-release)
|
||||
- [Twitter](https://twitter.com/SemanticRelease)
|
||||
|
||||
## Badge
|
||||
|
||||
Let people know that your package is published using **semantic-release** by including this badge in your readme.
|
||||
Let people know that your package is published using **semantic-release** and which [commit-convention](#commit-message-format) is followed by including this badge in your readme.
|
||||
|
||||
[](https://github.com/semantic-release/semantic-release)
|
||||
[](https://github.com/semantic-release/semantic-release)
|
||||
|
||||
```md
|
||||
[](https://github.com/semantic-release/semantic-release)
|
||||
[](https://github.com/semantic-release/semantic-release)
|
||||
|
||||
```
|
||||
|
||||
## Team
|
||||
|
||||
+13
-7
@@ -14,13 +14,18 @@
|
||||
- [Shareable configuration](docs/extending/shareable-configurations-list.md)
|
||||
|
||||
## Recipes
|
||||
- [CI configurations](docs/recipes/README.md#ci-configurations)
|
||||
- [CircleCI 2.0](docs/recipes/circleci-workflows.md)
|
||||
- [Travis CI](docs/recipes/travis.md)
|
||||
- [GitLab CI](docs/recipes/gitlab-ci.md)
|
||||
- [Git hosted services](docs/recipes/README.md#git-hosted-services)
|
||||
- [Git authentication with SSH keys](docs/recipes/git-auth-ssh-keys.md)
|
||||
- [Package managers and languages](docs/recipes/README.md#package-managers-and-languages)
|
||||
- [CI configurations](docs/recipes/ci-configurations/README.md)
|
||||
- [CircleCI 2.0](docs/recipes/ci-configurations/circleci-workflows.md)
|
||||
- [Travis CI](docs/recipes/ci-configurations/travis.md)
|
||||
- [GitLab CI](docs/recipes/ci-configurations/gitlab-ci.md)
|
||||
- [GitHub Actions](docs/recipes/ci-configurations/github-actions.md)
|
||||
- [Jenkins CI](docs/recipes/ci-configurations/jenkins-ci.md)
|
||||
- [Git hosted services](docs/recipes/git-hosted-services/README.md)
|
||||
- [Git authentication with SSH keys](docs/recipes/git-hosted-services/git-auth-ssh-keys.md)
|
||||
- [Release Workflow](docs/recipes/release-workflow/README.md)
|
||||
- [Publishing on distribution channels](docs/recipes/release-workflow/distribution-channels.md)
|
||||
- [Publishing maintenance releases](docs/recipes/release-workflow/maintenance-releases.md)
|
||||
- [Publishing pre-releases](docs/recipes/release-workflow/pre-releases.md)
|
||||
|
||||
## Developer guide
|
||||
- [JavaScript API](docs/developer-guide/js-api.md)
|
||||
@@ -33,3 +38,4 @@
|
||||
- [Troubleshooting](docs/support/troubleshooting.md)
|
||||
- [Node version requirement](docs/support/node-version.md)
|
||||
- [Node Support Policy](docs/support/node-support-policy.md)
|
||||
- [Git version requirement](docs/support/git-version.md)
|
||||
|
||||
+12
-7
@@ -1,11 +1,16 @@
|
||||
#!/usr/bin/env node// Bad news: We have to write plain ES5 in this file
|
||||
import semver from 'semver';
|
||||
#!/usr/bin/env node
|
||||
|
||||
import execa from 'execa';
|
||||
import findVersions from 'find-versions';
|
||||
import pkg from '../package.json';
|
||||
// Bad news: We have to write plain ES5 in this file
|
||||
// Good news: It's the only file of the entire project
|
||||
|
||||
const MIN_GIT_VERSION = '2.7.1';
|
||||
/* eslint-disable no-var */
|
||||
|
||||
var semver = require('semver');
|
||||
var execa = require('execa');
|
||||
var findVersions = require('find-versions');
|
||||
var pkg = require('../package.json');
|
||||
|
||||
var MIN_GIT_VERSION = '2.7.1';
|
||||
|
||||
if (!semver.satisfies(process.version, pkg.engines.node)) {
|
||||
console.error(
|
||||
@@ -18,7 +23,7 @@ See https://github.com/semantic-release/semantic-release/blob/master/docs/suppor
|
||||
|
||||
execa('git', ['--version'])
|
||||
.then(({stdout}) => {
|
||||
const gitVersion = findVersions(stdout)[0];
|
||||
var gitVersion = findVersions(stdout)[0];
|
||||
if (semver.lt(gitVersion, MIN_GIT_VERSION)) {
|
||||
console.error(`[semantic-release]: Git version ${MIN_GIT_VERSION} is required. Found ${gitVersion}.`);
|
||||
process.exit(1);
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import util from 'util';
|
||||
import hideSensitive from './lib/hide-sensitive';
|
||||
import yargs from 'yargs';
|
||||
import debug from 'debug';
|
||||
|
||||
import run from '.';
|
||||
const {argv, env, stderr} = require('process'); // eslint-disable-line node/prefer-global/process
|
||||
const util = require('util');
|
||||
const hideSensitive = require('./lib/hide-sensitive');
|
||||
|
||||
const stringList = {
|
||||
type: 'string',
|
||||
@@ -14,8 +11,8 @@ const stringList = {
|
||||
: values.reduce((values, value) => values.concat(value.split(',').map((value) => value.trim())), []),
|
||||
};
|
||||
|
||||
export default async () => {
|
||||
const cli = yargs
|
||||
module.exports = async () => {
|
||||
const cli = require('yargs')
|
||||
.command('$0', 'Run automated package publishing', (yargs) => {
|
||||
yargs.demandCommand(0, 0).usage(`Run automated package publishing
|
||||
|
||||
@@ -44,7 +41,7 @@ Usage:
|
||||
.exitProcess(false);
|
||||
|
||||
try {
|
||||
const {help, version, ...options} = cli.parse(process.argv.slice(2));
|
||||
const {help, version, ...options} = cli.parse(argv.slice(2));
|
||||
|
||||
if (Boolean(help) || Boolean(version)) {
|
||||
return 0;
|
||||
@@ -52,14 +49,14 @@ Usage:
|
||||
|
||||
if (options.debug) {
|
||||
// Debug must be enabled before other requires in order to work
|
||||
debug.enable('semantic-release:*');
|
||||
require('debug').enable('semantic-release:*');
|
||||
}
|
||||
|
||||
await run(options);
|
||||
await require('.')(options);
|
||||
return 0;
|
||||
} catch (error) {
|
||||
if (error.name !== 'YError') {
|
||||
process.stderr.write(hideSensitive(process.env)(util.inspect(error, {colors: true})));
|
||||
stderr.write(hideSensitive(env)(util.inspect(error, {colors: true})));
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@
|
||||
|
||||
- [Usage](usage/README.md) - **semantic-release** installation and configuration
|
||||
- [Extending](extending/README.md) - Extending **semantic-release** with plugins and shareable configurations
|
||||
- [Recipes](recipes/README.md) - Community written recipes for common **semantic-release** use-cases
|
||||
- [Recipes](recipes/release-workflow/README.md) - Community written recipes for common **semantic-release** use-cases
|
||||
- [Developer Guide](developer-guide/README.md) - The essentials of writing a **semantic-release** plugin or shareable configurations
|
||||
- [Support](support/README.md) - FAQ and troubleshooting
|
||||
|
||||
@@ -34,7 +34,7 @@ We recommend you setup a linting system to ensure good javascript practices are
|
||||
In your `index.js` file, you can start by writing the following code
|
||||
|
||||
```javascript
|
||||
const verifyConditions = require('./src/verify');
|
||||
const verify = require('./src/verify');
|
||||
|
||||
let verified;
|
||||
|
||||
@@ -43,12 +43,12 @@ let verified;
|
||||
* @param {*} pluginConfig The semantic-release plugin config
|
||||
* @param {*} context The context provided by semantic-release
|
||||
*/
|
||||
async function verify(pluginConfig, context) {
|
||||
await verifyConditions(pluginConfig, context);
|
||||
async function verifyConditions(pluginConfig, context) {
|
||||
await verify(pluginConfig, context);
|
||||
verified = true;
|
||||
}
|
||||
|
||||
module.exports = { verify };
|
||||
module.exports = { verifyConditions };
|
||||
```
|
||||
|
||||
Then, in your `src` folder, create a file called `verify.js` and add the following
|
||||
@@ -237,6 +237,20 @@ if (env.GITHUB_TOKEN) {
|
||||
//...
|
||||
}
|
||||
```
|
||||
## Logger
|
||||
Use `context.logger` to provide debug logging in the plugin.
|
||||
|
||||
```js
|
||||
const { logger } = context;
|
||||
|
||||
logger.log('Some message from plugin.').
|
||||
```
|
||||
|
||||
The above usage yields the following where `PLUGIN_PACKAGE_NAME` is automatically inferred.
|
||||
|
||||
```
|
||||
[3:24:04 PM] [semantic-release] [PLUGIN_PACKAGE_NAME] › ℹ Some message from plugin.
|
||||
```
|
||||
|
||||
## Execution order
|
||||
|
||||
|
||||
@@ -54,7 +54,8 @@
|
||||
- `publish`: Tag the image specified by `name` with the new version, push it to Docker Hub and update the latest tag
|
||||
- [@semantic-release-plus/docker](https://github.com/semantic-release-plus/semantic-release-plus/tree/master/packages/plugins/docker)
|
||||
- `verifyConditions`: Verify that all needed configuration is present and login to the configured docker registry.
|
||||
- `publish`: Tag the image specified by `name` with the new version, push it to the configured docker registry and update the `latest`, `major`, `minor` tags based on the configuration settings.
|
||||
- `publish`: Tag the image specified by `name` with the new version and channel and push it to the configured docker registry.
|
||||
- `addChannel`: Updates a release published on one channel with the destinations channel tag and pushes to the registry ie: next to latest.
|
||||
- [semantic-release-gcr](https://github.com/carlos-cubas/semantic-release-gcr)
|
||||
- `verifyConditions`: Verify that all needed configuration is present and login to the Docker registry
|
||||
- `publish`: Tag the image specified by `name` with the new version, push it to Docker Hub and update the latest tag
|
||||
@@ -140,3 +141,19 @@
|
||||
- `verifyConditions`: Validate configuration and verify ```HEROKU_API_KEY```
|
||||
- `prepare`: Update the package.json version and create release tarball
|
||||
- `publish`: Publish version to heroku
|
||||
- [semantic-release-mattermost](https://github.com/ttrobisch/semantic-release-mattermost)
|
||||
- `verifyConditions`: Verify that the webhook is setup and release-notes-generator is present.
|
||||
- `success`: Send a message about the new release and its notes to a [mattermost](https://mattermost.com/) webhook.
|
||||
- [semantic-release-github-milestones](https://github.com/nitzano/semantic-release-github-milestones)
|
||||
- `verifyConditions`: Verify github tokens are present and valid.
|
||||
- `verifyRelease`: Display information regarding the matching github milestone.
|
||||
- [semantic-release-telegram-bot](https://github.com/skoropadas/semantic-release-telegram-bot)
|
||||
- `verifyConditions`: Validate configuration and verify `TELEGRAM_BOT_TOKEN` and package name
|
||||
- `success`: Publish a success message to certain telegram chats
|
||||
- `fail`: Publish a fail message to certain telegram chats
|
||||
- [semantic-release-npm-deprecate](https://github.com/jpoehnelt/semantic-release-npm-deprecate)
|
||||
- `publish`: Automatically mark old versions as deprecated.
|
||||
- [@eshepelyuk/semantic-release-helm-oci](https://github.com/eshepelyuk/semantic-release-helm-oci)
|
||||
- `verifyConditions`: Verify plugin configuration and login to Helm registry
|
||||
- `prepare`: Package Helm chart to local folder
|
||||
- `publish`: Publish Helm chart to OCI registry
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
# Recipes
|
||||
|
||||
## CI configurations
|
||||
- [CircleCI 2.0 workflows](circleci-workflows.md)
|
||||
- [Travis CI](travis.md)
|
||||
- [GitLab CI](gitlab-ci.md)
|
||||
- [GitHub Actions](github-actions.md)
|
||||
- [Jenkins CI](jenkins-ci.md)
|
||||
|
||||
## Git hosted services
|
||||
- [Git authentication with SSH keys](git-auth-ssh-keys.md)
|
||||
|
||||
## Release workflow
|
||||
- [Publishing on distribution channels](distribution-channels.md)
|
||||
- [Publishing maintenance releases](maintenance-releases.md)
|
||||
- [Publishing pre-releases](pre-releases.md)
|
||||
|
||||
## Package managers and languages
|
||||
@@ -0,0 +1,6 @@
|
||||
# CI configurations
|
||||
- [CircleCI 2.0 workflows](circleci-workflows.md)
|
||||
- [Travis CI](travis.md)
|
||||
- [GitLab CI](gitlab-ci.md)
|
||||
- [GitHub Actions](github-actions.md)
|
||||
- [Jenkins CI](jenkins-ci.md)
|
||||
+9
-16
@@ -2,19 +2,22 @@
|
||||
|
||||
## Environment variables
|
||||
|
||||
The [Authentication](../usage/ci-configuration.md#authentication) environment variables can be configured in [CircleCi Project Settings](https://circleci.com/docs/2.0/env-vars/#adding-environment-variables-in-the-app)..
|
||||
The [Authentication](../../usage/ci-configuration.md#authentication) environment variables can be configured in [CircleCi Project Settings](https://circleci.com/docs/2.0/env-vars/#adding-environment-variables-in-the-app)..
|
||||
|
||||
Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with semantic-release-cli](../usage/getting-started.md#getting-started).
|
||||
Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with semantic-release-cli](../../usage/getting-started.md#getting-started).
|
||||
|
||||
## Multiple Node jobs configuration
|
||||
|
||||
### `.circleci/config.yml` configuration for multiple Node jobs
|
||||
|
||||
This example is a minimal configuration for **semantic-release** with tests running against Node 16 and 14. See [CircleCI documentation](https://circleci.com/docs/2.0) for additional configuration options.
|
||||
This example is a minimal configuration for **semantic-release** with tests running against Node 16 and 14.
|
||||
See [CircleCI documentation](https://circleci.com/docs/2.0) for additional configuration options.
|
||||
|
||||
In this example, the [`circleci/node`](https://circleci.com/developer/orbs/orb/circleci/node) orb is imported (Which makes some node operations easier), then a `release` job is defined which will run `semantic-release`.
|
||||
|
||||
To run our `release` job, we have created a workflow named `test_and_release` which will run two jobs, `node/test`, which comes from the node orb and will test our application, and our release job. Here, we are actually making use of [matrix jobs](https://circleci.com/blog/circleci-matrix-jobs/) so that our single `node/test` job will actually be executed twice, once for Node version 16, and once for version 14. Finally, we call our release job with a `requires` parameter so that `release` will only run after `node/test` has successfully tested against v14 and v16.
|
||||
To run our `release` job, we have created a workflow named `test_and_release` which will run two jobs, `node/test`, which comes from the node orb and will test our application, and our release job.
|
||||
Here, we are actually making use of [matrix jobs](https://circleci.com/blog/circleci-matrix-jobs/) so that our single `node/test` job will actually be executed twice, once for Node version 16, and once for version 14.
|
||||
Finally, we call our release job with a `requires` parameter so that `release` will run against the latest LTS version of node, only after `node/test` has successfully tested against v14 and v16.
|
||||
|
||||
```yaml
|
||||
version: 2.1
|
||||
@@ -25,6 +28,8 @@ jobs:
|
||||
executor: node/default
|
||||
steps:
|
||||
- checkout
|
||||
- node/install
|
||||
lts: true
|
||||
- node/install-packages # Install and automatically cache packages
|
||||
# Run optional required steps before releasing
|
||||
# - run: npm run build-script
|
||||
@@ -44,15 +49,3 @@ workflows:
|
||||
requires:
|
||||
- node/test
|
||||
```
|
||||
|
||||
### `package.json` configuration for multiple Node jobs
|
||||
|
||||
A `package.json` is required only for [local](../usage/installation.md#local-installation) **semantic-release** installation.
|
||||
|
||||
```json
|
||||
{
|
||||
"devDependencies": {
|
||||
"semantic-release": "^18.0.0"
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## Environment variables
|
||||
|
||||
The [Authentication](../usage/ci-configuration.md#authentication) environment variables can be configured with [Secret Variables](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables).
|
||||
The [Authentication](../../usage/ci-configuration.md#authentication) environment variables can be configured with [Secret Variables](https://docs.github.com/en/actions/reference/encrypted-secrets).
|
||||
|
||||
In this example a publish type [`NPM_TOKEN`](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) is required to publish a package to the npm registry. GitHub Actions [automatically populate](https://help.github.com/en/articles/virtual-environments-for-github-actions#github_token-secret) a [`GITHUB_TOKEN`](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) environment variable which can be used in Workflows.
|
||||
|
||||
@@ -10,11 +10,11 @@ In this example a publish type [`NPM_TOKEN`](https://docs.npmjs.com/creating-and
|
||||
|
||||
[GitHub Actions](https://github.com/features/actions) support [Workflows](https://help.github.com/en/articles/configuring-workflows), allowing to run tests on multiple Node versions and publish a release only when all test pass.
|
||||
|
||||
**Note**: The publish pipeline must run on [Node version >= 14.17](../support/FAQ.md#why-does-semantic-release-require-node-version--1417).
|
||||
**Note**: The publish pipeline must run on a [Node version that meets our version requirement](../../support/node-version.md).
|
||||
|
||||
### `.github/workflows/release.yml` configuration for Node projects
|
||||
|
||||
The following is a minimal configuration for [`semantic-release`](https://github.com/semantic-release/semantic-release) with a build running on Node 14.17 when a new commit is pushed to a `master` branch.
|
||||
The following is a minimal configuration for [`semantic-release`](https://github.com/semantic-release/semantic-release) with a build running on the latest LTS version of Node when a new commit is pushed to a `master` branch.
|
||||
See [Configuring a Workflow](https://help.github.com/en/articles/configuring-a-workflow) for additional configuration options.
|
||||
|
||||
```yaml
|
||||
@@ -33,9 +33,9 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14.17'
|
||||
node-version: 'lts/*'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Release
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## Environment variables
|
||||
|
||||
The [Authentication](../usage/ci-configuration.md#authentication) environment variables can be configured with [Protected variables](https://docs.gitlab.com/ce/ci/variables/README.html#protected-environment-variables).
|
||||
The [Authentication](../../usage/ci-configuration.md#authentication) environment variables can be configured with [Protected variables](https://docs.gitlab.com/ce/ci/variables/README.html#protected-environment-variables).
|
||||
|
||||
**Note**: Make sure to configure your release branch as [protected](https://docs.gitlab.com/ce/user/project/protected_branches.html) in order for the CI/CD build to access the protected variables.
|
||||
|
||||
@@ -10,13 +10,13 @@ The [Authentication](../usage/ci-configuration.md#authentication) environment va
|
||||
|
||||
GitLab CI supports [Pipelines](https://docs.gitlab.com/ee/ci/pipelines.html) allowing to test on multiple Node versions and publishing a release only when all test pass.
|
||||
|
||||
**Note**: The publish pipeline must run a [Node >= 14.17 version](../support/FAQ.md#why-does-semantic-release-require-node-version--1417).
|
||||
**Note**: The publish pipeline must run a [Node version that meets our version requirement](../../support/node-version.md).
|
||||
|
||||
### `.gitlab-ci.yml` configuration for Node projects
|
||||
|
||||
This example is a minimal configuration for **semantic-release** with a build running Node 10 and 12. See [GitLab CI - Configuration of your jobs with .gitlab-ci.yml](https://docs.gitlab.com/ee/ci/yaml/README.html) for additional configuration options.
|
||||
|
||||
**Note**: The`semantic-release` execution command varies depending if you are using a [local](../usage/installation.md#local-installation) or [global](../usage/installation.md#global-installation) **semantic-release** installation.
|
||||
**Note**: The`semantic-release` execution command varies depending on whether you are using a [local](../../usage/installation.md#local-installation) or [global](../../usage/installation.md#global-installation) **semantic-release** installation.
|
||||
|
||||
```yaml
|
||||
# The release pipeline will run only if all jobs in the test pipeline are successful
|
||||
@@ -50,7 +50,7 @@ publish:
|
||||
|
||||
This example is a minimal configuration for **semantic-release** with a build running Node 10 and 12. See [GitLab CI - Configuration of your jobs with .gitlab-ci.yml](https://docs.gitlab.com/ee/ci/yaml/README.html) for additional configuration options.
|
||||
|
||||
**Note**: The`semantic-release` execution command varies depending if you are using a [local](../usage/installation.md#local-installation) or [global](../usage/installation.md#global-installation) **semantic-release** installation.
|
||||
**Note**: The`semantic-release` execution command varies depending if you are using a [local](../../usage/installation.md#local-installation) or [global](../../usage/installation.md#global-installation) **semantic-release** installation.
|
||||
|
||||
|
||||
```yaml
|
||||
@@ -83,7 +83,7 @@ release:
|
||||
|
||||
### `package.json` configuration
|
||||
|
||||
A `package.json` is required only for [local](../usage/installation.md#local-installation) **semantic-release** installation.
|
||||
A `package.json` is required only for [local](../../usage/installation.md#local-installation) **semantic-release** installation.
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -2,19 +2,19 @@
|
||||
|
||||
## Environment variables
|
||||
|
||||
The [Authentication](../usage/ci-configuration.md#authentication) environment variables can be configured in [Jenkins Project Settings](https://www.jenkins.io/doc/pipeline/tour/environment/)..
|
||||
The [Authentication](../../usage/ci-configuration.md#authentication) environment variables can be configured in [Jenkins Project Settings](https://www.jenkins.io/doc/pipeline/tour/environment/)..
|
||||
|
||||
Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with semantic-release-cli](../usage/getting-started.md#getting-started).
|
||||
Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with semantic-release-cli](../../usage/getting-started.md#getting-started).
|
||||
|
||||
## Node.js project configuration
|
||||
|
||||
### `Jenkinsfile (Declarative Pipeline)` configuration for a Node.js job
|
||||
|
||||
**Note**: The publish pipeline must run a [Node >= 14.17 version](../support/FAQ.md#why-does-semantic-release-require-node-version--1417).
|
||||
**Note**: The publish pipeline must run a Node version that [meets our requirement](../../support/node-version.md).
|
||||
|
||||
This example is a minimal configuration for **semantic-release** with a build running Node 14.17. See [Jenkins documentation](https://www.jenkins.io/doc/) for additional configuration options.
|
||||
|
||||
The`semantic-release` execution command varies depending if you are using a [local](../usage/installation.md#local-installation) or [global](../usage/installation.md#global-installation) **semantic-release** installation.
|
||||
This example is a minimal configuration for **semantic-release** with a build running a version of Node labelled as "node LTS".
|
||||
Since versions of Node are manually downloaded and labelled, we recommend keeping the version used for the release steps up-to-date with the latest LTS version.
|
||||
See the [Jenkins documentation](https://www.jenkins.io/doc/) for additional configuration options.
|
||||
|
||||
```yaml
|
||||
// The release stage in the pipeline will run only if the test stage in the pipeline is successful
|
||||
@@ -31,11 +31,11 @@ pipeline {
|
||||
npm install
|
||||
npm test
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Release') {
|
||||
tools {
|
||||
nodejs "node 14.17"
|
||||
nodejs "node LTS"
|
||||
}
|
||||
steps {
|
||||
sh '''
|
||||
@@ -50,7 +50,7 @@ pipeline {
|
||||
|
||||
### `package.json` configuration for a Node job
|
||||
|
||||
A `package.json` is required only for [local](../usage/installation.md#local-installation) **semantic-release** installation.
|
||||
A `package.json` is required only for [local](../../usage/installation.md#local-installation) **semantic-release** installation.
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
## Environment variables
|
||||
|
||||
The [Authentication](../usage/ci-configuration.md#authentication) environment variables can be configured in [Travis Repository Settings](https://docs.travis-ci.com/user/environment-variables/#defining-variables-in-repository-Settings) or with the [travis env set CLI](https://github.com/travis-ci/travis.rb#env).
|
||||
The [Authentication](../../usage/ci-configuration.md#authentication) environment variables can be configured in [Travis Repository Settings](https://docs.travis-ci.com/user/environment-variables/#defining-variables-in-repository-Settings) or with the [travis env set CLI](https://github.com/travis-ci/travis.rb#env).
|
||||
|
||||
Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with semantic-release-cli](../usage/getting-started.md#getting-started).
|
||||
Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with semantic-release-cli](../../usage/getting-started.md#getting-started).
|
||||
|
||||
## Node.js projects configuration
|
||||
|
||||
@@ -12,7 +12,7 @@ Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with
|
||||
|
||||
This example is a minimal configuration for **semantic-release** with a build running Node 14 and 16. See [Travis - Customizing the Build](https://docs.travis-ci.com/user/customizing-the-build) for additional configuration options.
|
||||
|
||||
This example creates a `release` [build stage](https://docs.travis-ci.com/user/build-stages) that [runs `semantic-release` only after all test jobs are successful](../usage/ci-configuration.md#run-semantic-release-only-after-all-tests-succeeded).
|
||||
This example creates a `release` [build stage](https://docs.travis-ci.com/user/build-stages) that [runs `semantic-release` only after all test jobs are successful](../../usage/ci-configuration.md#run-semantic-release-only-after-all-tests-succeeded).
|
||||
|
||||
It's recommended to run the `semantic-release` command in the [Travis `deploy` step](https://docs.travis-ci.com/user/customizing-the-build/#The-Build-Lifecycle) so if an error occurs the build will fail and Travis will send a notification.
|
||||
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
|
||||
### `package.json` configuration for multiple Node jobs
|
||||
|
||||
A `package.json` is required only for [local](../usage/installation.md#local-installation) **semantic-release** installation.
|
||||
A `package.json` is required only for [local](../../usage/installation.md#local-installation) **semantic-release** installation.
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -57,13 +57,13 @@ A `package.json` is required only for [local](../usage/installation.md#local-ins
|
||||
|
||||
For projects that require to be tested with one or multiple version of a Non-JavaScript [language](https://docs.travis-ci.com/user/languages), optionally on multiple [Operating Systems](https://docs.travis-ci.com/user/multi-os).
|
||||
|
||||
This recipe cover the Travis specifics only. See [Non JavaScript projects recipe](../support/FAQ.md#can-i-use-semantic-release-to-publish-non-javascript-packages) for more information on the **semantic-release** configuration.
|
||||
This recipe cover the Travis specifics only. See [Non JavaScript projects recipe](../../support/FAQ.md#can-i-use-semantic-release-to-publish-non-javascript-packages) for more information on the **semantic-release** configuration.
|
||||
|
||||
### `.travis.yml` configuration for non-JavaScript projects
|
||||
|
||||
This example is a minimal configuration for **semantic-release** with a build running [Go 1.6 and 1.7](https://docs.travis-ci.com/user/languages/go). See [Travis - Customizing the Build](https://docs.travis-ci.com/user/customizing-the-build) for additional configuration options.
|
||||
|
||||
This example creates a `release` [build stage](https://docs.travis-ci.com/user/build-stages) that [runs `semantic-release` only after all test jobs are successful](../usage/ci-configuration.md#run-semantic-release-only-after-all-tests-succeeded).
|
||||
This example creates a `release` [build stage](https://docs.travis-ci.com/user/build-stages) that [runs `semantic-release` only after all test jobs are successful](../../usage/ci-configuration.md#run-semantic-release-only-after-all-tests-succeeded).
|
||||
|
||||
It's recommended to run the `semantic-release` command in the [Travis `deploy` step](https://docs.travis-ci.com/user/customizing-the-build/#The-Build-Lifecycle) so if an error occurs the build will fail and Travis will send a notification.
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# Git hosted services
|
||||
- [Git authentication with SSH keys](git-auth-ssh-keys.md)
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# Git authentication with SSH keys
|
||||
|
||||
When using [environment variables](../usage/ci-configuration.md#authentication) to set up the Git authentication, the remote Git repository will automatically be accessed via [https](https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#_the_http_protocols), independently of the [`repositoryUrl`](../usage/configuration.md#repositoryurl) format configured in the **semantic-release** [Configuration](../usage/configuration.md#configuration) (the format will be automatically converted as needed).
|
||||
When using [environment variables](../../usage/ci-configuration.md#authentication) to set up the Git authentication, the remote Git repository will automatically be accessed via [https](https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#_the_http_protocols), independently of the [`repositoryUrl`](../../usage/configuration.md#repositoryurl) format configured in the **semantic-release** [Configuration](../../usage/configuration.md#configuration) (the format will be automatically converted as needed).
|
||||
|
||||
Alternatively the Git repository can be accessed via [SSH](https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#_the_ssh_protocol) by creating SSH keys, adding the public one to your Git hosted account and making the private one available on the CI environment.
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Release workflow
|
||||
- [Publishing on distribution channels](distribution-channels.md)
|
||||
- [Publishing maintenance releases](maintenance-releases.md)
|
||||
- [Publishing pre-releases](pre-releases.md)
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
This recipe will walk you through a simple example that uses distribution channels to make releases available only to a subset of users, in order to collect feedbacks before distributing the release to all users.
|
||||
|
||||
This example uses the **semantic-release** default configuration:
|
||||
- [branches](../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
|
||||
- [plugins](../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']`
|
||||
- [branches](../../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
|
||||
- [plugins](../../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']`
|
||||
|
||||
## Initial release
|
||||
|
||||
+3
-3
@@ -3,8 +3,8 @@
|
||||
This recipe will walk you through a simple example that uses Git branches and distribution channels to publish fixes and features for old versions of a package.
|
||||
|
||||
This example uses the **semantic-release** default configuration:
|
||||
- [branches](../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
|
||||
- [plugins](../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']`
|
||||
- [branches](../../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
|
||||
- [plugins](../../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']`
|
||||
|
||||
## Initial release
|
||||
|
||||
@@ -18,7 +18,7 @@ The Git history of the repository is:
|
||||
|
||||
## Releasing a breaking change
|
||||
|
||||
We now decide to drop Node.js 6 support for our package, and require Node.js 8 or higher, which is a breaking change.
|
||||
We now decide to drop Node.js 6 support for our package, and require Node.js 8 or higher, which is a breaking change.
|
||||
|
||||
We commit that change with the message `feat: drop Node.js 6 support \n\n BREAKING CHANGE: Node.js >= 8 required` to `master`. When pushing that commit, **semantic-release** will release the version `2.0.0` on the dist-tag `@latest`.
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
This recipe will walk you through a simple example that uses pre-releases to publish beta versions while working on a future major release and then make only one release on the default distribution.
|
||||
|
||||
This example uses the **semantic-release** default configuration:
|
||||
- [branches](../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
|
||||
- [plugins](../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']`
|
||||
- [branches](../../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
|
||||
- [plugins](../../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']`
|
||||
|
||||
## Initial release
|
||||
|
||||
+9
-19
@@ -45,11 +45,11 @@ Yes, **semantic-release** is a Node CLI application, but it can be used to publi
|
||||
To publish a non-Node package (without a `package.json`) you would need to:
|
||||
- Use a [global](../usage/installation.md#global-installation) **semantic-release** installation
|
||||
- Set **semantic-release** [options](../usage/configuration.md#options) via [CLI arguments or rc file](../usage/configuration.md#configuration)
|
||||
- Make sure your CI job executing the `semantic-release` command has access to [Node >= 14.17](#why-does-semantic-release-require-node-version--1417) to execute the `semantic-release` command
|
||||
- Make sure your CI job executing the `semantic-release` command has access to a version of Node that [meets our version requirement](./node-version.md) to execute the `semantic-release` command
|
||||
|
||||
See the [CI configuration recipes](../recipes/README.md#ci-configurations) for more details on specific CI environments.
|
||||
See the [CI configuration recipes](../recipes/release-workflow/README.md#ci-configurations) for more details on specific CI environments.
|
||||
|
||||
In addition you will need to configure the **semantic-release** [plugins](../usage/plugins.md#plugins) to disable the [`@semantic-release/npm`](https://github.com/semantic-release/npm) plugin which is used by default and use a plugin for your project type.
|
||||
In addition, you will need to configure the **semantic-release** [plugins](../usage/plugins.md#plugins) to disable the [`@semantic-release/npm`](https://github.com/semantic-release/npm) plugin which is used by default and use a plugin for your project type.
|
||||
|
||||
If there is no specific plugin for your project type you can use the [`@semantic-release/exec`](https://github.com/semantic-release/exec) plugin to publish the release with a shell command.
|
||||
|
||||
@@ -71,7 +71,7 @@ Here is a basic example to create [GitHub releases](https://help.github.com/arti
|
||||
|
||||
**Note**: This is a theoretical example where the command `set-version` update the project version with the value passed as its first argument and `publish-package` publishes the package to a registry.
|
||||
|
||||
See the [package managers and languages recipes](../recipes/README.md#package-managers-and-languages) for more details on specific project types.
|
||||
See the [package managers and languages recipes](../recipes/release-workflow/README.md#package-managers-and-languages) for more details on specific project types.
|
||||
|
||||
## Can I use semantic-release with any CI service?
|
||||
|
||||
@@ -79,7 +79,7 @@ Yes, **semantic-release** can be used with any CI service, as long as it provide
|
||||
- A way to set [authentication](../usage/ci-configuration.md#authentication) via environment variables
|
||||
- A way to guarantee that the `semantic-release` command is [executed only after all the tests of all the jobs in the CI build pass](../usage/ci-configuration.md#run-semantic-release-only-after-all-tests-succeeded)
|
||||
|
||||
See the [CI configuration recipes](../recipes/README.md#ci-configurations) for more details on specific CI environments.
|
||||
See the [CI configuration recipes](../recipes/release-workflow/README.md#ci-configurations) for more details on specific CI environments.
|
||||
|
||||
## Can I run semantic-release on my local machine rather than on a CI server?
|
||||
|
||||
@@ -95,7 +95,7 @@ However this is not the recommended approach, as running unit and integration te
|
||||
|
||||
Yes, with the [`@semantic-release/gitlab-config`](https://github.com/semantic-release/gitlab-config) shareable configuration.
|
||||
|
||||
See the [GitLab CI recipes](../recipes/gitlab-ci.md#using-semantic-release-with-gitlab-ci) for the CI configuration.
|
||||
See the [GitLab CI recipes](../recipes/ci-configurations/gitlab-ci.md#using-semantic-release-with-gitlab-ci) for the CI configuration.
|
||||
|
||||
## Can I use semantic-release with any Git hosted environment?
|
||||
|
||||
@@ -194,25 +194,15 @@ If you need more control over the timing of releases, see [Triggering a release]
|
||||
|
||||
This is not supported by **semantic-release** as it's not considered a good practice, mostly because [Semantic Versioning](https://semver.org) rules applies differently to major version zero.
|
||||
|
||||
If your project is under heavy development, with frequent breaking changes, and is not production ready yet we recommend [publishing pre-releases](../recipes/pre-releases.md#publishing-pre-releases).
|
||||
If your project is under heavy development, with frequent breaking changes, and is not production ready yet we recommend [publishing pre-releases](../recipes/release-workflow/pre-releases.md#publishing-pre-releases).
|
||||
|
||||
See [“Introduction to SemVer” - Irina Gebauer](https://blog.greenkeeper.io/introduction-to-semver-d272990c44f2) for more details on [Semantic Versioning](https://semver.org) and the recommendation to start at version `1.0.0`.
|
||||
|
||||
## Can I trust semantic-release with my releases?
|
||||
|
||||
**semantic-release** has a full unit and integration test suite that tests `npm` publishes against the [npm-registry-couchapp](https://github.com/npm/npm-registry-couchapp).
|
||||
**semantic-release** has a full unit and integration test suite that tests `npm` publishes against the [verdaccio](https://www.npmjs.com/package/verdaccio).
|
||||
|
||||
In addition the [verify conditions step](../../README.md#release-steps) verifies that all necessary conditions for proceeding with a release are met, and a new release will be performed [only if all your tests pass](../usage/ci-configuration.md#run-semantic-release-only-after-all-tests-succeeded).
|
||||
|
||||
## Why does semantic-release require Node version >= 14.17?
|
||||
|
||||
**semantic-release** is written using the latest [ECMAScript 2017](https://www.ecma-international.org/publications/standards/Ecma-262.htm) features, without transpilation which **requires Node version 14.17 or higher**.
|
||||
|
||||
See [Node version requirement](./node-version.md#node-version-requirement) for more details and solutions.
|
||||
|
||||
## Why does semantic-release require Git version >= 2.7.1?
|
||||
|
||||
**semantic-release** uses Git CLI commands to read information about the repository such as branches, commit history and tags. Certain commands and options (such as [the `--merged` option of the `git tag` command](https://git-scm.com/docs/git-tag/2.7.0#git-tag---no-mergedltcommitgt) or bug fixes related to `git ls-files`) used by **semantic-release** are only available in Git version 2.7.1 and higher.
|
||||
In addition, the [verify conditions step](../../README.md#release-steps) verifies that all necessary conditions for proceeding with a release are met, and a new release will be performed [only if all your tests pass](../usage/ci-configuration.md#run-semantic-release-only-after-all-tests-succeeded).
|
||||
|
||||
## What is npx?
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Git version requirement
|
||||
|
||||
**semantic-release** uses Git CLI commands to read information about the repository such as branches, commit history and tags.
|
||||
Certain commands and options (such as [the `--merged` option of the `git tag` command](https://git-scm.com/docs/git-tag/2.7.0#git-tag---no-mergedltcommitgt) or bug fixes related to `git ls-files`) used by **semantic-release** are only available in Git version 2.7.1 and higher.
|
||||
@@ -1,13 +1,21 @@
|
||||
# Node Support Policy
|
||||
|
||||
We only support [Long-Term Support](https://github.com/nodejs/Release) versions of Node starting with [Node 14.17.0 (LTS)](https://nodejs.org/en/blog/release/v14.17.0).
|
||||
We will always support at least the latest [Long-Term Support](https://github.com/nodejs/Release) version of Node, but provide no promise of support for older versions.
|
||||
The supported range will always be defined in the `engines.node` property of the `package.json` of our packages.
|
||||
|
||||
We specifically limit our support to LTS versions of Node, not because this package won't work on other versions, but because we have a limited amount of time, and supporting LTS offers the greatest return on that investment.
|
||||
|
||||
It's possible this package will work correctly on newer versions of Node. It may even be possible to use this package on older versions of Node, though that's more unlikely as we'll make every effort to take advantage of features available in the oldest LTS version we support.
|
||||
It's possible this package will work correctly on newer versions of Node.
|
||||
It may even be possible to use this package on older versions of Node, though that's more unlikely as we'll make every effort to take advantage of features available in the oldest LTS version we support.
|
||||
|
||||
As each Node LTS version reaches its end-of-life we will remove that version from the node engines property of our package's package.json file. Removing a Node version is considered a breaking change and will entail the publishing of a new major version of this package. We will not accept any requests to support an end-of-life version of Node. Any merge requests or issues supporting an end-of-life version of Node will be closed.
|
||||
As new Node LTS versions become available we may remove previous versions from the `engines.node` property of our package's `package.json` file.
|
||||
Removing a Node version is considered a breaking change and will entail the publishing of a new major version of this package.
|
||||
We will not accept any requests to support an end-of-life version of Node.
|
||||
Any merge requests or issues supporting an end-of-life version of Node will be closed.
|
||||
|
||||
We will accept code that allows this package to run on newer, non-LTS, versions of Node. Furthermore, we will attempt to ensure our own changes work on the latest version of Node. To help in that commitment, our continuous integration setup runs against all LTS versions of Node in addition the most recent Node release; called current.
|
||||
We will accept code that allows this package to run on newer, non-LTS, versions of Node.
|
||||
Furthermore, we will attempt to ensure our own changes work on the latest version of Node.
|
||||
To help in that commitment, our continuous integration setup runs against all LTS versions of Node in addition the most recent Node release; called current.
|
||||
|
||||
JavaScript package managers should allow you to install this package with any version of Node, with, at most, a warning if your version of Node does not fall within the range specified by our node engines property. If you encounter issues installing this package, please report the issue to your package manager.
|
||||
JavaScript package managers should allow you to install this package with any version of Node, with, at most, a warning if your version of Node does not fall within the range specified by our node engines property.
|
||||
If you encounter issues installing this package, please report the issue to your package manager.
|
||||
|
||||
@@ -2,36 +2,37 @@
|
||||
|
||||
**semantic-release** is written using the latest [ECMAScript 2017](https://www.ecma-international.org/publications/standards/Ecma-262.htm) features, without transpilation which requires **requires Node version 14.17 or higher**.
|
||||
|
||||
**semantic-release** is meant to be used in a CI environment as a development support tool, not as a production dependency. Therefore the only constraint is to run the `semantic-release` in a CI environment providing Node 14.17 or higher.
|
||||
**semantic-release** is meant to be used in a CI environment as a development support tool, not as a production dependency.
|
||||
Therefore, the only constraint is to run the `semantic-release` in a CI environment providing version of Node that meets our version requirement.
|
||||
|
||||
See our [Node Support Policy](node-support-policy.md) for our long-term promise regarding Node version support.
|
||||
|
||||
## Recommended solution
|
||||
|
||||
### Run at least one CI job with Node >= 14.17
|
||||
### Run at least one CI job with a version of Node that meets our version requirement
|
||||
|
||||
The recommended approach is to run the `semantic-release` command from a CI job running on Node 14.17 or higher.
|
||||
This can either be a job used by your project to test on Node >= 14.17 or a dedicated job for the release steps.
|
||||
The recommended approach is to run the `semantic-release` command from a CI job running on the latest available LTS version of node.
|
||||
This can either be a job used by your project to test on the latest Node LTS version or a dedicated job for the release steps.
|
||||
|
||||
See [CI configuration](../usage/ci-configuration.md) and [CI configuration recipes](../recipes/README.md#ci-configurations) for more details.
|
||||
See [CI configuration](../usage/ci-configuration.md) and [CI configuration recipes](../recipes/release-workflow/README.md#ci-configurations) for more details.
|
||||
|
||||
## Alternative solutions
|
||||
|
||||
### Use `npx`
|
||||
### Use `npx` to execute in the latest LTS version of Node
|
||||
|
||||
`npx` is included with npm >= 5.2 and can be used to download the latest [Node 14 package published on npm](https://www.npmjs.com/package/node).
|
||||
`npx` is included with npm >= 5.2 and can be used to download the latest [Node LTS package published on npm](https://www.npmjs.com/package/node).
|
||||
Use it to execute the `semantic-release` command.
|
||||
|
||||
```bash
|
||||
$ npx -p node@14 -c "npx semantic-release"
|
||||
$ npx -p node@lts -c "npx semantic-release"
|
||||
```
|
||||
|
||||
**Note:**: See [What is npx](./FAQ.md#what-is-npx) for more details.
|
||||
**Note**: See [What is npx](./FAQ.md#what-is-npx) for more details.
|
||||
|
||||
### Use `nvm`
|
||||
|
||||
If your CI environment provides [nvm](https://github.com/creationix/nvm) you can use it to switch to Node 14.17 before running the `semantic-release` command.
|
||||
If your CI environment provides [nvm](https://github.com/creationix/nvm) you can use it to switch to the latest LTS version of Node before running the `semantic-release` command.
|
||||
|
||||
```bash
|
||||
$ nvm install 14.17 && npx semantic-release
|
||||
$ nvm install 'lts/*' && npx semantic-release
|
||||
```
|
||||
|
||||
@@ -65,5 +65,5 @@ To recover from that situation, do the following:
|
||||
|
||||
1. Delete the tag(s) for the release(s) that have been lost from the git history. You can delete each tag from remote using `git push origin :[TAG NAME]`, e.g. `git push origin :v2.0.0-beta.1`. You can delete tags locally using `git tag -d [TAG NAME]`, e.g. `git tag -d v2.0.0-beta.1`.
|
||||
2. Re-create the tags locally: `git tag [TAG NAME] [COMMIT HASH]`, where `[COMMIT HASH]` is the new commit that created the release for the lost tag. E.g. `git tag v2.0.0-beta.1 abcdef0`
|
||||
3. Re-create the git notes for each release tag, e.g. `git notes --ref semantic-release add -f -m '{"channels":["beta"]}' v2.0.0-beta.1`. If the release was also published in the default channel (usually `master`), then set the first channel to `null`, e.g. `git notes --ref semantic-release add -f -m '{"channels":[null, "beta"]}'
|
||||
3. Re-create the git notes for each release tag, e.g. `git notes --ref semantic-release add -f -m '{"channels":["beta"]}' v2.0.0-beta.1`. If the release was also published in the default channel (usually `master`), then set the first channel to `null`, e.g. `git notes --ref semantic-release add -f -m '{"channels":[null, "beta"]}'`
|
||||
4. Push the local notes: `git push --force origin refs/notes/semantic-release`. The `--force` is needed after the rebase. Be careful.
|
||||
|
||||
@@ -13,7 +13,7 @@ Here is a few example of the CI services that can be used to achieve this:
|
||||
- [Wercker Workflows](http://devcenter.wercker.com/docs/workflows)
|
||||
- [GoCD Pipelines](https://docs.gocd.org/current/introduction/concepts_in_go.html#pipeline).
|
||||
|
||||
See [CI configuration recipes](../recipes/README.md#ci-configurations) for more details.
|
||||
See [CI configuration recipes](../recipes/ci-configurations/README.md) for more details.
|
||||
|
||||
## Authentication
|
||||
|
||||
@@ -29,7 +29,7 @@ See [CI configuration recipes](../recipes/README.md#ci-configurations) for more
|
||||
| `BB_TOKEN_BASIC_AUTH` or `BITBUCKET_TOKEN_BASIC_AUTH` | A Bitbucket [personal access token](https://confluence.atlassian.com/bitbucketserver/personal-access-tokens-939515499.html) with basic auth support. For clearification `user:token` has to be the value of this env. |
|
||||
| `GIT_CREDENTIALS` | [URL encoded](https://en.wikipedia.org/wiki/Percent-encoding) Git username and password in the format `<username>:<password>`. The username and password must each be individually URL encoded, not the `:` separating them. |
|
||||
|
||||
Alternatively the Git authentication can be set up via [SSH keys](../recipes/git-auth-ssh-keys.md).
|
||||
Alternatively the Git authentication can be set up via [SSH keys](../recipes/git-hosted-services/git-auth-ssh-keys.md).
|
||||
|
||||
### Authentication for plugins
|
||||
|
||||
@@ -44,6 +44,6 @@ See each plugin's documentation for the environment variables required.
|
||||
|
||||
The authentication token/credentials have to be made available in the CI service via environment variables.
|
||||
|
||||
See [CI configuration recipes](../recipes/README.md#ci-configurations) for more details on how to configure environment variables in your CI service.
|
||||
See [CI configuration recipes](../recipes/ci-configurations/README.md) for more details on how to configure environment variables in your CI service.
|
||||
|
||||
**Note**: The environment variables `GH_TOKEN`, `GITHUB_TOKEN`, `GL_TOKEN` and `GITLAB_TOKEN` can be used for both the Git authentication and the API authentication required by [@semantic-release/github](https://github.com/semantic-release/github) and [@semantic-release/gitlab](https://github.com/semantic-release/gitlab).
|
||||
|
||||
@@ -24,7 +24,9 @@ For other type of projects we recommend installing **semantic-release** directly
|
||||
$ npx semantic-release
|
||||
```
|
||||
|
||||
**Note**: For a global installation, it's recommended to specify the major **semantic-release** version to install (for example with with `npx semantic-release@18`).
|
||||
This way your build will not automatically use the next major **semantic-release** release that could possibly break your build. You will have to upgrade manually when a new major version is released.
|
||||
**Note**: For a global installation, it's recommended to specify the major **semantic-release** version to install (for example with `npx semantic-release@18`).
|
||||
This way your build will not automatically use the next major **semantic-release** release that could possibly break your build.
|
||||
You will have to upgrade manually when a new major version is released.
|
||||
|
||||
**Note**: `npx` is a tool bundled with `npm@>=5.2.0`. It is used to conveniently install the semantic-release binary and to execute it. See [What is npx](../support/FAQ.md#what-is-npx) for more details.
|
||||
**Note**: `npx` is a tool bundled with `npm@>=5.2.0`. It is used to conveniently install the semantic-release binary and to execute it.
|
||||
See [What is npx](../support/FAQ.md#what-is-npx) for more details.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# Workflow configuration
|
||||
|
||||
**semantic-release** allow to manage and automate complex release workflow, based on multiple Git branches and distribution channels. This allow to:
|
||||
- Distributes certain releases to a particular group of users via distribution channels
|
||||
- Distribute certain releases to a particular group of users via distribution channels
|
||||
- Manage the availability of releases on distribution channels via branches merge
|
||||
- Maintain multiple lines of releases in parallel
|
||||
- Work on large future releases outside the normal flow of one version increment per Git push
|
||||
|
||||
See [Release workflow recipes](../recipes/README.md#release-workflow) for detailed examples.
|
||||
See [Release workflow recipes](../recipes/release-workflow/README.md#release-workflow) for detailed examples.
|
||||
|
||||
The release workflow is configured via the [branches option](./configuration.md#branches) which accepts a single or an array of branch definitions.
|
||||
Each branch can be defined either as a string, a [glob](https://github.com/micromatch/micromatch#matching-features) or an object. For string and glob definitions each [property](#branches-properties) will be defaulted.
|
||||
@@ -91,7 +91,7 @@ For example the configuration `['master', {name: 'pre/rc', prerelease: '${name.r
|
||||
branches: [
|
||||
{name: 'master'},
|
||||
{name: 'pre/rc', channel: 'pre/rc', prerelease: 'rc'}, // `prerelease` is built with the template `${name.replace(/^pre\\//g, "")}`
|
||||
{name: 'beta', channel: 'beta', prerelease: 'beta'}, // `prerelease` is set to `beta` as it is the value of `name`
|
||||
{name: 'beta', channel: 'beta', prerelease: true}, // `prerelease` is set to `beta` as it is the value of `name`
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -108,7 +108,7 @@ A project must define a minimum of 1 release branch and can have a maximum of 3.
|
||||
|
||||
**Note:** With **semantic-release** as with most package managers, a release version must be unique, independently of the distribution channel on which it is available.
|
||||
|
||||
See [publishing on distribution channels recipe](../recipes/distribution-channels.md) for a detailed example.
|
||||
See [publishing on distribution channels recipe](../recipes/release-workflow/distribution-channels.md) for a detailed example.
|
||||
|
||||
#### Pushing to a release branch
|
||||
|
||||
@@ -142,7 +142,7 @@ Maintenance branches are always considered lower than [release branches](#releas
|
||||
|
||||
**semantic-release** will automatically add releases to the corresponding distribution channel when code is [merged from a release or maintenance branch to another maintenance branch](#merging-into-a-maintenance-branch), however only versions within the branch `range` can be merged. If a merged version is outside the maintenance branch `range`, **semantic-release** will not add to the corresponding channel and will throw an `EINVALIDMAINTENANCEMERGE` error.
|
||||
|
||||
See [publishing maintenance releases recipe](../recipes/maintenance-releases.md) for a detailed example.
|
||||
See [publishing maintenance releases recipe](../recipes/release-workflow/maintenance-releases.md) for a detailed example.
|
||||
|
||||
#### Pushing to a maintenance branch
|
||||
|
||||
@@ -171,7 +171,7 @@ A pre-release branch is characterized by the `prerelease` property that defines
|
||||
|
||||
When merging commits associated with an existing release, **semantic-release** will treat them as [pushed commits](#pushing-to-a-pre-release-branch) and publish a new release if necessary, but it will never add those releases to the distribution channel corresponding to the pre-release branch.
|
||||
|
||||
See [publishing pre-releases recipe](../recipes/pre-releases.md) for a detailed example.
|
||||
See [publishing pre-releases recipe](../recipes/release-workflow/pre-releases.md) for a detailed example.
|
||||
|
||||
#### Pushing to a pre-release branch
|
||||
|
||||
|
||||
@@ -1,30 +1,35 @@
|
||||
import lodash from 'lodash'
|
||||
const {pick} = lodash
|
||||
import marked from 'marked';
|
||||
import TerminalRenderer from 'marked-terminal';
|
||||
import envCi from 'env-ci';
|
||||
import hookStd from 'hook-std';
|
||||
import semver from 'semver';
|
||||
import AggregateError from 'aggregate-error';
|
||||
import pkg from './package.json';
|
||||
import hideSensitive from './lib/hide-sensitive';
|
||||
import getConfig from './lib/get-config';
|
||||
import verify from './lib/verify';
|
||||
import getNextVersion from './lib/get-next-version';
|
||||
import getCommits from './lib/get-commits';
|
||||
import getLastRelease from './lib/get-last-release';
|
||||
import getReleaseToAdd from './lib/get-release-to-add';
|
||||
import {extractErrors, makeTag} from './lib/utils';
|
||||
import getGitAuthUrl from './lib/get-git-auth-url';
|
||||
import getBranches from './lib/branches';
|
||||
import getLogger from './lib/get-logger';
|
||||
const {pick} = require('lodash');
|
||||
const marked = require('marked');
|
||||
const envCi = require('env-ci');
|
||||
const hookStd = require('hook-std');
|
||||
const semver = require('semver');
|
||||
const AggregateError = require('aggregate-error');
|
||||
const pkg = require('./package.json');
|
||||
const hideSensitive = require('./lib/hide-sensitive');
|
||||
const getConfig = require('./lib/get-config');
|
||||
const verify = require('./lib/verify');
|
||||
const getNextVersion = require('./lib/get-next-version');
|
||||
const getCommits = require('./lib/get-commits');
|
||||
const getLastRelease = require('./lib/get-last-release');
|
||||
const getReleaseToAdd = require('./lib/get-release-to-add');
|
||||
const {extractErrors, makeTag} = require('./lib/utils');
|
||||
const getGitAuthUrl = require('./lib/get-git-auth-url');
|
||||
const getBranches = require('./lib/branches');
|
||||
const getLogger = require('./lib/get-logger');
|
||||
const {verifyAuth, isBranchUpToDate, getGitHead, tag, push, pushNotes, getTagHead, addNote} = require('./lib/git');
|
||||
const getError = require('./lib/get-error');
|
||||
const {COMMIT_NAME, COMMIT_EMAIL} = require('./lib/definitions/constants');
|
||||
|
||||
import {verifyAuth, isBranchUpToDate, getGitHead, tag, push, pushNotes, getTagHead, addNote} from './lib/git';
|
||||
let markedOptionsSet = false;
|
||||
async function terminalOutput(text) {
|
||||
if (!markedOptionsSet) {
|
||||
const {default: TerminalRenderer} = await import('marked-terminal'); // eslint-disable-line node/no-unsupported-features/es-syntax
|
||||
marked.setOptions({renderer: new TerminalRenderer()});
|
||||
markedOptionsSet = true;
|
||||
}
|
||||
|
||||
import getError from './lib/get-error';
|
||||
import {COMMIT_NAME, COMMIT_EMAIL} from './lib/definitions/constants';
|
||||
|
||||
marked.setOptions({renderer: new TerminalRenderer()});
|
||||
return marked.parse(text);
|
||||
}
|
||||
|
||||
/* eslint complexity: off */
|
||||
async function run(context, plugins) {
|
||||
@@ -210,20 +215,20 @@ async function run(context, plugins) {
|
||||
if (options.dryRun) {
|
||||
logger.log(`Release note for version ${nextRelease.version}:`);
|
||||
if (nextRelease.notes) {
|
||||
context.stdout.write(marked(nextRelease.notes));
|
||||
context.stdout.write(await terminalOutput(nextRelease.notes));
|
||||
}
|
||||
}
|
||||
|
||||
return pick(context, ['lastRelease', 'commits', 'nextRelease', 'releases']);
|
||||
}
|
||||
|
||||
function logErrors({logger, stderr}, err) {
|
||||
async function logErrors({logger, stderr}, err) {
|
||||
const errors = extractErrors(err).sort((error) => (error.semanticRelease ? -1 : 0));
|
||||
for (const error of errors) {
|
||||
if (error.semanticRelease) {
|
||||
logger.error(`${error.code} ${error.message}`);
|
||||
if (error.details) {
|
||||
stderr.write(marked(error.details));
|
||||
stderr.write(await terminalOutput(error.details)); // eslint-disable-line no-await-in-loop
|
||||
}
|
||||
} else {
|
||||
logger.error('An error occurred while running semantic-release: %O', error);
|
||||
@@ -237,12 +242,12 @@ async function callFail(context, plugins, err) {
|
||||
try {
|
||||
await plugins.fail({...context, errors});
|
||||
} catch (error) {
|
||||
logErrors(context, error);
|
||||
await logErrors(context, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default async (cliOptions = {}, {cwd = process.cwd(), env = process.env, stdout, stderr} = {}) => {
|
||||
module.exports = async (cliOptions = {}, {cwd = process.cwd(), env = process.env, stdout, stderr} = {}) => {
|
||||
const {unhook} = hookStd(
|
||||
{silent: false, streams: [process.stdout, process.stderr, stdout, stderr].filter(Boolean)},
|
||||
hideSensitive(env)
|
||||
@@ -268,7 +273,7 @@ export default async (cliOptions = {}, {cwd = process.cwd(), env = process.env,
|
||||
throw error;
|
||||
}
|
||||
} catch (error) {
|
||||
logErrors(context, error);
|
||||
await logErrors(context, error);
|
||||
unhook();
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import lodash from 'lodash'
|
||||
const {isString, remove, omit, mapValues, template} = lodash
|
||||
import micromatch from 'micromatch';
|
||||
import {getBranches} from '../git.js';
|
||||
const {isString, remove, omit, mapValues, template} = require('lodash');
|
||||
const micromatch = require('micromatch');
|
||||
const {getBranches} = require('../git');
|
||||
|
||||
export default async (repositoryUrl, {cwd}, branches) => {
|
||||
module.exports = async (repositoryUrl, {cwd}, branches) => {
|
||||
const gitBranches = await getBranches(repositoryUrl, {cwd});
|
||||
|
||||
return branches.reduce(
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import lodash from 'lodash'
|
||||
const {template, escapeRegExp} = lodash
|
||||
import semver from 'semver';
|
||||
import pReduce from 'p-reduce';
|
||||
import debugFactory from 'debug';
|
||||
const debug = debugFactory('semantic-release:get-tags');
|
||||
import {getTags, getNote} from '../../lib/git.js';
|
||||
const {template, escapeRegExp} = require('lodash');
|
||||
const semver = require('semver');
|
||||
const pReduce = require('p-reduce');
|
||||
const debug = require('debug')('semantic-release:get-tags');
|
||||
const {getTags, getNote} = require('../../lib/git');
|
||||
|
||||
export default async ({cwd, env, options: {tagFormat}}, branches) => {
|
||||
module.exports = async ({cwd, env, options: {tagFormat}}, branches) => {
|
||||
// Generate a regex to parse tags formatted with `tagFormat`
|
||||
// by replacing the `version` variable in the template by `(.+)`.
|
||||
// The `tagFormat` is compiled with space as the `version` as it's an invalid tag character,
|
||||
|
||||
+10
-11
@@ -1,15 +1,14 @@
|
||||
import lodash from 'lodash'
|
||||
const {isString, isRegExp} = lodash
|
||||
import AggregateError from 'aggregate-error';
|
||||
import pEachSeries from 'p-each-series';
|
||||
import DEFINITIONS from '../definitions/branches.js';
|
||||
import getError from '../get-error.js';
|
||||
import {fetch, fetchNotes, verifyBranchName} from '../git.js';
|
||||
import expand from './expand.js';
|
||||
import getTags from './get-tags.js';
|
||||
import normalize from './normalize.js';
|
||||
const {isString, isRegExp} = require('lodash');
|
||||
const AggregateError = require('aggregate-error');
|
||||
const pEachSeries = require('p-each-series');
|
||||
const DEFINITIONS = require('../definitions/branches');
|
||||
const getError = require('../get-error');
|
||||
const {fetch, fetchNotes, verifyBranchName} = require('../git');
|
||||
const expand = require('./expand');
|
||||
const getTags = require('./get-tags');
|
||||
const normalize = require('./normalize');
|
||||
|
||||
export default async (repositoryUrl, ciBranch, context) => {
|
||||
module.exports = async (repositoryUrl, ciBranch, context) => {
|
||||
const {cwd, env} = context;
|
||||
|
||||
const remoteBranches = await expand(
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import lodash from 'lodash'
|
||||
const {sortBy, isNil} = lodash
|
||||
import semverDiff from 'semver-diff';
|
||||
import {FIRST_RELEASE, RELEASE_TYPE} from '../definitions/constants.js';
|
||||
|
||||
import {
|
||||
const {sortBy, isNil} = require('lodash');
|
||||
const semverDiff = require('semver-diff');
|
||||
const {FIRST_RELEASE, RELEASE_TYPE} = require('../definitions/constants');
|
||||
const {
|
||||
tagsToVersions,
|
||||
isMajorRange,
|
||||
getUpperBound,
|
||||
@@ -13,7 +11,7 @@ import {
|
||||
getLatestVersion,
|
||||
getFirstVersion,
|
||||
getRange,
|
||||
} from '../utils.js';
|
||||
} = require('../utils');
|
||||
|
||||
function maintenance({maintenance, release}) {
|
||||
return sortBy(
|
||||
@@ -105,11 +103,4 @@ function prerelease({prerelease}) {
|
||||
});
|
||||
}
|
||||
|
||||
const exported = {
|
||||
maintenance,
|
||||
release,
|
||||
prerelease,
|
||||
};
|
||||
|
||||
export default exported;
|
||||
export {maintenance, release, prerelease};
|
||||
module.exports = {maintenance, release, prerelease};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import lodash from 'lodash'
|
||||
const {isNil, uniqBy} = lodash
|
||||
import semver from 'semver';
|
||||
import {isMaintenanceRange} from '../utils.js';
|
||||
const {isNil, uniqBy} = require('lodash');
|
||||
const semver = require('semver');
|
||||
const {isMaintenanceRange} = require('../utils');
|
||||
|
||||
const maintenance = {
|
||||
filter: ({name, range}) => (!isNil(range) && range !== false) || isMaintenanceRange(name),
|
||||
@@ -21,11 +20,4 @@ const release = {
|
||||
branchesValidator: (branches) => branches.length <= 3 && branches.length > 0,
|
||||
};
|
||||
|
||||
const exported = {
|
||||
maintenance,
|
||||
prerelease,
|
||||
release,
|
||||
};
|
||||
|
||||
export default exported;
|
||||
export {maintenance, prerelease, release};
|
||||
module.exports = {maintenance, prerelease, release};
|
||||
|
||||
@@ -16,20 +16,7 @@ const SECRET_MIN_SIZE = 5;
|
||||
|
||||
const GIT_NOTE_REF = 'semantic-release';
|
||||
|
||||
const exported = {
|
||||
RELEASE_TYPE,
|
||||
FIRST_RELEASE,
|
||||
FIRSTPRERELEASE,
|
||||
COMMIT_NAME,
|
||||
COMMIT_EMAIL,
|
||||
RELEASE_NOTES_SEPARATOR,
|
||||
SECRET_REPLACEMENT,
|
||||
SECRET_MIN_SIZE,
|
||||
GIT_NOTE_REF,
|
||||
};
|
||||
|
||||
export default exported;
|
||||
export {
|
||||
module.exports = {
|
||||
RELEASE_TYPE,
|
||||
FIRST_RELEASE,
|
||||
FIRSTPRERELEASE,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import {inspect} from 'util';
|
||||
import lodash from 'lodash'
|
||||
const {toLower, isString, trim} = lodash
|
||||
import pkg from '../../package.json';
|
||||
import {RELEASE_TYPE} from './constants.js';
|
||||
const {inspect} = require('util');
|
||||
const {toLower, isString, trim} = require('lodash');
|
||||
const pkg = require('../../package.json');
|
||||
const {RELEASE_TYPE} = require('./constants');
|
||||
|
||||
const [homepage] = pkg.homepage.split('#');
|
||||
const stringify = (object) =>
|
||||
@@ -11,7 +10,7 @@ const linkify = (file) => `${homepage}/blob/master/${file}`;
|
||||
const wordsList = (words) =>
|
||||
`${words.slice(0, -1).join(', ')}${words.length > 1 ? ` or ${words[words.length - 1]}` : trim(words[0])}`;
|
||||
|
||||
const exported = {
|
||||
module.exports = {
|
||||
ENOGITREPO: ({cwd}) => ({
|
||||
message: 'Not running from a git repository.',
|
||||
details: `The \`semantic-release\` command must be executed from a Git repository.
|
||||
@@ -20,7 +19,6 @@ The current working directory is \`${cwd}\`.
|
||||
|
||||
Please verify your CI configuration to make sure the \`semantic-release\` command is executed from the root of the cloned repository.`,
|
||||
}),
|
||||
|
||||
ENOREPOURL: () => ({
|
||||
message: 'The `repositoryUrl` option is required.',
|
||||
details: `The [repositoryUrl option](${linkify(
|
||||
@@ -31,7 +29,6 @@ Please make sure to add the \`repositoryUrl\` to the [semantic-release configura
|
||||
'docs/usage/configuration.md'
|
||||
)}).`,
|
||||
}),
|
||||
|
||||
EGITNOPERMISSION: ({options: {repositoryUrl}, branch: {name}}) => ({
|
||||
message: 'Cannot push to the Git repository.',
|
||||
details: `**semantic-release** cannot push the version tag to the branch \`${name}\` on the remote Git repository with URL \`${repositoryUrl}\`.
|
||||
@@ -43,7 +40,6 @@ This can be caused by:
|
||||
'docs/usage/ci-configuration.md#authentication'
|
||||
)})`,
|
||||
}),
|
||||
|
||||
EINVALIDTAGFORMAT: ({options: {tagFormat}}) => ({
|
||||
message: 'Invalid `tagFormat` option.',
|
||||
details: `The [tagFormat](${linkify(
|
||||
@@ -52,7 +48,6 @@ This can be caused by:
|
||||
|
||||
Your configuration for the \`tagFormat\` option is \`${stringify(tagFormat)}\`.`,
|
||||
}),
|
||||
|
||||
ETAGNOVERSION: ({options: {tagFormat}}) => ({
|
||||
message: 'Invalid `tagFormat` option.',
|
||||
details: `The [tagFormat](${linkify(
|
||||
@@ -61,7 +56,6 @@ Your configuration for the \`tagFormat\` option is \`${stringify(tagFormat)}\`.`
|
||||
|
||||
Your configuration for the \`tagFormat\` option is \`${stringify(tagFormat)}\`.`,
|
||||
}),
|
||||
|
||||
EPLUGINCONF: ({type, required, pluginConf}) => ({
|
||||
message: `The \`${type}\` plugin configuration is invalid.`,
|
||||
details: `The [${type} plugin configuration](${linkify(`docs/usage/plugins.md#${toLower(type)}-plugin`)}) ${
|
||||
@@ -70,7 +64,6 @@ Your configuration for the \`tagFormat\` option is \`${stringify(tagFormat)}\`.`
|
||||
|
||||
Your configuration for the \`${type}\` plugin is \`${stringify(pluginConf)}\`.`,
|
||||
}),
|
||||
|
||||
EPLUGINSCONF: ({plugin}) => ({
|
||||
message: 'The `plugins` configuration is invalid.',
|
||||
details: `The [plugins](${linkify(
|
||||
@@ -79,7 +72,6 @@ Your configuration for the \`${type}\` plugin is \`${stringify(pluginConf)}\`.`,
|
||||
|
||||
The invalid configuration is \`${stringify(plugin)}\`.`,
|
||||
}),
|
||||
|
||||
EPLUGIN: ({pluginName, type}) => ({
|
||||
message: `A plugin configured in the step ${type} is not a valid semantic-release plugin.`,
|
||||
details: `A valid \`${type}\` **semantic-release** plugin must be a function or an object with a function in the property \`${type}\`.
|
||||
@@ -90,7 +82,6 @@ Please refer to the \`${pluginName}\` and [semantic-release plugins configuratio
|
||||
'docs/usage/plugins.md'
|
||||
)}) documentation for more details.`,
|
||||
}),
|
||||
|
||||
EANALYZECOMMITSOUTPUT: ({result, pluginName}) => ({
|
||||
message: 'The `analyzeCommits` plugin returned an invalid value. It must return a valid semver release type.',
|
||||
details: `The \`analyzeCommits\` plugin must return a valid [semver](https://semver.org) release type. The valid values are: ${RELEASE_TYPE.map(
|
||||
@@ -107,7 +98,6 @@ We recommend to report the issue to the \`${pluginName}\` authors, providing the
|
||||
'docs/developer-guide/plugin.md'
|
||||
)})`,
|
||||
}),
|
||||
|
||||
EGENERATENOTESOUTPUT: ({result, pluginName}) => ({
|
||||
message: 'The `generateNotes` plugin returned an invalid value. It must return a `String`.',
|
||||
details: `The \`generateNotes\` plugin must return a \`String\`.
|
||||
@@ -122,7 +112,6 @@ We recommend to report the issue to the \`${pluginName}\` authors, providing the
|
||||
'docs/developer-guide/plugin.md'
|
||||
)})`,
|
||||
}),
|
||||
|
||||
EPUBLISHOUTPUT: ({result, pluginName}) => ({
|
||||
message: 'A `publish` plugin returned an invalid value. It must return an `Object`.',
|
||||
details: `The \`publish\` plugins must return an \`Object\`.
|
||||
@@ -137,7 +126,6 @@ We recommend to report the issue to the \`${pluginName}\` authors, providing the
|
||||
'docs/developer-guide/plugin.md'
|
||||
)})`,
|
||||
}),
|
||||
|
||||
EADDCHANNELOUTPUT: ({result, pluginName}) => ({
|
||||
message: 'A `addChannel` plugin returned an invalid value. It must return an `Object`.',
|
||||
details: `The \`addChannel\` plugins must return an \`Object\`.
|
||||
@@ -152,7 +140,6 @@ We recommend to report the issue to the \`${pluginName}\` authors, providing the
|
||||
'docs/developer-guide/plugin.md'
|
||||
)})`,
|
||||
}),
|
||||
|
||||
EINVALIDBRANCH: ({branch}) => ({
|
||||
message: 'A branch is invalid in the `branches` configuration.',
|
||||
details: `Each branch in the [branches configuration](${linkify(
|
||||
@@ -161,7 +148,6 @@ We recommend to report the issue to the \`${pluginName}\` authors, providing the
|
||||
|
||||
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
||||
}),
|
||||
|
||||
EINVALIDBRANCHNAME: ({branch}) => ({
|
||||
message: 'A branch name is invalid in the `branches` configuration.',
|
||||
details: `Each branch in the [branches configuration](${linkify(
|
||||
@@ -170,7 +156,6 @@ Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
||||
|
||||
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
||||
}),
|
||||
|
||||
EDUPLICATEBRANCHES: ({duplicates}) => ({
|
||||
message: 'The `branches` configuration has duplicate branches.',
|
||||
details: `Each branch in the [branches configuration](${linkify(
|
||||
@@ -179,7 +164,6 @@ Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
||||
|
||||
Your configuration contains duplicates for the following branch names: \`${stringify(duplicates)}\`.`,
|
||||
}),
|
||||
|
||||
EMAINTENANCEBRANCH: ({branch}) => ({
|
||||
message: 'A maintenance branch is invalid in the `branches` configuration.',
|
||||
details: `Each maintenance branch in the [branches configuration](${linkify(
|
||||
@@ -188,7 +172,6 @@ Your configuration contains duplicates for the following branch names: \`${strin
|
||||
|
||||
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
||||
}),
|
||||
|
||||
EMAINTENANCEBRANCHES: ({branches}) => ({
|
||||
message: 'The maintenance branches are invalid in the `branches` configuration.',
|
||||
details: `Each maintenance branch in the [branches configuration](${linkify(
|
||||
@@ -197,7 +180,6 @@ Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
||||
|
||||
Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
|
||||
}),
|
||||
|
||||
ERELEASEBRANCHES: ({branches}) => ({
|
||||
message: 'The release branches are invalid in the `branches` configuration.',
|
||||
details: `A minimum of 1 and a maximum of 3 release branches are required in the [branches configuration](${linkify(
|
||||
@@ -208,7 +190,6 @@ This may occur if your repository does not have a release branch, such as \`mast
|
||||
|
||||
Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
|
||||
}),
|
||||
|
||||
EPRERELEASEBRANCH: ({branch}) => ({
|
||||
message: 'A pre-release branch configuration is invalid in the `branches` configuration.',
|
||||
details: `Each pre-release branch in the [branches configuration](${linkify(
|
||||
@@ -217,7 +198,6 @@ Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
|
||||
|
||||
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
||||
}),
|
||||
|
||||
EPRERELEASEBRANCHES: ({branches}) => ({
|
||||
message: 'The pre-release branches are invalid in the `branches` configuration.',
|
||||
details: `Each pre-release branch in the [branches configuration](${linkify(
|
||||
@@ -226,7 +206,6 @@ Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
||||
|
||||
Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
|
||||
}),
|
||||
|
||||
EINVALIDNEXTVERSION: ({nextRelease: {version}, branch: {name, range}, commits, validBranches}) => ({
|
||||
message: `The release \`${version}\` on branch \`${name}\` cannot be published as it is out of range.`,
|
||||
details: `Based on the releases published on other branches, only versions within the range \`${range}\` can be published from branch \`${name}\`.
|
||||
@@ -242,7 +221,6 @@ A valid branch could be ${wordsList(validBranches.map(({name}) => `\`${name}\``)
|
||||
|
||||
See the [workflow configuration documentation](${linkify('docs/usage/workflow-configuration.md')}) for more details.`,
|
||||
}),
|
||||
|
||||
EINVALIDMAINTENANCEMERGE: ({nextRelease: {channel, gitTag, version}, branch: {mergeRange, name}}) => ({
|
||||
message: `The release \`${version}\` on branch \`${name}\` cannot be published as it is out of range.`,
|
||||
details: `Only releases within the range \`${mergeRange}\` can be merged into the maintenance branch \`${name}\` and published to the \`${channel}\` distribution channel.
|
||||
@@ -252,30 +230,3 @@ The branch \`${name}\` head should be [reset](https://git-scm.com/docs/git-reset
|
||||
See the [workflow configuration documentation](${linkify('docs/usage/workflow-configuration.md')}) for more details.`,
|
||||
}),
|
||||
};
|
||||
|
||||
export default exported;
|
||||
|
||||
export const {
|
||||
ENOGITREPO,
|
||||
ENOREPOURL,
|
||||
EGITNOPERMISSION,
|
||||
EINVALIDTAGFORMAT,
|
||||
ETAGNOVERSION,
|
||||
EPLUGINCONF,
|
||||
EPLUGINSCONF,
|
||||
EPLUGIN,
|
||||
EANALYZECOMMITSOUTPUT,
|
||||
EGENERATENOTESOUTPUT,
|
||||
EPUBLISHOUTPUT,
|
||||
EADDCHANNELOUTPUT,
|
||||
EINVALIDBRANCH,
|
||||
EINVALIDBRANCHNAME,
|
||||
EDUPLICATEBRANCHES,
|
||||
EMAINTENANCEBRANCH,
|
||||
EMAINTENANCEBRANCHES,
|
||||
ERELEASEBRANCHES,
|
||||
EPRERELEASEBRANCH,
|
||||
EPRERELEASEBRANCHES,
|
||||
EINVALIDNEXTVERSION,
|
||||
EINVALIDMAINTENANCEMERGE,
|
||||
} = exported;
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
import lodash from 'lodash'
|
||||
const {isString, isPlainObject} = lodash
|
||||
/* eslint require-atomic-updates: off */
|
||||
|
||||
import {getGitHead} from '../git.js';
|
||||
import hideSensitive from '../hide-sensitive.js';
|
||||
import {hideSensitiveValues} from '../utils.js';
|
||||
import {RELEASE_TYPE, RELEASE_NOTES_SEPARATOR} from './constants.js';
|
||||
const {isString, isPlainObject} = require('lodash');
|
||||
const {getGitHead} = require('../git');
|
||||
const hideSensitive = require('../hide-sensitive');
|
||||
const {hideSensitiveValues} = require('../utils');
|
||||
const {RELEASE_TYPE, RELEASE_NOTES_SEPARATOR} = require('./constants');
|
||||
|
||||
const exported = {
|
||||
module.exports = {
|
||||
verifyConditions: {
|
||||
required: false,
|
||||
dryRun: true,
|
||||
pipelineConfig: () => ({settleAll: true}),
|
||||
},
|
||||
|
||||
analyzeCommits: {
|
||||
default: ['@semantic-release/commit-analyzer'],
|
||||
required: true,
|
||||
@@ -30,13 +29,11 @@ const exported = {
|
||||
}, -1)
|
||||
],
|
||||
},
|
||||
|
||||
verifyRelease: {
|
||||
required: false,
|
||||
dryRun: true,
|
||||
pipelineConfig: () => ({settleAll: true}),
|
||||
},
|
||||
|
||||
generateNotes: {
|
||||
required: false,
|
||||
dryRun: true,
|
||||
@@ -52,7 +49,6 @@ const exported = {
|
||||
}),
|
||||
postprocess: (results, {env}) => hideSensitive(env)(results.filter(Boolean).join(RELEASE_NOTES_SEPARATOR)),
|
||||
},
|
||||
|
||||
prepare: {
|
||||
required: false,
|
||||
dryRun: false,
|
||||
@@ -71,7 +67,6 @@ const exported = {
|
||||
},
|
||||
}),
|
||||
},
|
||||
|
||||
publish: {
|
||||
required: false,
|
||||
dryRun: false,
|
||||
@@ -85,7 +80,6 @@ const exported = {
|
||||
}),
|
||||
}),
|
||||
},
|
||||
|
||||
addChannel: {
|
||||
required: false,
|
||||
dryRun: false,
|
||||
@@ -99,14 +93,12 @@ const exported = {
|
||||
}),
|
||||
}),
|
||||
},
|
||||
|
||||
success: {
|
||||
required: false,
|
||||
dryRun: false,
|
||||
pipelineConfig: () => ({settleAll: true}),
|
||||
preprocess: ({releases, env, ...inputs}) => ({...inputs, env, releases: hideSensitiveValues(env, releases)}),
|
||||
},
|
||||
|
||||
fail: {
|
||||
required: false,
|
||||
dryRun: false,
|
||||
@@ -114,17 +106,3 @@ const exported = {
|
||||
preprocess: ({errors, env, ...inputs}) => ({...inputs, env, errors: hideSensitiveValues(env, errors)}),
|
||||
},
|
||||
};
|
||||
|
||||
export default exported;
|
||||
|
||||
export const {
|
||||
verifyConditions,
|
||||
analyzeCommits,
|
||||
verifyRelease,
|
||||
generateNotes,
|
||||
prepare,
|
||||
publish,
|
||||
addChannel,
|
||||
success,
|
||||
fail,
|
||||
} = exported;
|
||||
|
||||
+3
-4
@@ -1,6 +1,5 @@
|
||||
import debugFactory from 'debug';
|
||||
const debug = debugFactory('semantic-release:get-commits');
|
||||
import {getCommits} from './git.js';
|
||||
const debug = require('debug')('semantic-release:get-commits');
|
||||
const {getCommits} = require('./git');
|
||||
|
||||
/**
|
||||
* Retrieve the list of commits on the current branch since the commit sha associated with the last release, or all the commits of the current branch if there is no last released version.
|
||||
@@ -9,7 +8,7 @@ import {getCommits} from './git.js';
|
||||
*
|
||||
* @return {Promise<Array<Object>>} The list of commits on the branch `branch` since the last release.
|
||||
*/
|
||||
export default async ({cwd, env, lastRelease: {gitHead: from}, nextRelease: {gitHead: to = 'HEAD'} = {}, logger}) => {
|
||||
module.exports = async ({cwd, env, lastRelease: {gitHead: from}, nextRelease: {gitHead: to = 'HEAD'} = {}, logger}) => {
|
||||
if (from) {
|
||||
debug('Use from: %s', from);
|
||||
} else {
|
||||
|
||||
+10
-12
@@ -1,18 +1,16 @@
|
||||
import lodash from 'lodash'
|
||||
const {castArray, pickBy, isNil, isString, isPlainObject} = lodash
|
||||
import readPkgUp from 'read-pkg-up';
|
||||
import {cosmiconfig} from 'cosmiconfig';
|
||||
import resolveFrom from 'resolve-from';
|
||||
import debugFactory from 'debug';
|
||||
const debug = debugFactory('semantic-release:config');
|
||||
import {repoUrl} from './git.js';
|
||||
import PLUGINS_DEFINITIONS from './definitions/plugins.js';
|
||||
import plugins from './plugins';
|
||||
import {validatePlugin, parseConfig} from './plugins/utils.js';
|
||||
const {castArray, pickBy, isNil, isString, isPlainObject} = require('lodash');
|
||||
const readPkgUp = require('read-pkg-up');
|
||||
const {cosmiconfig} = require('cosmiconfig');
|
||||
const resolveFrom = require('resolve-from');
|
||||
const debug = require('debug')('semantic-release:config');
|
||||
const {repoUrl} = require('./git');
|
||||
const PLUGINS_DEFINITIONS = require('./definitions/plugins');
|
||||
const plugins = require('./plugins');
|
||||
const {validatePlugin, parseConfig} = require('./plugins/utils');
|
||||
|
||||
const CONFIG_NAME = 'release';
|
||||
|
||||
export default async (context, cliOptions) => {
|
||||
module.exports = async (context, cliOptions) => {
|
||||
const {cwd, env} = context;
|
||||
const {config, filepath} = (await cosmiconfig(CONFIG_NAME).search(cwd)) || {};
|
||||
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import SemanticReleaseError from '@semantic-release/error';
|
||||
import ERROR_DEFINITIONS from './definitions/errors.js';
|
||||
const SemanticReleaseError = require('@semantic-release/error');
|
||||
const ERROR_DEFINITIONS = require('./definitions/errors');
|
||||
|
||||
export default (code, ctx = {}) => {
|
||||
module.exports = (code, ctx = {}) => {
|
||||
const {message, details} = ERROR_DEFINITIONS[code](ctx);
|
||||
return new SemanticReleaseError(message, code, details);
|
||||
};
|
||||
|
||||
+8
-10
@@ -1,10 +1,8 @@
|
||||
import {format} from 'url';
|
||||
import lodash from 'lodash'
|
||||
const {isNil} = lodash
|
||||
import hostedGitInfo from 'hosted-git-info';
|
||||
import {verifyAuth} from './git.js';
|
||||
import debugFactory from 'debug';
|
||||
const debug = debugFactory('semantic-release:get-git-auth-url');
|
||||
const {parse, format} = require('url'); // eslint-disable-line node/no-deprecated-api
|
||||
const {isNil} = require('lodash');
|
||||
const hostedGitInfo = require('hosted-git-info');
|
||||
const {verifyAuth} = require('./git');
|
||||
const debug = require('debug')('semantic-release:get-git-auth-url');
|
||||
|
||||
/**
|
||||
* Machinery to format a repository URL with the given credentials
|
||||
@@ -18,7 +16,7 @@ const debug = debugFactory('semantic-release:get-git-auth-url');
|
||||
function formatAuthUrl(protocol, repositoryUrl, gitCredentials) {
|
||||
const [match, auth, host, basePort, path] =
|
||||
/^(?!.+:\/\/)(?:(?<auth>.*)@)?(?<host>.*?):(?<port>\d+)?:?\/?(?<path>.*)$/.exec(repositoryUrl) || [];
|
||||
const {port, hostname, ...parsed} = new URL(
|
||||
const {port, hostname, ...parsed} = parse(
|
||||
match ? `ssh://${auth ? `${auth}@` : ''}${host}${basePort ? `:${basePort}` : ''}/${path}` : repositoryUrl
|
||||
);
|
||||
|
||||
@@ -59,7 +57,7 @@ async function ensureValidAuthUrl({cwd, env, branch}, authUrl) {
|
||||
*
|
||||
* @return {String} The formatted Git repository URL.
|
||||
*/
|
||||
export default async (context) => {
|
||||
module.exports = async (context) => {
|
||||
const {cwd, env, branch} = context;
|
||||
const GIT_TOKENS = {
|
||||
GIT_CREDENTIALS: undefined,
|
||||
@@ -77,7 +75,7 @@ export default async (context) => {
|
||||
|
||||
let {repositoryUrl} = context.options;
|
||||
const info = hostedGitInfo.fromUrl(repositoryUrl, {noGitPlus: true});
|
||||
const {protocol, ...parsed} = new URL(repositoryUrl);
|
||||
const {protocol, ...parsed} = parse(repositoryUrl);
|
||||
|
||||
if (info && info.getDefaultRepresentation() === 'shortcut') {
|
||||
// Expand shorthand URLs (such as `owner/repo` or `gitlab:owner/repo`)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import lodash from 'lodash'
|
||||
const {isUndefined} = lodash
|
||||
import semver from 'semver';
|
||||
import {makeTag, isSameChannel} from './utils.js';
|
||||
const {isUndefined} = require('lodash');
|
||||
const semver = require('semver');
|
||||
const {makeTag, isSameChannel} = require('./utils');
|
||||
|
||||
/**
|
||||
* Last release.
|
||||
@@ -27,7 +26,7 @@ import {makeTag, isSameChannel} from './utils.js';
|
||||
*
|
||||
* @return {LastRelease} The last tagged release or empty object if none is found.
|
||||
*/
|
||||
export default ({branch, options: {tagFormat}}, {before} = {}) => {
|
||||
module.exports = ({branch, options: {tagFormat}}, {before} = {}) => {
|
||||
const [{version, gitTag, channels} = {}] = branch.tags
|
||||
.filter(
|
||||
(tag) =>
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import {Signale} from 'signale';
|
||||
import figures from 'figures';
|
||||
const {Signale} = require('signale');
|
||||
const figures = require('figures');
|
||||
|
||||
export default ({stdout, stderr}) =>
|
||||
module.exports = ({stdout, stderr}) =>
|
||||
new Signale({
|
||||
config: {displayTimestamp: true, underlineMessage: false, displayLabel: false},
|
||||
disabled: false,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import semver from 'semver';
|
||||
import {FIRST_RELEASE, FIRSTPRERELEASE} from './definitions/constants.js';
|
||||
import {isSameChannel, getLatestVersion, tagsToVersions, highest} from './utils.js';
|
||||
const semver = require('semver');
|
||||
const {FIRST_RELEASE, FIRSTPRERELEASE} = require('./definitions/constants');
|
||||
const {isSameChannel, getLatestVersion, tagsToVersions, highest} = require('./utils');
|
||||
|
||||
export default ({branch, nextRelease: {type, channel}, lastRelease, logger}) => {
|
||||
module.exports = ({branch, nextRelease: {type, channel}, lastRelease, logger}) => {
|
||||
let version;
|
||||
if (lastRelease.version) {
|
||||
const {major, minor, patch} = semver.parse(lastRelease.version);
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import lodash from 'lodash'
|
||||
const {uniqBy, intersection} = lodash
|
||||
import semver from 'semver';
|
||||
import semverDiff from 'semver-diff';
|
||||
import getLastRelease from './get-last-release.js';
|
||||
import {makeTag, getLowerBound} from './utils.js';
|
||||
const {uniqBy, intersection} = require('lodash');
|
||||
const semver = require('semver');
|
||||
const semverDiff = require('semver-diff');
|
||||
const getLastRelease = require('./get-last-release');
|
||||
const {makeTag, getLowerBound} = require('./utils');
|
||||
|
||||
/**
|
||||
* Find releases that have been merged from from a higher branch but not added on the channel of the current branch.
|
||||
@@ -12,7 +11,7 @@ import {makeTag, getLowerBound} from './utils.js';
|
||||
*
|
||||
* @return {Array<Object>} Last release and next release to be added on the channel of the current branch.
|
||||
*/
|
||||
export default (context) => {
|
||||
module.exports = (context) => {
|
||||
const {
|
||||
branch,
|
||||
branches,
|
||||
|
||||
+6
-30
@@ -1,9 +1,8 @@
|
||||
import gitLogParser from 'git-log-parser';
|
||||
import getStream from 'get-stream';
|
||||
import execa from 'execa';
|
||||
import debugFactory from 'debug';
|
||||
const debug = debugFactory('semantic-release:git');
|
||||
import {GIT_NOTE_REF} from './definitions/constants.js';
|
||||
const gitLogParser = require('git-log-parser');
|
||||
const getStream = require('get-stream');
|
||||
const execa = require('execa');
|
||||
const debug = require('debug')('semantic-release:git');
|
||||
const {GIT_NOTE_REF} = require('./definitions/constants');
|
||||
|
||||
Object.assign(gitLogParser.fields, {hash: 'H', message: 'B', gitTags: 'd', committerDate: {key: 'ci', type: Date}});
|
||||
|
||||
@@ -329,30 +328,7 @@ async function addNote(note, ref, execaOptions) {
|
||||
await execa('git', ['notes', '--ref', GIT_NOTE_REF, 'add', '-f', '-m', JSON.stringify(note), ref], execaOptions);
|
||||
}
|
||||
|
||||
const exported = {
|
||||
getTagHead,
|
||||
getTags,
|
||||
getCommits,
|
||||
getBranches,
|
||||
isRefExists,
|
||||
fetch,
|
||||
fetchNotes,
|
||||
getGitHead,
|
||||
repoUrl,
|
||||
isGitRepo,
|
||||
verifyAuth,
|
||||
tag,
|
||||
push,
|
||||
pushNotes,
|
||||
verifyTagName,
|
||||
isBranchUpToDate,
|
||||
verifyBranchName,
|
||||
getNote,
|
||||
addNote,
|
||||
};
|
||||
|
||||
export default exported;
|
||||
export {
|
||||
module.exports = {
|
||||
getTagHead,
|
||||
getTags,
|
||||
getCommits,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import lodash from 'lodash'
|
||||
const {escapeRegExp, size, isString} = lodash
|
||||
import {SECRET_REPLACEMENT, SECRET_MIN_SIZE} from './definitions/constants.js';
|
||||
const {escapeRegExp, size, isString} = require('lodash');
|
||||
const {SECRET_REPLACEMENT, SECRET_MIN_SIZE} = require('./definitions/constants');
|
||||
|
||||
export default (env) => {
|
||||
module.exports = (env) => {
|
||||
const toReplace = Object.keys(env).filter((envVar) => {
|
||||
// https://github.com/semantic-release/semantic-release/issues/1558
|
||||
if (envVar === 'GOPRIVATE') {
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import lodash from 'lodash'
|
||||
const {identity, isPlainObject, omit, castArray, isNil, isString} = lodash
|
||||
import AggregateError from 'aggregate-error';
|
||||
import getError from '../get-error.js';
|
||||
import PLUGINS_DEFINITIONS from '../definitions/plugins.js';
|
||||
import {validatePlugin, validateStep, loadPlugin, parseConfig} from './utils.js';
|
||||
import pipeline from './pipeline.js';
|
||||
import normalize from './normalize.js';
|
||||
const {identity, isPlainObject, omit, castArray, isNil, isString} = require('lodash');
|
||||
const AggregateError = require('aggregate-error');
|
||||
const getError = require('../get-error');
|
||||
const PLUGINS_DEFINITIONS = require('../definitions/plugins');
|
||||
const {validatePlugin, validateStep, loadPlugin, parseConfig} = require('./utils');
|
||||
const pipeline = require('./pipeline');
|
||||
const normalize = require('./normalize');
|
||||
|
||||
export default (context, pluginsPath) => {
|
||||
module.exports = (context, pluginsPath) => {
|
||||
let {options, logger} = context;
|
||||
const errors = [];
|
||||
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import lodash from 'lodash'
|
||||
const {isPlainObject, isFunction, noop, cloneDeep, omit} = lodash
|
||||
import debugFactory from 'debug';
|
||||
const debug = debugFactory('semantic-release:plugins');
|
||||
import getError from '../get-error.js';
|
||||
import {extractErrors} from '../utils.js';
|
||||
import PLUGINS_DEFINITIONS from '../definitions/plugins.js';
|
||||
import {loadPlugin, parseConfig} from './utils.js';
|
||||
const {isPlainObject, isFunction, noop, cloneDeep, omit} = require('lodash');
|
||||
const debug = require('debug')('semantic-release:plugins');
|
||||
const getError = require('../get-error');
|
||||
const {extractErrors} = require('../utils');
|
||||
const PLUGINS_DEFINITIONS = require('../definitions/plugins');
|
||||
const {loadPlugin, parseConfig} = require('./utils');
|
||||
|
||||
export default (context, type, pluginOpt, pluginsPath) => {
|
||||
module.exports = (context, type, pluginOpt, pluginsPath) => {
|
||||
const {stdout, stderr, options, logger} = context;
|
||||
if (!pluginOpt) {
|
||||
return noop;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import lodash from 'lodash'
|
||||
const {identity} = lodash
|
||||
import pReduce from 'p-reduce';
|
||||
import AggregateError from 'aggregate-error';
|
||||
import {extractErrors} from '../utils.js';
|
||||
const {identity} = require('lodash');
|
||||
const pReduce = require('p-reduce');
|
||||
const AggregateError = require('aggregate-error');
|
||||
const {extractErrors} = require('../utils');
|
||||
|
||||
/**
|
||||
* A Function that execute a list of function sequencially. If at least one Function ins the pipeline throws an Error or rejects, the pipeline function rejects as well.
|
||||
@@ -26,7 +25,7 @@ import {extractErrors} from '../utils.js';
|
||||
*
|
||||
* @return {Pipeline} A Function that execute the `steps` sequencially
|
||||
*/
|
||||
export default (steps, {settleAll = false, getNextInput = identity, transform = identity} = {}) => async (input) => {
|
||||
module.exports = (steps, {settleAll = false, getNextInput = identity, transform = identity} = {}) => async (input) => {
|
||||
const results = [];
|
||||
const errors = [];
|
||||
await pReduce(
|
||||
|
||||
+4
-13
@@ -1,7 +1,6 @@
|
||||
import {dirname} from 'path';
|
||||
import lodash from 'lodash'
|
||||
const {isString, isFunction, castArray, isArray, isPlainObject, isNil} = lodash
|
||||
import resolveFrom from 'resolve-from';
|
||||
const {dirname} = require('path');
|
||||
const {isString, isFunction, castArray, isArray, isPlainObject, isNil} = require('lodash');
|
||||
const resolveFrom = require('resolve-from');
|
||||
|
||||
const validateSteps = (conf) => {
|
||||
return conf.every((conf) => {
|
||||
@@ -66,12 +65,4 @@ function parseConfig(plugin) {
|
||||
return [path, config || {}];
|
||||
}
|
||||
|
||||
const exported = {
|
||||
validatePlugin,
|
||||
validateStep,
|
||||
loadPlugin,
|
||||
parseConfig,
|
||||
};
|
||||
|
||||
export default exported;
|
||||
export {validatePlugin, validateStep, loadPlugin, parseConfig};
|
||||
module.exports = {validatePlugin, validateStep, loadPlugin, parseConfig};
|
||||
|
||||
+4
-24
@@ -1,7 +1,6 @@
|
||||
import lodash from 'lodash'
|
||||
const {isFunction, union, template} = lodash
|
||||
import semver from 'semver';
|
||||
import hideSensitive from './hide-sensitive.js';
|
||||
const {isFunction, union, template} = require('lodash');
|
||||
const semver = require('semver');
|
||||
const hideSensitive = require('./hide-sensitive');
|
||||
|
||||
function extractErrors(err) {
|
||||
return err && isFunction(err[Symbol.iterator]) ? [...err] : [err];
|
||||
@@ -83,26 +82,7 @@ function isSameChannel(channel, otherChannel) {
|
||||
return channel === otherChannel || (!channel && !otherChannel);
|
||||
}
|
||||
|
||||
const exported = {
|
||||
extractErrors,
|
||||
hideSensitiveValues,
|
||||
tagsToVersions,
|
||||
isMajorRange,
|
||||
isMaintenanceRange,
|
||||
getUpperBound,
|
||||
getLowerBound,
|
||||
highest,
|
||||
lowest,
|
||||
getLatestVersion,
|
||||
getEarliestVersion,
|
||||
getFirstVersion,
|
||||
getRange,
|
||||
makeTag,
|
||||
isSameChannel,
|
||||
};
|
||||
|
||||
export default exported;
|
||||
export {
|
||||
module.exports = {
|
||||
extractErrors,
|
||||
hideSensitiveValues,
|
||||
tagsToVersions,
|
||||
|
||||
+5
-6
@@ -1,10 +1,9 @@
|
||||
import lodash from 'lodash'
|
||||
const {template, isString, isPlainObject} = lodash
|
||||
import AggregateError from 'aggregate-error';
|
||||
import {isGitRepo, verifyTagName} from './git.js';
|
||||
import getError from './get-error.js';
|
||||
const {template, isString, isPlainObject} = require('lodash');
|
||||
const AggregateError = require('aggregate-error');
|
||||
const {isGitRepo, verifyTagName} = require('./git');
|
||||
const getError = require('./get-error');
|
||||
|
||||
export default async (context) => {
|
||||
module.exports = async (context) => {
|
||||
const {
|
||||
cwd,
|
||||
env,
|
||||
|
||||
Generated
+22037
-6246
File diff suppressed because it is too large
Load Diff
+17
-20
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"name": "semantic-release",
|
||||
"type": "module",
|
||||
"description": "Automated semver compliant package publishing",
|
||||
"version": "0.0.0-development",
|
||||
"author": "Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)",
|
||||
@@ -21,11 +20,11 @@
|
||||
"Pierre Vanduynslager (https://twitter.com/@pvdlg_)"
|
||||
],
|
||||
"dependencies": {
|
||||
"@semantic-release/commit-analyzer": "^8.0.0",
|
||||
"@semantic-release/error": "^2.2.0",
|
||||
"@semantic-release/github": "^7.0.0",
|
||||
"@semantic-release/npm": "^7.0.0",
|
||||
"@semantic-release/release-notes-generator": "^9.0.0",
|
||||
"@semantic-release/commit-analyzer": "^9.0.2",
|
||||
"@semantic-release/error": "^3.0.0",
|
||||
"@semantic-release/github": "^8.0.0",
|
||||
"@semantic-release/npm": "^9.0.0-beta.1",
|
||||
"@semantic-release/release-notes-generator": "^10.0.0",
|
||||
"aggregate-error": "^3.0.0",
|
||||
"cosmiconfig": "^7.0.0",
|
||||
"debug": "^4.0.0",
|
||||
@@ -38,8 +37,8 @@
|
||||
"hook-std": "^2.0.0",
|
||||
"hosted-git-info": "^4.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"marked": "^2.0.0",
|
||||
"marked-terminal": "^4.1.1",
|
||||
"marked": "^4.0.10",
|
||||
"marked-terminal": "^5.0.0",
|
||||
"micromatch": "^4.0.2",
|
||||
"p-each-series": "^2.1.0",
|
||||
"p-reduce": "^2.0.0",
|
||||
@@ -52,27 +51,26 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "3.15.0",
|
||||
"cjs2esm": "^2.0.0",
|
||||
"clear-module": "4.1.1",
|
||||
"codecov": "3.8.2",
|
||||
"clear-module": "4.1.2",
|
||||
"codecov": "3.8.3",
|
||||
"delay": "5.0.0",
|
||||
"dockerode": "3.3.0",
|
||||
"dockerode": "3.3.1",
|
||||
"file-url": "3.0.0",
|
||||
"fs-extra": "10.0.0",
|
||||
"got": "11.8.2",
|
||||
"fs-extra": "9.1.0",
|
||||
"got": "11.8.3",
|
||||
"js-yaml": "4.1.0",
|
||||
"mockserver-client": "5.11.2",
|
||||
"nock": "13.1.1",
|
||||
"nock": "13.2.1",
|
||||
"nyc": "15.1.0",
|
||||
"p-retry": "4.6.1",
|
||||
"proxyquire": "2.1.3",
|
||||
"sinon": "11.1.1",
|
||||
"sinon": "12.0.1",
|
||||
"stream-buffers": "3.0.2",
|
||||
"tempy": "1.0.1",
|
||||
"xo": "0.29.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
"node": ">=16 || ^14.17"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
@@ -94,7 +92,7 @@
|
||||
"version"
|
||||
],
|
||||
"license": "MIT",
|
||||
"exports": "./index.js",
|
||||
"main": "index.js",
|
||||
"nyc": {
|
||||
"include": [
|
||||
"lib/**/*.js",
|
||||
@@ -131,8 +129,7 @@
|
||||
"prettier": true,
|
||||
"space": true,
|
||||
"rules": {
|
||||
"unicorn/string-content": "off",
|
||||
"import/extensions": "off"
|
||||
"unicorn/string-content": "off"
|
||||
}
|
||||
},
|
||||
"renovate": {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import test from 'ava';
|
||||
import lodash from 'lodash'
|
||||
const {union} = lodash
|
||||
import semver from 'semver';
|
||||
import proxyquire from 'proxyquire';
|
||||
const test = require('ava');
|
||||
const {union} = require('lodash');
|
||||
const semver = require('semver');
|
||||
const proxyquire = require('proxyquire');
|
||||
|
||||
const getBranch = (branches, branch) => branches.find(({name}) => name === branch);
|
||||
const release = (branches, name, version) => getBranch(branches, name).tags.push({version});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import test from 'ava';
|
||||
import expand from '../../lib/branches/expand.js';
|
||||
import {gitRepo, gitCommits, gitCheckout, gitPush} from '../helpers/git-utils.js';
|
||||
const test = require('ava');
|
||||
const expand = require('../../lib/branches/expand');
|
||||
const {gitRepo, gitCommits, gitCheckout, gitPush} = require('../helpers/git-utils');
|
||||
|
||||
test('Expand branches defined with globs', async (t) => {
|
||||
const {cwd, repositoryUrl} = await gitRepo(true);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import test from 'ava';
|
||||
import getTags from '../../lib/branches/get-tags.js';
|
||||
import {gitRepo, gitCommits, gitTagVersion, gitCheckout, gitAddNote} from '../helpers/git-utils.js';
|
||||
const test = require('ava');
|
||||
const getTags = require('../../lib/branches/get-tags');
|
||||
const {gitRepo, gitCommits, gitTagVersion, gitCheckout, gitAddNote} = require('../helpers/git-utils');
|
||||
|
||||
test('Get the valid tags', async (t) => {
|
||||
const {cwd} = await gitRepo();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import test from 'ava';
|
||||
import normalize from '../../lib/branches/normalize.js';
|
||||
const test = require('ava');
|
||||
const normalize = require('../../lib/branches/normalize');
|
||||
|
||||
const toTags = (versions) => versions.map((version) => ({version}));
|
||||
|
||||
|
||||
+16
-17
@@ -1,17 +1,16 @@
|
||||
import test from 'ava';
|
||||
import lodash from 'lodash'
|
||||
const {escapeRegExp} = lodash
|
||||
const test = require('ava');
|
||||
const {escapeRegExp} = require('lodash');
|
||||
const proxyquire = require('proxyquire').noPreserveCache();
|
||||
import sinon from 'sinon';
|
||||
import {SECRET_REPLACEMENT} from '../lib/definitions/constants.js';
|
||||
const {stub} = require('sinon');
|
||||
const {SECRET_REPLACEMENT} = require('../lib/definitions/constants');
|
||||
|
||||
test.beforeEach((t) => {
|
||||
t.context.logs = '';
|
||||
t.context.errors = '';
|
||||
t.context.stdout = sinon.stubprocess.stdout, 'write').callsFake((value) => {
|
||||
t.context.stdout = stub(process.stdout, 'write').callsFake((value) => {
|
||||
t.context.logs += value.toString();
|
||||
});
|
||||
t.context.stderr = sinon.stubprocess.stderr, 'write').callsFake((value) => {
|
||||
t.context.stderr = stub(process.stderr, 'write').callsFake((value) => {
|
||||
t.context.errors += value.toString();
|
||||
});
|
||||
});
|
||||
@@ -22,7 +21,7 @@ test.afterEach.always((t) => {
|
||||
});
|
||||
|
||||
test.serial('Pass options to semantic-release API', async (t) => {
|
||||
const run = sinon.stub).resolves(true);
|
||||
const run = stub().resolves(true);
|
||||
const argv = [
|
||||
'',
|
||||
'',
|
||||
@@ -88,7 +87,7 @@ test.serial('Pass options to semantic-release API', async (t) => {
|
||||
});
|
||||
|
||||
test.serial('Pass options to semantic-release API with alias arguments', async (t) => {
|
||||
const run = sinon.stub).resolves(true);
|
||||
const run = stub().resolves(true);
|
||||
const argv = [
|
||||
'',
|
||||
'',
|
||||
@@ -121,7 +120,7 @@ test.serial('Pass options to semantic-release API with alias arguments', async (
|
||||
});
|
||||
|
||||
test.serial('Pass unknown options to semantic-release API', async (t) => {
|
||||
const run = sinon.stub).resolves(true);
|
||||
const run = stub().resolves(true);
|
||||
const argv = ['', '', '--bool', '--first-option', 'value1', '--second-option', 'value2', '--second-option', 'value3'];
|
||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
||||
|
||||
@@ -135,7 +134,7 @@ test.serial('Pass unknown options to semantic-release API', async (t) => {
|
||||
});
|
||||
|
||||
test.serial('Pass empty Array to semantic-release API for list option set to "false"', async (t) => {
|
||||
const run = sinon.stub).resolves(true);
|
||||
const run = stub().resolves(true);
|
||||
const argv = ['', '', '--publish', 'false'];
|
||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
||||
|
||||
@@ -147,7 +146,7 @@ test.serial('Pass empty Array to semantic-release API for list option set to "fa
|
||||
});
|
||||
|
||||
test.serial('Do not set properties in option for which arg is not in command line', async (t) => {
|
||||
const run = sinon.stub).resolves(true);
|
||||
const run = stub().resolves(true);
|
||||
const argv = ['', '', '-b', 'master'];
|
||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
||||
|
||||
@@ -164,7 +163,7 @@ test.serial('Do not set properties in option for which arg is not in command lin
|
||||
});
|
||||
|
||||
test.serial('Display help', async (t) => {
|
||||
const run = sinon.stub).resolves(true);
|
||||
const run = stub().resolves(true);
|
||||
const argv = ['', '', '--help'];
|
||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
||||
|
||||
@@ -175,7 +174,7 @@ test.serial('Display help', async (t) => {
|
||||
});
|
||||
|
||||
test.serial('Return error exitCode and prints help if called with a command', async (t) => {
|
||||
const run = sinon.stub).resolves(true);
|
||||
const run = stub().resolves(true);
|
||||
const argv = ['', '', 'pre'];
|
||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
||||
|
||||
@@ -187,7 +186,7 @@ test.serial('Return error exitCode and prints help if called with a command', as
|
||||
});
|
||||
|
||||
test.serial('Return error exitCode if multiple plugin are set for single plugin', async (t) => {
|
||||
const run = sinon.stub).resolves(true);
|
||||
const run = stub().resolves(true);
|
||||
const argv = ['', '', '--analyze-commits', 'analyze1', 'analyze2'];
|
||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
||||
|
||||
@@ -199,7 +198,7 @@ test.serial('Return error exitCode if multiple plugin are set for single plugin'
|
||||
});
|
||||
|
||||
test.serial('Return error exitCode if semantic-release throw error', async (t) => {
|
||||
const run = sinon.stub).rejects(new Error('semantic-release error'));
|
||||
const run = stub().rejects(new Error('semantic-release error'));
|
||||
const argv = ['', ''];
|
||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
||||
|
||||
@@ -211,7 +210,7 @@ test.serial('Return error exitCode if semantic-release throw error', async (t) =
|
||||
|
||||
test.serial('Hide sensitive environment variable values from the logs', async (t) => {
|
||||
const env = {MY_TOKEN: 'secret token'};
|
||||
const run = sinon.stub).rejects(new Error(`Throw error: Exposing token ${env.MY_TOKEN}`));
|
||||
const run = stub().rejects(new Error(`Throw error: Exposing token ${env.MY_TOKEN}`));
|
||||
const argv = ['', ''];
|
||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv, env: {...process.env, ...env}}});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import test from 'ava';
|
||||
import {maintenance, prerelease, release} from '../../lib/definitions/branches.js';
|
||||
const test = require('ava');
|
||||
const {maintenance, prerelease, release} = require('../../lib/definitions/branches');
|
||||
|
||||
test('A "maintenance" branch is identified by having a "range" property or a "name" formatted like "N.x", "N.x.x" or "N.N.x"', (t) => {
|
||||
t.true(maintenance.filter({name: '1.x.x'}));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import test from 'ava';
|
||||
import plugins from '../../lib/definitions/plugins.js';
|
||||
import {RELEASE_NOTES_SEPARATOR, SECRET_REPLACEMENT} from '../../lib/definitions/constants.js';
|
||||
const test = require('ava');
|
||||
const plugins = require('../../lib/definitions/plugins');
|
||||
const {RELEASE_NOTES_SEPARATOR, SECRET_REPLACEMENT} = require('../../lib/definitions/constants');
|
||||
|
||||
test('The "analyzeCommits" plugin output must be either undefined or a valid semver release type', (t) => {
|
||||
t.false(plugins.analyzeCommits.outputValidator('invalid'));
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
export default () => {};
|
||||
module.exports = () => {};
|
||||
|
||||
Vendored
+1
-5
@@ -1,4 +1,4 @@
|
||||
const exported = {
|
||||
module.exports = {
|
||||
verifyConditions: () => {},
|
||||
getLastRelease: () => {},
|
||||
analyzeCommits: () => {},
|
||||
@@ -6,7 +6,3 @@ const exported = {
|
||||
generateNotes: () => {},
|
||||
publish: () => {},
|
||||
};
|
||||
|
||||
export default exported;
|
||||
|
||||
export const {verifyConditions, getLastRelease, analyzeCommits, verifyRelease, generateNotes, publish} = exported;
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
import SemanticReleaseError from '@semantic-release/error';
|
||||
const SemanticReleaseError = require('@semantic-release/error');
|
||||
|
||||
class InheritedError extends SemanticReleaseError {
|
||||
constructor(message, code) {
|
||||
@@ -9,6 +9,6 @@ class InheritedError extends SemanticReleaseError {
|
||||
}
|
||||
}
|
||||
|
||||
export default () => {
|
||||
module.exports = () => {
|
||||
throw new InheritedError('Inherited error', 'EINHERITED');
|
||||
};
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
export default () => {
|
||||
module.exports = () => {
|
||||
const error = new Error('a');
|
||||
error.errorProperty = 'errorProperty';
|
||||
throw error;
|
||||
|
||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
||||
import AggregateError from 'aggregate-error';
|
||||
const AggregateError = require('aggregate-error');
|
||||
|
||||
export default () => {
|
||||
module.exports = () => {
|
||||
throw new AggregateError([new Error('a'), new Error('b')]);
|
||||
};
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
export default (pluginConfig, context) => context;
|
||||
module.exports = (pluginConfig, context) => context;
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
export default (pluginConfig, {env, logger}) => {
|
||||
module.exports = (pluginConfig, {env, logger}) => {
|
||||
console.log(`Console: Exposing token ${env.MY_TOKEN}`);
|
||||
logger.log(`Log: Exposing token ${env.MY_TOKEN}`);
|
||||
logger.error(`Error: Console token ${env.MY_TOKEN}`);
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
export default () => {};
|
||||
module.exports = () => {};
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
export default (pluginConfig, context) => ({pluginConfig, context});
|
||||
module.exports = (pluginConfig, context) => ({pluginConfig, context});
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import test from 'ava';
|
||||
import sinon from 'sinon';
|
||||
import getCommits from '../lib/get-commits.js';
|
||||
import {gitRepo, gitCommits, gitDetachedHead} from './helpers/git-utils.js';
|
||||
const test = require('ava');
|
||||
const {stub} = require('sinon');
|
||||
const getCommits = require('../lib/get-commits');
|
||||
const {gitRepo, gitCommits, gitDetachedHead} = require('./helpers/git-utils');
|
||||
|
||||
test.beforeEach((t) => {
|
||||
// Stub the logger functions
|
||||
t.context.log = sinon.stub();
|
||||
t.context.error = sinon.stub();
|
||||
t.context.log = stub();
|
||||
t.context.error = stub();
|
||||
t.context.logger = {log: t.context.log, error: t.context.error};
|
||||
});
|
||||
|
||||
|
||||
+10
-11
@@ -1,13 +1,12 @@
|
||||
import path from 'path';
|
||||
import {format} from 'util';
|
||||
import test from 'ava';
|
||||
import {writeFile, outputJson} from 'fs-extra';
|
||||
import lodash from 'lodash'
|
||||
const {omit} = lodash
|
||||
import proxyquire from 'proxyquire';
|
||||
import sinon from 'sinon';
|
||||
import yaml from 'js-yaml';
|
||||
import {gitRepo, gitTagVersion, gitCommits, gitShallowClone, gitAddConfig} from './helpers/git-utils.js';
|
||||
const path = require('path');
|
||||
const {format} = require('util');
|
||||
const test = require('ava');
|
||||
const {writeFile, outputJson} = require('fs-extra');
|
||||
const {omit} = require('lodash');
|
||||
const proxyquire = require('proxyquire');
|
||||
const {stub} = require('sinon');
|
||||
const yaml = require('js-yaml');
|
||||
const {gitRepo, gitTagVersion, gitCommits, gitShallowClone, gitAddConfig} = require('./helpers/git-utils');
|
||||
|
||||
const DEFAULT_PLUGINS = [
|
||||
'@semantic-release/commit-analyzer',
|
||||
@@ -17,7 +16,7 @@ const DEFAULT_PLUGINS = [
|
||||
];
|
||||
|
||||
test.beforeEach((t) => {
|
||||
t.context.plugins = sinon.stub).returns({});
|
||||
t.context.plugins = stub().returns({});
|
||||
t.context.getConfig = proxyquire('../lib/get-config', {'./plugins': t.context.plugins});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import test from 'ava';
|
||||
import getAuthUrl from '../lib/get-git-auth-url.js';
|
||||
import {gitRepo} from './helpers/git-utils.js';
|
||||
const test = require('ava');
|
||||
const getAuthUrl = require('../lib/get-git-auth-url');
|
||||
const {gitRepo} = require('./helpers/git-utils');
|
||||
|
||||
const env = {GIT_ASKPASS: 'echo', GIT_TERMINAL_PROMPT: 0};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import test from 'ava';
|
||||
import getLastRelease from '../lib/get-last-release.js';
|
||||
const test = require('ava');
|
||||
const getLastRelease = require('../lib/get-last-release');
|
||||
|
||||
test('Get the highest non-prerelease valid tag', (t) => {
|
||||
const result = getLastRelease({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import test from 'ava';
|
||||
import {spy} from 'sinon';
|
||||
import getLogger from '../lib/get-logger.js';
|
||||
const test = require('ava');
|
||||
const {spy} = require('sinon');
|
||||
const getLogger = require('../lib/get-logger');
|
||||
|
||||
test('Expose "error", "success" and "log" functions', (t) => {
|
||||
const stdout = spy();
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import test from 'ava';
|
||||
import sinon from 'sinon';
|
||||
import getNextVersion from '../lib/get-next-version.js';
|
||||
const test = require('ava');
|
||||
const {stub} = require('sinon');
|
||||
const getNextVersion = require('../lib/get-next-version');
|
||||
|
||||
test.beforeEach((t) => {
|
||||
// Stub the logger functions
|
||||
t.context.log = sinon.stub);
|
||||
t.context.log = stub();
|
||||
t.context.logger = {log: t.context.log};
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import test from 'ava';
|
||||
import getReleaseToAdd from '../lib/get-release-to-add.js';
|
||||
const test = require('ava');
|
||||
const getReleaseToAdd = require('../lib/get-release-to-add');
|
||||
|
||||
test('Return versions merged from release to maintenance branch, excluding lower than branch start range', (t) => {
|
||||
const result = getReleaseToAdd({
|
||||
|
||||
+6
-8
@@ -1,7 +1,6 @@
|
||||
import test from 'ava';
|
||||
import tempy from 'tempy';
|
||||
|
||||
import {
|
||||
const test = require('ava');
|
||||
const tempy = require('tempy');
|
||||
const {
|
||||
getTagHead,
|
||||
isRefExists,
|
||||
fetch,
|
||||
@@ -17,9 +16,8 @@ import {
|
||||
getNote,
|
||||
addNote,
|
||||
fetchNotes,
|
||||
} from '../lib/git.js';
|
||||
|
||||
import {
|
||||
} = require('../lib/git');
|
||||
const {
|
||||
gitRepo,
|
||||
gitCommits,
|
||||
gitCheckout,
|
||||
@@ -36,7 +34,7 @@ import {
|
||||
gitGetNote,
|
||||
gitFetch,
|
||||
initGit,
|
||||
} from './helpers/git-utils.js';
|
||||
} = require('./helpers/git-utils');
|
||||
|
||||
test('Get the last commit sha', async (t) => {
|
||||
// Create a git repository, set the current working directory at the root of the repo
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
storage: /verdaccio/storage/data
|
||||
plugins: /verdaccio/plugins
|
||||
web:
|
||||
title: Verdaccio
|
||||
auth:
|
||||
htpasswd:
|
||||
file: /verdaccio/storage/htpasswd
|
||||
packages:
|
||||
'@*/*':
|
||||
access: $all
|
||||
publish: $authenticated
|
||||
unpublish: $authenticated
|
||||
'**':
|
||||
access: $all
|
||||
publish: $authenticated
|
||||
unpublish: $authenticated
|
||||
server:
|
||||
keepAliveTimeout: 60
|
||||
middlewares:
|
||||
audit:
|
||||
enabled: true
|
||||
logs:
|
||||
- { type: stdout, format: pretty, level: http }
|
||||
@@ -1,10 +1,10 @@
|
||||
import tempy from 'tempy';
|
||||
import execa from 'execa';
|
||||
import fileUrl from 'file-url';
|
||||
import pEachSeries from 'p-each-series';
|
||||
import gitLogParser from 'git-log-parser';
|
||||
import getStream from 'get-stream';
|
||||
import {GIT_NOTE_REF} from '../../lib/definitions/constants.js';
|
||||
const tempy = require('tempy');
|
||||
const execa = require('execa');
|
||||
const fileUrl = require('file-url');
|
||||
const pEachSeries = require('p-each-series');
|
||||
const gitLogParser = require('git-log-parser');
|
||||
const getStream = require('get-stream');
|
||||
const {GIT_NOTE_REF} = require('../../lib/definitions/constants');
|
||||
|
||||
/**
|
||||
* Commit message information.
|
||||
@@ -323,33 +323,7 @@ async function gitGetNote(ref, execaOptions) {
|
||||
return (await execa('git', ['notes', '--ref', GIT_NOTE_REF, 'show', ref], execaOptions)).stdout;
|
||||
}
|
||||
|
||||
const exported = {
|
||||
initGit,
|
||||
gitRepo,
|
||||
initBareRepo,
|
||||
gitCommits,
|
||||
gitGetCommits,
|
||||
gitCheckout,
|
||||
gitFetch,
|
||||
gitHead,
|
||||
gitTagVersion,
|
||||
gitShallowClone,
|
||||
gitDetachedHead,
|
||||
gitDetachedHeadFromBranch,
|
||||
gitAddConfig,
|
||||
gitTagHead,
|
||||
gitRemoteTagHead,
|
||||
gitCommitTag,
|
||||
gitPush,
|
||||
merge,
|
||||
mergeFf,
|
||||
rebase,
|
||||
gitAddNote,
|
||||
gitGetNote,
|
||||
};
|
||||
|
||||
export default exported;
|
||||
export {
|
||||
module.exports = {
|
||||
initGit,
|
||||
gitRepo,
|
||||
initBareRepo,
|
||||
|
||||
+5
-13
@@ -1,7 +1,7 @@
|
||||
import Docker from 'dockerode';
|
||||
import getStream from 'get-stream';
|
||||
import pRetry from 'p-retry';
|
||||
import {initBareRepo, gitShallowClone} from './git-utils.js';
|
||||
const Docker = require('dockerode');
|
||||
const getStream = require('get-stream');
|
||||
const pRetry = require('p-retry');
|
||||
const {initBareRepo, gitShallowClone} = require('./git-utils');
|
||||
|
||||
const IMAGE = 'pvdlg/docker-gitbox:latest';
|
||||
const SERVER_PORT = 80;
|
||||
@@ -69,12 +69,4 @@ async function createRepo(name, branch = 'master', description = `Repository ${n
|
||||
return {cwd, repositoryUrl, authUrl};
|
||||
}
|
||||
|
||||
const exported = {
|
||||
start,
|
||||
stop,
|
||||
gitCredential,
|
||||
createRepo,
|
||||
};
|
||||
|
||||
export default exported;
|
||||
export {start, stop, gitCredential, createRepo};
|
||||
module.exports = {start, stop, gitCredential, createRepo};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import Docker from 'dockerode';
|
||||
import getStream from 'get-stream';
|
||||
import got from 'got';
|
||||
import pRetry from 'p-retry';
|
||||
import {mockServerClient} from 'mockserver-client';
|
||||
const Docker = require('dockerode');
|
||||
const getStream = require('get-stream');
|
||||
const got = require('got');
|
||||
const pRetry = require('p-retry');
|
||||
const {mockServerClient} = require('mockserver-client');
|
||||
|
||||
const IMAGE = 'jamesdbloom/mockserver:latest';
|
||||
const MOCK_SERVER_PORT = 1080;
|
||||
@@ -100,13 +100,4 @@ function verify(expectation) {
|
||||
return client.verify(expectation);
|
||||
}
|
||||
|
||||
const exported = {
|
||||
start,
|
||||
stop,
|
||||
mock,
|
||||
verify,
|
||||
url,
|
||||
};
|
||||
|
||||
export default exported;
|
||||
export {start, stop, mock, verify, url};
|
||||
module.exports = {start, stop, mock, verify, url};
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import Docker from 'dockerode';
|
||||
import getStream from 'get-stream';
|
||||
import got from 'got';
|
||||
import delay from 'delay';
|
||||
import pRetry from 'p-retry';
|
||||
const Docker = require('dockerode');
|
||||
const getStream = require('get-stream');
|
||||
const got = require('got');
|
||||
const path = require('path');
|
||||
const delay = require('delay');
|
||||
const pRetry = require('p-retry');
|
||||
|
||||
const IMAGE = 'semanticrelease/npm-registry-docker:latest';
|
||||
const SERVER_PORT = 15986;
|
||||
const COUCHDB_PORT = 5984;
|
||||
const SERVER_HOST = 'localhost';
|
||||
const COUCHDB_USER = 'admin';
|
||||
const COUCHDB_PASSWORD = 'password';
|
||||
const IMAGE = 'verdaccio/verdaccio:4';
|
||||
const REGISTRY_PORT = 4873;
|
||||
const REGISTRY_HOST = 'localhost';
|
||||
const NPM_USERNAME = 'integration';
|
||||
const NPM_PASSWORD = 'suchsecure';
|
||||
const NPM_EMAIL = 'integration@test.com';
|
||||
@@ -25,8 +23,8 @@ async function start() {
|
||||
container = await docker.createContainer({
|
||||
Tty: true,
|
||||
Image: IMAGE,
|
||||
PortBindings: {[`${COUCHDB_PORT}/tcp`]: [{HostPort: `${SERVER_PORT}`}]},
|
||||
Env: [`COUCHDB_USER=${COUCHDB_USER}`, `COUCHDB_PASSWORD=${COUCHDB_PASSWORD}`],
|
||||
PortBindings: {[`${REGISTRY_PORT}/tcp`]: [{HostPort: `${REGISTRY_PORT}`}]},
|
||||
Binds: [`${path.join(__dirname, 'config.yaml')}:/verdaccio/conf/config.yaml`],
|
||||
});
|
||||
|
||||
await container.start();
|
||||
@@ -34,7 +32,7 @@ async function start() {
|
||||
|
||||
try {
|
||||
// Wait for the registry to be ready
|
||||
await pRetry(() => got(`http://${SERVER_HOST}:${SERVER_PORT}/registry/_design/app`, {cache: false}), {
|
||||
await pRetry(() => got(`http://${REGISTRY_HOST}:${REGISTRY_PORT}/`, {cache: false}), {
|
||||
retries: 7,
|
||||
minTimeout: 1000,
|
||||
factor: 2,
|
||||
@@ -44,9 +42,7 @@ async function start() {
|
||||
}
|
||||
|
||||
// Create user
|
||||
await got(`http://${SERVER_HOST}:${SERVER_PORT}/_users/org.couchdb.user:${NPM_USERNAME}`, {
|
||||
username: COUCHDB_USER,
|
||||
password: COUCHDB_PASSWORD,
|
||||
await got(`http://${REGISTRY_HOST}:${REGISTRY_PORT}/-/user/org.couchdb.user:${NPM_USERNAME}`, {
|
||||
method: 'PUT',
|
||||
json: {
|
||||
_id: `org.couchdb.user:${NPM_USERNAME}`,
|
||||
@@ -59,7 +55,7 @@ async function start() {
|
||||
});
|
||||
}
|
||||
|
||||
const url = `http://${SERVER_HOST}:${SERVER_PORT}/registry/_design/app/_rewrite/`;
|
||||
const url = `http://${REGISTRY_HOST}:${REGISTRY_PORT}/`;
|
||||
|
||||
const authEnv = {
|
||||
npm_config_registry: url, // eslint-disable-line camelcase
|
||||
@@ -76,12 +72,4 @@ async function stop() {
|
||||
await container.remove();
|
||||
}
|
||||
|
||||
const exported = {
|
||||
start,
|
||||
stop,
|
||||
authEnv,
|
||||
url,
|
||||
};
|
||||
|
||||
export default exported;
|
||||
export {start, stop, authEnv, url};
|
||||
module.exports = {start, stop, authEnv, url};
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import execa from 'execa';
|
||||
const execa = require('execa');
|
||||
|
||||
async function npmView(packageName, env) {
|
||||
return JSON.parse((await execa('npm', ['view', packageName, '--json'], {env})).stdout);
|
||||
}
|
||||
|
||||
const exported = {
|
||||
npmView,
|
||||
};
|
||||
|
||||
export default exported;
|
||||
export {npmView};
|
||||
module.exports = {npmView};
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import test from 'ava';
|
||||
import lodash from 'lodash'
|
||||
const {repeat} = lodash
|
||||
import hideSensitive from '../lib/hide-sensitive.js';
|
||||
import {SECRET_REPLACEMENT, SECRET_MIN_SIZE} from '../lib/definitions/constants.js';
|
||||
const test = require('ava');
|
||||
const {repeat} = require('lodash');
|
||||
const hideSensitive = require('../lib/hide-sensitive');
|
||||
const {SECRET_REPLACEMENT, SECRET_MIN_SIZE} = require('../lib/definitions/constants');
|
||||
|
||||
test('Replace multiple sensitive environment variable values', (t) => {
|
||||
const env = {SOME_PASSWORD: 'password', SOME_TOKEN: 'secret'};
|
||||
|
||||
+214
-216
@@ -1,15 +1,13 @@
|
||||
import test from 'ava';
|
||||
import lodash from 'lodash'
|
||||
const {escapeRegExp, isString, sortBy, omit} = lodash
|
||||
import proxyquire from 'proxyquire';
|
||||
import sinon from 'sinon';
|
||||
import {WritableStreamBuffer} from 'stream-buffers';
|
||||
import AggregateError from 'aggregate-error';
|
||||
import SemanticReleaseError from '@semantic-release/error';
|
||||
import {COMMIT_NAME, COMMIT_EMAIL, SECRET_REPLACEMENT} from '../lib/definitions/constants.js';
|
||||
|
||||
import {
|
||||
gitHead as getGitHead,
|
||||
const test = require('ava');
|
||||
const {escapeRegExp, isString, sortBy, omit} = require('lodash');
|
||||
const proxyquire = require('proxyquire');
|
||||
const {spy, stub} = require('sinon');
|
||||
const {WritableStreamBuffer} = require('stream-buffers');
|
||||
const AggregateError = require('aggregate-error');
|
||||
const SemanticReleaseError = require('@semantic-release/error');
|
||||
const {COMMIT_NAME, COMMIT_EMAIL, SECRET_REPLACEMENT} = require('../lib/definitions/constants');
|
||||
const {
|
||||
gitHead: getGitHead,
|
||||
gitCheckout,
|
||||
gitTagHead,
|
||||
gitRepo,
|
||||
@@ -23,17 +21,17 @@ import {
|
||||
rebase,
|
||||
gitAddNote,
|
||||
gitGetNote,
|
||||
} from './helpers/git-utils.js';
|
||||
} = require('./helpers/git-utils');
|
||||
|
||||
const requireNoCache = proxyquire.noPreserveCache();
|
||||
const pluginNoop = require.resolve('./fixtures/plugin-noop');
|
||||
|
||||
test.beforeEach((t) => {
|
||||
// Stub the logger functions
|
||||
t.context.log = sinon.spy();
|
||||
t.context.error = sinon.spy();
|
||||
t.context.success = sinon.spy();
|
||||
t.context.warn = sinon.spy();
|
||||
t.context.log = spy();
|
||||
t.context.error = spy();
|
||||
t.context.success = spy();
|
||||
t.context.warn = spy();
|
||||
t.context.logger = {
|
||||
log: t.context.log,
|
||||
error: t.context.error,
|
||||
@@ -75,19 +73,19 @@ test('Plugins are called with expected values', async (t) => {
|
||||
const notes1 = 'Release notes 1';
|
||||
const notes2 = 'Release notes 2';
|
||||
const notes3 = 'Release notes 3';
|
||||
const verifyConditions1 = sinon.stub().resolves();
|
||||
const verifyConditions2 = sinon.stub().resolves();
|
||||
const analyzeCommits = sinon.stub().resolves(nextRelease.type);
|
||||
const verifyRelease = sinon.stub().resolves();
|
||||
const generateNotes1 = sinon.stub().resolves(notes1);
|
||||
const generateNotes2 = sinon.stub().resolves(notes2);
|
||||
const generateNotes3 = sinon.stub().resolves(notes3);
|
||||
const verifyConditions1 = stub().resolves();
|
||||
const verifyConditions2 = stub().resolves();
|
||||
const analyzeCommits = stub().resolves(nextRelease.type);
|
||||
const verifyRelease = stub().resolves();
|
||||
const generateNotes1 = stub().resolves(notes1);
|
||||
const generateNotes2 = stub().resolves(notes2);
|
||||
const generateNotes3 = stub().resolves(notes3);
|
||||
const release1 = {name: 'Release 1', url: 'https://release1.com'};
|
||||
const release2 = {name: 'Release 2', url: 'https://release2.com'};
|
||||
const addChannel = sinon.stub().resolves(release1);
|
||||
const prepare = sinon.stub().resolves();
|
||||
const publish = sinon.stub().resolves(release2);
|
||||
const success = sinon.stub().resolves();
|
||||
const addChannel = stub().resolves(release1);
|
||||
const prepare = stub().resolves();
|
||||
const publish = stub().resolves(release2);
|
||||
const success = stub().resolves();
|
||||
const env = {};
|
||||
const config = {
|
||||
branches: [{name: 'master'}, {name: 'next'}],
|
||||
@@ -410,15 +408,15 @@ test('Use custom tag format', async (t) => {
|
||||
const config = {branches: 'master', repositoryUrl, globalOpt: 'global', tagFormat: `test-\${version}`};
|
||||
const options = {
|
||||
...config,
|
||||
verifyConditions: sinon.stub().resolves(),
|
||||
analyzeCommits: sinon.stub().resolves(nextRelease.type),
|
||||
verifyRelease: sinon.stub().resolves(),
|
||||
generateNotes: sinon.stub().resolves(notes),
|
||||
addChannel: sinon.stub().resolves(),
|
||||
prepare: sinon.stub().resolves(),
|
||||
publish: sinon.stub().resolves(),
|
||||
success: sinon.stub().resolves(),
|
||||
fail: sinon.stub().resolves(),
|
||||
verifyConditions: stub().resolves(),
|
||||
analyzeCommits: stub().resolves(nextRelease.type),
|
||||
verifyRelease: stub().resolves(),
|
||||
generateNotes: stub().resolves(notes),
|
||||
addChannel: stub().resolves(),
|
||||
prepare: stub().resolves(),
|
||||
publish: stub().resolves(),
|
||||
success: stub().resolves(),
|
||||
fail: stub().resolves(),
|
||||
};
|
||||
|
||||
const semanticRelease = requireNoCache('..', {
|
||||
@@ -460,24 +458,24 @@ test('Use new gitHead, and recreate release notes if a prepare plugin create a c
|
||||
};
|
||||
const notes = 'Release notes';
|
||||
|
||||
const generateNotes = sinon.stub().resolves(notes);
|
||||
const prepare1 = sinon.stub().callsFake(async () => {
|
||||
const generateNotes = stub().resolves(notes);
|
||||
const prepare1 = stub().callsFake(async () => {
|
||||
commits = (await gitCommits(['Third'], {cwd})).concat(commits);
|
||||
});
|
||||
const prepare2 = sinon.stub().resolves();
|
||||
const publish = sinon.stub().resolves();
|
||||
const prepare2 = stub().resolves();
|
||||
const publish = stub().resolves();
|
||||
const options = {
|
||||
branches: ['master'],
|
||||
repositoryUrl,
|
||||
verifyConditions: sinon.stub().resolves(),
|
||||
analyzeCommits: sinon.stub().resolves(nextRelease.type),
|
||||
verifyRelease: sinon.stub().resolves(),
|
||||
verifyConditions: stub().resolves(),
|
||||
analyzeCommits: stub().resolves(nextRelease.type),
|
||||
verifyRelease: stub().resolves(),
|
||||
generateNotes,
|
||||
addChannel: sinon.stub().resolves(),
|
||||
addChannel: stub().resolves(),
|
||||
prepare: [prepare1, prepare2],
|
||||
publish,
|
||||
success: sinon.stub().resolves(),
|
||||
fail: sinon.stub().resolves(),
|
||||
success: stub().resolves(),
|
||||
fail: stub().resolves(),
|
||||
};
|
||||
|
||||
const semanticRelease = requireNoCache('..', {
|
||||
@@ -529,12 +527,12 @@ test('Make a new release when a commit is forward-ported to an upper branch', as
|
||||
await merge('1.0.x', {cwd});
|
||||
await gitPush('origin', 'master', {cwd});
|
||||
|
||||
const verifyConditions = sinon.stub().resolves();
|
||||
const verifyRelease = sinon.stub().resolves();
|
||||
const addChannel = sinon.stub().resolves();
|
||||
const prepare = sinon.stub().resolves();
|
||||
const publish = sinon.stub().resolves();
|
||||
const success = sinon.stub().resolves();
|
||||
const verifyConditions = stub().resolves();
|
||||
const verifyRelease = stub().resolves();
|
||||
const addChannel = stub().resolves();
|
||||
const prepare = stub().resolves();
|
||||
const publish = stub().resolves();
|
||||
const success = stub().resolves();
|
||||
|
||||
const config = {branches: [{name: '1.0.x'}, {name: 'master'}], repositoryUrl, tagFormat: `v\${version}`};
|
||||
const options = {
|
||||
@@ -572,14 +570,14 @@ test('Publish a pre-release version', async (t) => {
|
||||
const config = {branches: ['master', {name: 'beta', prerelease: true}], repositoryUrl};
|
||||
const options = {
|
||||
...config,
|
||||
verifyConditions: sinon.stub().resolves(),
|
||||
verifyRelease: sinon.stub().resolves(),
|
||||
generateNotes: sinon.stub().resolves(''),
|
||||
verifyConditions: stub().resolves(),
|
||||
verifyRelease: stub().resolves(),
|
||||
generateNotes: stub().resolves(''),
|
||||
addChannel: false,
|
||||
prepare: sinon.stub().resolves(),
|
||||
publish: sinon.stub().resolves(),
|
||||
success: sinon.stub().resolves(),
|
||||
fail: sinon.stub().resolves(),
|
||||
prepare: stub().resolves(),
|
||||
publish: stub().resolves(),
|
||||
success: stub().resolves(),
|
||||
fail: stub().resolves(),
|
||||
};
|
||||
|
||||
const semanticRelease = requireNoCache('..', {
|
||||
@@ -622,17 +620,17 @@ test('Publish releases from different branch on the same channel', async (t) =>
|
||||
branches: ['master', {name: 'next', channel: false}, {name: 'next-major', channel: false}],
|
||||
repositoryUrl,
|
||||
};
|
||||
const addChannel = sinon.stub().resolves({});
|
||||
const addChannel = stub().resolves({});
|
||||
const options = {
|
||||
...config,
|
||||
verifyConditions: sinon.stub().resolves(),
|
||||
verifyRelease: sinon.stub().resolves(),
|
||||
generateNotes: sinon.stub().resolves(''),
|
||||
verifyConditions: stub().resolves(),
|
||||
verifyRelease: stub().resolves(),
|
||||
generateNotes: stub().resolves(''),
|
||||
addChannel,
|
||||
prepare: sinon.stub().resolves(),
|
||||
publish: sinon.stub().resolves(),
|
||||
success: sinon.stub().resolves(),
|
||||
fail: sinon.stub().resolves(),
|
||||
prepare: stub().resolves(),
|
||||
publish: stub().resolves(),
|
||||
success: stub().resolves(),
|
||||
fail: stub().resolves(),
|
||||
};
|
||||
|
||||
let semanticRelease = requireNoCache('..', {
|
||||
@@ -685,14 +683,14 @@ test('Publish pre-releases the same channel as regular releases', async (t) => {
|
||||
};
|
||||
const options = {
|
||||
...config,
|
||||
verifyConditions: sinon.stub().resolves(),
|
||||
verifyRelease: sinon.stub().resolves(),
|
||||
generateNotes: sinon.stub().resolves(''),
|
||||
verifyConditions: stub().resolves(),
|
||||
verifyRelease: stub().resolves(),
|
||||
generateNotes: stub().resolves(''),
|
||||
addChannel: false,
|
||||
prepare: sinon.stub().resolves(),
|
||||
publish: sinon.stub().resolves(),
|
||||
success: sinon.stub().resolves(),
|
||||
fail: sinon.stub().resolves(),
|
||||
prepare: stub().resolves(),
|
||||
publish: stub().resolves(),
|
||||
success: stub().resolves(),
|
||||
fail: stub().resolves(),
|
||||
};
|
||||
|
||||
const semanticRelease = requireNoCache('..', {
|
||||
@@ -735,14 +733,14 @@ test('Do not add pre-releases to a different channel', async (t) => {
|
||||
await merge('beta', {cwd});
|
||||
await gitPush('origin', 'master', {cwd});
|
||||
|
||||
const verifyConditions = sinon.stub().resolves();
|
||||
const verifyRelease = sinon.stub().resolves();
|
||||
const generateNotes = sinon.stub().resolves('Release notes');
|
||||
const verifyConditions = stub().resolves();
|
||||
const verifyRelease = stub().resolves();
|
||||
const generateNotes = stub().resolves('Release notes');
|
||||
const release1 = {name: 'Release 1', url: 'https://release1.com'};
|
||||
const addChannel = sinon.stub().resolves(release1);
|
||||
const prepare = sinon.stub().resolves();
|
||||
const publish = sinon.stub().resolves();
|
||||
const success = sinon.stub().resolves();
|
||||
const addChannel = stub().resolves(release1);
|
||||
const prepare = stub().resolves();
|
||||
const publish = stub().resolves();
|
||||
const success = stub().resolves();
|
||||
|
||||
const config = {
|
||||
branches: [{name: 'master'}, {name: 'beta', prerelease: 'beta'}],
|
||||
@@ -793,15 +791,15 @@ async function addChannelMacro(t, mergeFunction) {
|
||||
await gitPush('origin', 'master', {cwd});
|
||||
|
||||
const notes = 'Release notes';
|
||||
const verifyConditions = sinon.stub().resolves();
|
||||
const verifyRelease = sinon.stub().resolves();
|
||||
const generateNotes = sinon.stub().resolves(notes);
|
||||
const verifyConditions = stub().resolves();
|
||||
const verifyRelease = stub().resolves();
|
||||
const generateNotes = stub().resolves(notes);
|
||||
const release1 = {name: 'Release 1', url: 'https://release1.com'};
|
||||
const addChannel1 = sinon.stub().resolves(release1);
|
||||
const addChannel2 = sinon.stub().resolves();
|
||||
const prepare = sinon.stub().resolves();
|
||||
const publish = sinon.stub().resolves();
|
||||
const success = sinon.stub().resolves();
|
||||
const addChannel1 = stub().resolves(release1);
|
||||
const addChannel2 = stub().resolves();
|
||||
const prepare = stub().resolves();
|
||||
const publish = stub().resolves();
|
||||
const success = stub().resolves();
|
||||
|
||||
const config = {
|
||||
branches: [
|
||||
@@ -872,14 +870,14 @@ test('Call all "success" plugins even if one errors out', async (t) => {
|
||||
channel: null,
|
||||
};
|
||||
const notes = 'Release notes';
|
||||
const verifyConditions1 = sinon.stub().resolves();
|
||||
const verifyConditions2 = sinon.stub().resolves();
|
||||
const analyzeCommits = sinon.stub().resolves(nextRelease.type);
|
||||
const generateNotes = sinon.stub().resolves(notes);
|
||||
const verifyConditions1 = stub().resolves();
|
||||
const verifyConditions2 = stub().resolves();
|
||||
const analyzeCommits = stub().resolves(nextRelease.type);
|
||||
const generateNotes = stub().resolves(notes);
|
||||
const release = {name: 'Release', url: 'https://release.com'};
|
||||
const publish = sinon.stub().resolves(release);
|
||||
const success1 = sinon.stub().rejects();
|
||||
const success2 = sinon.stub().resolves();
|
||||
const publish = stub().resolves(release);
|
||||
const success1 = stub().rejects();
|
||||
const success2 = stub().resolves();
|
||||
const config = {
|
||||
branches: [{name: 'master'}],
|
||||
repositoryUrl,
|
||||
@@ -891,8 +889,8 @@ test('Call all "success" plugins even if one errors out', async (t) => {
|
||||
verifyConditions: [verifyConditions1, verifyConditions2],
|
||||
analyzeCommits,
|
||||
generateNotes,
|
||||
addChannel: sinon.stub().resolves(),
|
||||
prepare: sinon.stub().resolves(),
|
||||
addChannel: stub().resolves(),
|
||||
prepare: stub().resolves(),
|
||||
publish,
|
||||
success: [success1, success2],
|
||||
};
|
||||
@@ -928,12 +926,12 @@ test('Log all "verifyConditions" errors', async (t) => {
|
||||
const error1 = new Error('error 1');
|
||||
const error2 = new SemanticReleaseError('error 2', 'ERR2');
|
||||
const error3 = new SemanticReleaseError('error 3', 'ERR3');
|
||||
const fail = sinon.stub().resolves();
|
||||
const fail = stub().resolves();
|
||||
const config = {branches: [{name: 'master'}], repositoryUrl, tagFormat: `v\${version}`};
|
||||
const options = {
|
||||
...config,
|
||||
plugins: false,
|
||||
verifyConditions: [sinon.stub().rejects(new AggregateError([error1, error2])), sinon.stub().rejects(error3)],
|
||||
verifyConditions: [stub().rejects(new AggregateError([error1, error2])), stub().rejects(error3)],
|
||||
fail,
|
||||
};
|
||||
|
||||
@@ -972,13 +970,13 @@ test('Log all "verifyRelease" errors', async (t) => {
|
||||
|
||||
const error1 = new SemanticReleaseError('error 1', 'ERR1');
|
||||
const error2 = new SemanticReleaseError('error 2', 'ERR2');
|
||||
const fail = sinon.stub().resolves();
|
||||
const fail = stub().resolves();
|
||||
const config = {branches: [{name: 'master'}], repositoryUrl, tagFormat: `v\${version}`};
|
||||
const options = {
|
||||
...config,
|
||||
verifyConditions: sinon.stub().resolves(),
|
||||
analyzeCommits: sinon.stub().resolves('major'),
|
||||
verifyRelease: [sinon.stub().rejects(error1), sinon.stub().rejects(error2)],
|
||||
verifyConditions: stub().resolves(),
|
||||
analyzeCommits: stub().resolves('major'),
|
||||
verifyRelease: [stub().rejects(error1), stub().rejects(error2)],
|
||||
fail,
|
||||
};
|
||||
|
||||
@@ -1013,14 +1011,14 @@ test('Dry-run skips addChannel, prepare, publish and success', async (t) => {
|
||||
await gitCheckout('next', true, {cwd});
|
||||
await gitPush('origin', 'next', {cwd});
|
||||
|
||||
const verifyConditions = sinon.stub().resolves();
|
||||
const analyzeCommits = sinon.stub().resolves('minor');
|
||||
const verifyRelease = sinon.stub().resolves();
|
||||
const generateNotes = sinon.stub().resolves();
|
||||
const addChannel = sinon.stub().resolves();
|
||||
const prepare = sinon.stub().resolves();
|
||||
const publish = sinon.stub().resolves();
|
||||
const success = sinon.stub().resolves();
|
||||
const verifyConditions = stub().resolves();
|
||||
const analyzeCommits = stub().resolves('minor');
|
||||
const verifyRelease = stub().resolves();
|
||||
const generateNotes = stub().resolves();
|
||||
const addChannel = stub().resolves();
|
||||
const prepare = stub().resolves();
|
||||
const publish = stub().resolves();
|
||||
const success = stub().resolves();
|
||||
|
||||
const options = {
|
||||
dryRun: true,
|
||||
@@ -1079,13 +1077,13 @@ test('Dry-run skips fail', async (t) => {
|
||||
|
||||
const error1 = new SemanticReleaseError('error 1', 'ERR1');
|
||||
const error2 = new SemanticReleaseError('error 2', 'ERR2');
|
||||
const fail = sinon.stub().resolves();
|
||||
const fail = stub().resolves();
|
||||
|
||||
const options = {
|
||||
dryRun: true,
|
||||
branches: ['master'],
|
||||
repositoryUrl,
|
||||
verifyConditions: [sinon.stub().rejects(error1), sinon.stub().rejects(error2)],
|
||||
verifyConditions: [stub().rejects(error1), stub().rejects(error2)],
|
||||
fail,
|
||||
};
|
||||
|
||||
@@ -1127,12 +1125,12 @@ test('Force a dry-run if not on a CI and "noCi" is not explicitly set', async (t
|
||||
};
|
||||
const notes = 'Release notes';
|
||||
|
||||
const verifyConditions = sinon.stub().resolves();
|
||||
const analyzeCommits = sinon.stub().resolves(nextRelease.type);
|
||||
const verifyRelease = sinon.stub().resolves();
|
||||
const generateNotes = sinon.stub().resolves(notes);
|
||||
const publish = sinon.stub().resolves();
|
||||
const success = sinon.stub().resolves();
|
||||
const verifyConditions = stub().resolves();
|
||||
const analyzeCommits = stub().resolves(nextRelease.type);
|
||||
const verifyRelease = stub().resolves();
|
||||
const generateNotes = stub().resolves(notes);
|
||||
const publish = stub().resolves();
|
||||
const success = stub().resolves();
|
||||
|
||||
const options = {
|
||||
dryRun: false,
|
||||
@@ -1142,11 +1140,11 @@ test('Force a dry-run if not on a CI and "noCi" is not explicitly set', async (t
|
||||
analyzeCommits,
|
||||
verifyRelease,
|
||||
generateNotes,
|
||||
addChannel: sinon.stub().resolves(),
|
||||
prepare: sinon.stub().resolves(),
|
||||
addChannel: stub().resolves(),
|
||||
prepare: stub().resolves(),
|
||||
publish,
|
||||
success,
|
||||
fail: sinon.stub().resolves(),
|
||||
fail: stub().resolves(),
|
||||
};
|
||||
|
||||
const semanticRelease = requireNoCache('..', {
|
||||
@@ -1183,8 +1181,8 @@ test('Dry-run does not print changelog if "generateNotes" return "undefined"', a
|
||||
await gitPush(repositoryUrl, 'master', {cwd});
|
||||
|
||||
const nextRelease = {type: 'major', version: '2.0.0', gitHead: await getGitHead({cwd}), gitTag: 'v2.0.0'};
|
||||
const analyzeCommits = sinon.stub().resolves(nextRelease.type);
|
||||
const generateNotes = sinon.stub().resolves();
|
||||
const analyzeCommits = stub().resolves(nextRelease.type);
|
||||
const generateNotes = stub().resolves();
|
||||
|
||||
const options = {
|
||||
dryRun: true,
|
||||
@@ -1236,12 +1234,12 @@ test('Allow local releases with "noCi" option', async (t) => {
|
||||
};
|
||||
const notes = 'Release notes';
|
||||
|
||||
const verifyConditions = sinon.stub().resolves();
|
||||
const analyzeCommits = sinon.stub().resolves(nextRelease.type);
|
||||
const verifyRelease = sinon.stub().resolves();
|
||||
const generateNotes = sinon.stub().resolves(notes);
|
||||
const publish = sinon.stub().resolves();
|
||||
const success = sinon.stub().resolves();
|
||||
const verifyConditions = stub().resolves();
|
||||
const analyzeCommits = stub().resolves(nextRelease.type);
|
||||
const verifyRelease = stub().resolves();
|
||||
const generateNotes = stub().resolves(notes);
|
||||
const publish = stub().resolves();
|
||||
const success = stub().resolves();
|
||||
|
||||
const options = {
|
||||
noCi: true,
|
||||
@@ -1251,11 +1249,11 @@ test('Allow local releases with "noCi" option', async (t) => {
|
||||
analyzeCommits,
|
||||
verifyRelease,
|
||||
generateNotes,
|
||||
addChannel: sinon.stub().resolves(),
|
||||
prepare: sinon.stub().resolves(),
|
||||
addChannel: stub().resolves(),
|
||||
prepare: stub().resolves(),
|
||||
publish,
|
||||
success,
|
||||
fail: sinon.stub().resolves(),
|
||||
fail: stub().resolves(),
|
||||
};
|
||||
|
||||
const semanticRelease = requireNoCache('..', {
|
||||
@@ -1305,27 +1303,27 @@ test('Accept "undefined" value returned by "generateNotes" and "false" by "publi
|
||||
gitTag: 'v1.2.0',
|
||||
channel: null,
|
||||
};
|
||||
const analyzeCommits = sinon.stub().resolves(nextRelease.type);
|
||||
const verifyRelease = sinon.stub().resolves();
|
||||
const generateNotes1 = sinon.stub().resolves();
|
||||
const analyzeCommits = stub().resolves(nextRelease.type);
|
||||
const verifyRelease = stub().resolves();
|
||||
const generateNotes1 = stub().resolves();
|
||||
const notes2 = 'Release notes 2';
|
||||
const generateNotes2 = sinon.stub().resolves(notes2);
|
||||
const publish = sinon.stub().resolves(false);
|
||||
const addChannel = sinon.stub().resolves(false);
|
||||
const success = sinon.stub().resolves();
|
||||
const generateNotes2 = stub().resolves(notes2);
|
||||
const publish = stub().resolves(false);
|
||||
const addChannel = stub().resolves(false);
|
||||
const success = stub().resolves();
|
||||
|
||||
const options = {
|
||||
branches: ['master', 'next'],
|
||||
repositoryUrl,
|
||||
verifyConditions: sinon.stub().resolves(),
|
||||
verifyConditions: stub().resolves(),
|
||||
analyzeCommits,
|
||||
verifyRelease,
|
||||
generateNotes: [generateNotes1, generateNotes2],
|
||||
addChannel,
|
||||
prepare: sinon.stub().resolves(),
|
||||
prepare: stub().resolves(),
|
||||
publish,
|
||||
success,
|
||||
fail: sinon.stub().resolves(),
|
||||
fail: stub().resolves(),
|
||||
};
|
||||
|
||||
const semanticRelease = requireNoCache('..', {
|
||||
@@ -1388,12 +1386,12 @@ test('Throws "EINVALIDNEXTVERSION" if next release is out of range of the curren
|
||||
await gitCommits(['feat: feature on maintenance version 1.x'], {cwd});
|
||||
await gitPush('origin', 'master', {cwd});
|
||||
|
||||
const verifyConditions = sinon.stub().resolves();
|
||||
const verifyRelease = sinon.stub().resolves();
|
||||
const addChannel = sinon.stub().resolves();
|
||||
const prepare = sinon.stub().resolves();
|
||||
const publish = sinon.stub().resolves();
|
||||
const success = sinon.stub().resolves();
|
||||
const verifyConditions = stub().resolves();
|
||||
const verifyRelease = stub().resolves();
|
||||
const addChannel = stub().resolves();
|
||||
const prepare = stub().resolves();
|
||||
const publish = stub().resolves();
|
||||
const success = stub().resolves();
|
||||
|
||||
const config = {
|
||||
branches: [{name: '1.x'}, {name: 'master'}],
|
||||
@@ -1440,12 +1438,12 @@ test('Throws "EINVALIDNEXTVERSION" if next release is out of range of the curren
|
||||
await gitCommits(['feat: new feature on master', 'fix: new fix on master'], {cwd});
|
||||
await gitPush('origin', 'master', {cwd});
|
||||
|
||||
const verifyConditions = sinon.stub().resolves();
|
||||
const verifyRelease = sinon.stub().resolves();
|
||||
const addChannel = sinon.stub().resolves();
|
||||
const prepare = sinon.stub().resolves();
|
||||
const publish = sinon.stub().resolves();
|
||||
const success = sinon.stub().resolves();
|
||||
const verifyConditions = stub().resolves();
|
||||
const verifyRelease = stub().resolves();
|
||||
const addChannel = stub().resolves();
|
||||
const prepare = stub().resolves();
|
||||
const publish = stub().resolves();
|
||||
const success = stub().resolves();
|
||||
|
||||
const config = {
|
||||
branches: [{name: 'master'}, {name: 'next'}, {name: 'next-major'}],
|
||||
@@ -1498,15 +1496,15 @@ test('Throws "EINVALIDMAINTENANCEMERGE" if merge an out of range release in a ma
|
||||
await gitPush('origin', '1.1.x', {cwd});
|
||||
|
||||
const notes = 'Release notes';
|
||||
const verifyConditions = sinon.stub().resolves();
|
||||
const analyzeCommits = sinon.stub().resolves();
|
||||
const verifyRelease = sinon.stub().resolves();
|
||||
const generateNotes = sinon.stub().resolves(notes);
|
||||
const addChannel = sinon.stub().resolves();
|
||||
const prepare = sinon.stub().resolves();
|
||||
const publish = sinon.stub().resolves();
|
||||
const success = sinon.stub().resolves();
|
||||
const fail = sinon.stub().resolves();
|
||||
const verifyConditions = stub().resolves();
|
||||
const analyzeCommits = stub().resolves();
|
||||
const verifyRelease = stub().resolves();
|
||||
const generateNotes = stub().resolves(notes);
|
||||
const addChannel = stub().resolves();
|
||||
const prepare = stub().resolves();
|
||||
const publish = stub().resolves();
|
||||
const success = stub().resolves();
|
||||
const fail = stub().resolves();
|
||||
|
||||
const config = {branches: [{name: 'master'}, {name: '1.1.x'}], repositoryUrl, tagFormat: `v\${version}`};
|
||||
const options = {
|
||||
@@ -1581,15 +1579,15 @@ test('Returns false if not running from the configured branch', async (t) => {
|
||||
const options = {
|
||||
branches: ['master'],
|
||||
repositoryUrl,
|
||||
verifyConditions: sinon.stub().resolves(),
|
||||
analyzeCommits: sinon.stub().resolves(),
|
||||
verifyRelease: sinon.stub().resolves(),
|
||||
generateNotes: sinon.stub().resolves(),
|
||||
addChannel: sinon.stub().resolves(),
|
||||
prepare: sinon.stub().resolves(),
|
||||
publish: sinon.stub().resolves(),
|
||||
success: sinon.stub().resolves(),
|
||||
fail: sinon.stub().resolves(),
|
||||
verifyConditions: stub().resolves(),
|
||||
analyzeCommits: stub().resolves(),
|
||||
verifyRelease: stub().resolves(),
|
||||
generateNotes: stub().resolves(),
|
||||
addChannel: stub().resolves(),
|
||||
prepare: stub().resolves(),
|
||||
publish: stub().resolves(),
|
||||
success: stub().resolves(),
|
||||
fail: stub().resolves(),
|
||||
};
|
||||
|
||||
const semanticRelease = requireNoCache('..', {
|
||||
@@ -1618,23 +1616,23 @@ test('Returns false if there is no relevant changes', async (t) => {
|
||||
await gitCommits(['First'], {cwd});
|
||||
await gitPush(repositoryUrl, 'master', {cwd});
|
||||
|
||||
const analyzeCommits = sinon.stub().resolves();
|
||||
const verifyRelease = sinon.stub().resolves();
|
||||
const generateNotes = sinon.stub().resolves();
|
||||
const publish = sinon.stub().resolves();
|
||||
const analyzeCommits = stub().resolves();
|
||||
const verifyRelease = stub().resolves();
|
||||
const generateNotes = stub().resolves();
|
||||
const publish = stub().resolves();
|
||||
|
||||
const options = {
|
||||
branches: ['master'],
|
||||
repositoryUrl,
|
||||
verifyConditions: [sinon.stub().resolves()],
|
||||
verifyConditions: [stub().resolves()],
|
||||
analyzeCommits,
|
||||
verifyRelease,
|
||||
generateNotes,
|
||||
addChannel: sinon.stub().resolves(),
|
||||
prepare: sinon.stub().resolves(),
|
||||
addChannel: stub().resolves(),
|
||||
prepare: stub().resolves(),
|
||||
publish,
|
||||
success: sinon.stub().resolves(),
|
||||
fail: sinon.stub().resolves(),
|
||||
success: stub().resolves(),
|
||||
fail: stub().resolves(),
|
||||
};
|
||||
|
||||
const semanticRelease = requireNoCache('..', {
|
||||
@@ -1678,19 +1676,19 @@ test('Exclude commits with [skip release] or [release skip] from analysis', asyn
|
||||
{cwd}
|
||||
);
|
||||
await gitPush(repositoryUrl, 'master', {cwd});
|
||||
const analyzeCommits = sinon.stub().resolves();
|
||||
const analyzeCommits = stub().resolves();
|
||||
const config = {branches: ['master'], repositoryUrl, globalOpt: 'global'};
|
||||
const options = {
|
||||
...config,
|
||||
verifyConditions: [sinon.stub().resolves(), sinon.stub().resolves()],
|
||||
verifyConditions: [stub().resolves(), stub().resolves()],
|
||||
analyzeCommits,
|
||||
verifyRelease: sinon.stub().resolves(),
|
||||
generateNotes: sinon.stub().resolves(),
|
||||
addChannel: sinon.stub().resolves(),
|
||||
prepare: sinon.stub().resolves(),
|
||||
publish: sinon.stub().resolves(),
|
||||
success: sinon.stub().resolves(),
|
||||
fail: sinon.stub().resolves(),
|
||||
verifyRelease: stub().resolves(),
|
||||
generateNotes: stub().resolves(),
|
||||
addChannel: stub().resolves(),
|
||||
prepare: stub().resolves(),
|
||||
publish: stub().resolves(),
|
||||
success: stub().resolves(),
|
||||
fail: stub().resolves(),
|
||||
};
|
||||
|
||||
const semanticRelease = requireNoCache('..', {
|
||||
@@ -1718,8 +1716,8 @@ test('Log both plugins errors and errors thrown by "fail" plugin', async (t) =>
|
||||
const options = {
|
||||
branches: ['master'],
|
||||
repositoryUrl,
|
||||
verifyConditions: sinon.stub().rejects(pluginError),
|
||||
fail: [sinon.stub().rejects(failError1), sinon.stub().rejects(failError2)],
|
||||
verifyConditions: stub().rejects(pluginError),
|
||||
fail: [stub().rejects(failError1), stub().rejects(failError2)],
|
||||
};
|
||||
const semanticRelease = requireNoCache('..', {
|
||||
'./lib/get-logger': () => t.context.logger,
|
||||
@@ -1738,12 +1736,12 @@ test('Log both plugins errors and errors thrown by "fail" plugin', async (t) =>
|
||||
test('Call "fail" only if a plugin returns a SemanticReleaseError', async (t) => {
|
||||
const {cwd, repositoryUrl} = await gitRepo(true);
|
||||
const pluginError = new Error('Plugin error');
|
||||
const fail = sinon.stub().resolves();
|
||||
const fail = stub().resolves();
|
||||
|
||||
const options = {
|
||||
branches: ['master'],
|
||||
repositoryUrl,
|
||||
verifyConditions: sinon.stub().rejects(pluginError),
|
||||
verifyConditions: stub().rejects(pluginError),
|
||||
fail,
|
||||
};
|
||||
const semanticRelease = requireNoCache('..', {
|
||||
@@ -1791,16 +1789,16 @@ test('Throw an Error if plugin returns an unexpected value', async (t) => {
|
||||
await gitCommits(['Second'], {cwd});
|
||||
await gitPush(repositoryUrl, 'master', {cwd});
|
||||
|
||||
const verifyConditions = sinon.stub().resolves();
|
||||
const analyzeCommits = sinon.stub().resolves('string');
|
||||
const verifyConditions = stub().resolves();
|
||||
const analyzeCommits = stub().resolves('string');
|
||||
|
||||
const options = {
|
||||
branches: ['master'],
|
||||
repositoryUrl,
|
||||
verifyConditions: [verifyConditions],
|
||||
analyzeCommits,
|
||||
success: sinon.stub().resolves(),
|
||||
fail: sinon.stub().resolves(),
|
||||
success: stub().resolves(),
|
||||
fail: stub().resolves(),
|
||||
};
|
||||
|
||||
const semanticRelease = requireNoCache('..', {
|
||||
@@ -1817,19 +1815,19 @@ test('Throw an Error if plugin returns an unexpected value', async (t) => {
|
||||
test('Hide sensitive information passed to "fail" plugin', async (t) => {
|
||||
const {cwd, repositoryUrl} = await gitRepo(true);
|
||||
|
||||
const fail = sinon.stub().resolves();
|
||||
const fail = stub().resolves();
|
||||
const env = {MY_TOKEN: 'secret token'};
|
||||
const options = {
|
||||
branch: 'master',
|
||||
repositoryUrl,
|
||||
verifyConditions: sinon.stub().throws(
|
||||
verifyConditions: stub().throws(
|
||||
new SemanticReleaseError(
|
||||
`Message: Exposing token ${env.MY_TOKEN}`,
|
||||
'ERR',
|
||||
`Details: Exposing token ${env.MY_TOKEN}`
|
||||
)
|
||||
),
|
||||
success: sinon.stub().resolves(),
|
||||
success: stub().resolves(),
|
||||
fail,
|
||||
};
|
||||
|
||||
@@ -1860,7 +1858,7 @@ test('Hide sensitive information passed to "success" plugin', async (t) => {
|
||||
await gitCommits(['feat: new feature'], {cwd});
|
||||
await gitPush(repositoryUrl, 'master', {cwd});
|
||||
|
||||
const success = sinon.stub().resolves();
|
||||
const success = stub().resolves();
|
||||
const env = {MY_TOKEN: 'secret token'};
|
||||
const options = {
|
||||
branch: 'master',
|
||||
@@ -1868,14 +1866,14 @@ test('Hide sensitive information passed to "success" plugin', async (t) => {
|
||||
verifyConditions: false,
|
||||
verifyRelease: false,
|
||||
prepare: false,
|
||||
generateNotes: sinon.stub().resolves(`Exposing token ${env.MY_TOKEN}`),
|
||||
publish: sinon.stub().resolves({
|
||||
generateNotes: stub().resolves(`Exposing token ${env.MY_TOKEN}`),
|
||||
publish: stub().resolves({
|
||||
name: `Name: Exposing token ${env.MY_TOKEN}`,
|
||||
url: `URL: Exposing token ${env.MY_TOKEN}`,
|
||||
}),
|
||||
addChannel: false,
|
||||
success,
|
||||
fail: sinon.stub().resolves(),
|
||||
fail: stub().resolves(),
|
||||
};
|
||||
|
||||
const semanticRelease = requireNoCache('..', {
|
||||
@@ -1913,19 +1911,19 @@ test('Get all commits including the ones not in the shallow clone', async (t) =>
|
||||
channel: undefined,
|
||||
};
|
||||
const notes = 'Release notes';
|
||||
const analyzeCommits = sinon.stub().resolves(nextRelease.type);
|
||||
const analyzeCommits = stub().resolves(nextRelease.type);
|
||||
|
||||
const config = {branches: ['master'], repositoryUrl, globalOpt: 'global'};
|
||||
const options = {
|
||||
...config,
|
||||
verifyConditions: sinon.stub().resolves(),
|
||||
verifyConditions: stub().resolves(),
|
||||
analyzeCommits,
|
||||
verifyRelease: sinon.stub().resolves(),
|
||||
generateNotes: sinon.stub().resolves(notes),
|
||||
prepare: sinon.stub().resolves(),
|
||||
publish: sinon.stub().resolves(),
|
||||
success: sinon.stub().resolves(),
|
||||
fail: sinon.stub().resolves(),
|
||||
verifyRelease: stub().resolves(),
|
||||
generateNotes: stub().resolves(notes),
|
||||
prepare: stub().resolves(),
|
||||
publish: stub().resolves(),
|
||||
success: stub().resolves(),
|
||||
fail: stub().resolves(),
|
||||
};
|
||||
|
||||
const semanticRelease = requireNoCache('..', {
|
||||
|
||||
+16
-19
@@ -1,16 +1,14 @@
|
||||
import path from 'path';
|
||||
import test from 'ava';
|
||||
import proxyquire from 'proxyquire';
|
||||
import lodash from 'lodash'
|
||||
const {escapeRegExp} = lodash
|
||||
import {writeJson, readJson} from 'fs-extra';
|
||||
import execa from 'execa';
|
||||
import {WritableStreamBuffer} from 'stream-buffers';
|
||||
import delay from 'delay';
|
||||
import getAuthUrl from '../lib/get-git-auth-url.js';
|
||||
import {SECRET_REPLACEMENT} from '../lib/definitions/constants.js';
|
||||
|
||||
import {
|
||||
const path = require('path');
|
||||
const test = require('ava');
|
||||
const proxyquire = require('proxyquire');
|
||||
const {escapeRegExp} = require('lodash');
|
||||
const {writeJson, readJson} = require('fs-extra');
|
||||
const execa = require('execa');
|
||||
const {WritableStreamBuffer} = require('stream-buffers');
|
||||
const delay = require('delay');
|
||||
const getAuthUrl = require('../lib/get-git-auth-url');
|
||||
const {SECRET_REPLACEMENT} = require('../lib/definitions/constants');
|
||||
const {
|
||||
gitHead,
|
||||
gitTagHead,
|
||||
gitRepo,
|
||||
@@ -20,12 +18,11 @@ import {
|
||||
gitCheckout,
|
||||
merge,
|
||||
gitGetNote,
|
||||
} from './helpers/git-utils.js';
|
||||
|
||||
import {npmView} from './helpers/npm-utils.js';
|
||||
import gitbox from './helpers/gitbox.js';
|
||||
import mockServer from './helpers/mockserver.js';
|
||||
import npmRegistry from './helpers/npm-registry.js';
|
||||
} = require('./helpers/git-utils');
|
||||
const {npmView} = require('./helpers/npm-utils');
|
||||
const gitbox = require('./helpers/gitbox');
|
||||
const mockServer = require('./helpers/mockserver');
|
||||
const npmRegistry = require('./helpers/npm-registry');
|
||||
|
||||
/* eslint camelcase: ["error", {properties: "never"}] */
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import test from 'ava';
|
||||
import lodash from 'lodash'
|
||||
const {noop} = lodash
|
||||
import sinon from 'sinon';
|
||||
import normalize from '../../lib/plugins/normalize.js';
|
||||
const test = require('ava');
|
||||
const {noop} = require('lodash');
|
||||
const {stub} = require('sinon');
|
||||
const normalize = require('../../lib/plugins/normalize');
|
||||
|
||||
const cwd = process.cwd();
|
||||
|
||||
test.beforeEach((t) => {
|
||||
// Stub the logger functions
|
||||
t.context.log = sinon.stub);
|
||||
t.context.error = sinon.stub);
|
||||
t.context.success = sinon.stub);
|
||||
t.context.stderr = {write: sinon.stub)};
|
||||
t.context.log = stub();
|
||||
t.context.error = stub();
|
||||
t.context.success = stub();
|
||||
t.context.stderr = {write: stub()};
|
||||
t.context.logger = {
|
||||
log: t.context.log,
|
||||
error: t.context.error,
|
||||
@@ -100,7 +99,7 @@ test('Normalize and load plugin that retuns multiple functions', (t) => {
|
||||
});
|
||||
|
||||
test('Wrap "analyzeCommits" plugin in a function that validate the output of the plugin', async (t) => {
|
||||
const analyzeCommits = sinon.stub).resolves(2);
|
||||
const analyzeCommits = stub().resolves(2);
|
||||
const plugin = normalize(
|
||||
{cwd, options: {}, stderr: t.context.stderr, logger: t.context.logger},
|
||||
'analyzeCommits',
|
||||
@@ -118,7 +117,7 @@ test('Wrap "analyzeCommits" plugin in a function that validate the output of the
|
||||
});
|
||||
|
||||
test('Wrap "generateNotes" plugin in a function that validate the output of the plugin', async (t) => {
|
||||
const generateNotes = sinon.stub).resolves(2);
|
||||
const generateNotes = stub().resolves(2);
|
||||
const plugin = normalize(
|
||||
{cwd, options: {}, stderr: t.context.stderr, logger: t.context.logger},
|
||||
'generateNotes',
|
||||
@@ -136,7 +135,7 @@ test('Wrap "generateNotes" plugin in a function that validate the output of the
|
||||
});
|
||||
|
||||
test('Wrap "publish" plugin in a function that validate the output of the plugin', async (t) => {
|
||||
const publish = sinon.stub).resolves(2);
|
||||
const publish = stub().resolves(2);
|
||||
const plugin = normalize(
|
||||
{cwd, options: {}, stderr: t.context.stderr, logger: t.context.logger},
|
||||
'publish',
|
||||
@@ -154,7 +153,7 @@ test('Wrap "publish" plugin in a function that validate the output of the plugin
|
||||
});
|
||||
|
||||
test('Wrap "addChannel" plugin in a function that validate the output of the plugin', async (t) => {
|
||||
const addChannel = sinon.stub).resolves(2);
|
||||
const addChannel = stub().resolves(2);
|
||||
const plugin = normalize(
|
||||
{cwd, options: {}, stderr: t.context.stderr, logger: t.context.logger},
|
||||
'addChannel',
|
||||
@@ -172,7 +171,7 @@ test('Wrap "addChannel" plugin in a function that validate the output of the plu
|
||||
});
|
||||
|
||||
test('Plugin is called with "pluginConfig" (with object definition) and input', async (t) => {
|
||||
const pluginFunction = sinon.stub).resolves();
|
||||
const pluginFunction = stub().resolves();
|
||||
const pluginConf = {path: pluginFunction, conf: 'confValue'};
|
||||
const options = {global: 'globalValue'};
|
||||
const plugin = normalize({cwd, options, logger: t.context.logger}, '', pluginConf, {});
|
||||
@@ -187,7 +186,7 @@ test('Plugin is called with "pluginConfig" (with object definition) and input',
|
||||
});
|
||||
|
||||
test('Plugin is called with "pluginConfig" (with array definition) and input', async (t) => {
|
||||
const pluginFunction = sinon.stub).resolves();
|
||||
const pluginFunction = stub().resolves();
|
||||
const pluginConf = [pluginFunction, {conf: 'confValue'}];
|
||||
const options = {global: 'globalValue'};
|
||||
const plugin = normalize({cwd, options, logger: t.context.logger}, '', pluginConf, {});
|
||||
@@ -202,7 +201,7 @@ test('Plugin is called with "pluginConfig" (with array definition) and input', a
|
||||
});
|
||||
|
||||
test('Prevent plugins to modify "pluginConfig"', async (t) => {
|
||||
const pluginFunction = sinon.stub).callsFake((pluginConfig) => {
|
||||
const pluginFunction = stub().callsFake((pluginConfig) => {
|
||||
pluginConfig.conf.subConf = 'otherConf';
|
||||
});
|
||||
const pluginConf = {path: pluginFunction, conf: {subConf: 'originalConf'}};
|
||||
@@ -215,7 +214,7 @@ test('Prevent plugins to modify "pluginConfig"', async (t) => {
|
||||
});
|
||||
|
||||
test('Prevent plugins to modify its input', async (t) => {
|
||||
const pluginFunction = sinon.stub).callsFake((pluginConfig, options) => {
|
||||
const pluginFunction = stub().callsFake((pluginConfig, options) => {
|
||||
options.param.subParam = 'otherParam';
|
||||
});
|
||||
const input = {param: {subParam: 'originalSubParam'}, options: {}};
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import test from 'ava';
|
||||
import sinon from 'sinon';
|
||||
import AggregateError from 'aggregate-error';
|
||||
import pipeline from '../../lib/plugins/pipeline.js';
|
||||
const test = require('ava');
|
||||
const {stub} = require('sinon');
|
||||
const AggregateError = require('aggregate-error');
|
||||
const pipeline = require('../../lib/plugins/pipeline');
|
||||
|
||||
test('Execute each function in series passing the same input', async (t) => {
|
||||
const step1 = sinon.stub).resolves(1);
|
||||
const step2 = sinon.stub).resolves(2);
|
||||
const step3 = sinon.stub).resolves(3);
|
||||
const step1 = stub().resolves(1);
|
||||
const step2 = stub().resolves(2);
|
||||
const step3 = stub().resolves(3);
|
||||
|
||||
const result = await pipeline([step1, step2, step3])(0);
|
||||
t.deepEqual(result, [1, 2, 3]);
|
||||
@@ -19,10 +19,10 @@ test('Execute each function in series passing the same input', async (t) => {
|
||||
});
|
||||
|
||||
test('Execute each function in series passing a transformed input from "getNextInput"', async (t) => {
|
||||
const step1 = sinon.stub).resolves(1);
|
||||
const step2 = sinon.stub).resolves(2);
|
||||
const step3 = sinon.stub).resolves(3);
|
||||
const step4 = sinon.stub).resolves(4);
|
||||
const step1 = stub().resolves(1);
|
||||
const step2 = stub().resolves(2);
|
||||
const step3 = stub().resolves(3);
|
||||
const step4 = stub().resolves(4);
|
||||
const getNextInput = (lastResult, result) => lastResult + result;
|
||||
|
||||
const result = await pipeline([step1, step2, step3, step4], {settleAll: false, getNextInput})(0);
|
||||
@@ -38,11 +38,11 @@ test('Execute each function in series passing a transformed input from "getNextI
|
||||
});
|
||||
|
||||
test('Execute each function in series passing the "lastResult" and "result" to "getNextInput"', async (t) => {
|
||||
const step1 = sinon.stub).resolves(1);
|
||||
const step2 = sinon.stub).resolves(2);
|
||||
const step3 = sinon.stub).resolves(3);
|
||||
const step4 = sinon.stub).resolves(4);
|
||||
const getNextInput = sinon.stub).returnsArg(0);
|
||||
const step1 = stub().resolves(1);
|
||||
const step2 = stub().resolves(2);
|
||||
const step3 = stub().resolves(3);
|
||||
const step4 = stub().resolves(4);
|
||||
const getNextInput = stub().returnsArg(0);
|
||||
|
||||
const result = await pipeline([step1, step2, step3, step4], {settleAll: false, getNextInput})(5);
|
||||
|
||||
@@ -56,12 +56,12 @@ test('Execute each function in series passing the "lastResult" and "result" to "
|
||||
});
|
||||
|
||||
test('Execute each function in series calling "transform" to modify the results', async (t) => {
|
||||
const step1 = sinon.stub).resolves(1);
|
||||
const step2 = sinon.stub).resolves(2);
|
||||
const step3 = sinon.stub).resolves(3);
|
||||
const step4 = sinon.stub).resolves(4);
|
||||
const getNextInput = sinon.stub).returnsArg(0);
|
||||
const transform = sinon.stub).callsFake((result) => result + 1);
|
||||
const step1 = stub().resolves(1);
|
||||
const step2 = stub().resolves(2);
|
||||
const step3 = stub().resolves(3);
|
||||
const step4 = stub().resolves(4);
|
||||
const getNextInput = stub().returnsArg(0);
|
||||
const transform = stub().callsFake((result) => result + 1);
|
||||
|
||||
const result = await pipeline([step1, step2, step3, step4], {getNextInput, transform})(5);
|
||||
|
||||
@@ -75,12 +75,12 @@ test('Execute each function in series calling "transform" to modify the results'
|
||||
});
|
||||
|
||||
test('Execute each function in series calling "transform" to modify the results with "settleAll"', async (t) => {
|
||||
const step1 = sinon.stub).resolves(1);
|
||||
const step2 = sinon.stub).resolves(2);
|
||||
const step3 = sinon.stub).resolves(3);
|
||||
const step4 = sinon.stub).resolves(4);
|
||||
const getNextInput = sinon.stub).returnsArg(0);
|
||||
const transform = sinon.stub).callsFake((result) => result + 1);
|
||||
const step1 = stub().resolves(1);
|
||||
const step2 = stub().resolves(2);
|
||||
const step3 = stub().resolves(3);
|
||||
const step4 = stub().resolves(4);
|
||||
const getNextInput = stub().returnsArg(0);
|
||||
const transform = stub().callsFake((result) => result + 1);
|
||||
|
||||
const result = await pipeline([step1, step2, step3, step4], {settleAll: true, getNextInput, transform})(5);
|
||||
|
||||
@@ -94,9 +94,9 @@ test('Execute each function in series calling "transform" to modify the results
|
||||
});
|
||||
|
||||
test('Stop execution and throw error if a step rejects', async (t) => {
|
||||
const step1 = sinon.stub).resolves(1);
|
||||
const step2 = sinon.stub).rejects(new Error('test error'));
|
||||
const step3 = sinon.stub).resolves(3);
|
||||
const step1 = stub().resolves(1);
|
||||
const step2 = stub().rejects(new Error('test error'));
|
||||
const step3 = stub().resolves(3);
|
||||
|
||||
const error = await t.throwsAsync(pipeline([step1, step2, step3])(0), {
|
||||
instanceOf: Error,
|
||||
@@ -112,9 +112,9 @@ test('Throw all errors from the first step throwing an AggregateError', async (t
|
||||
const error1 = new Error('test error 1');
|
||||
const error2 = new Error('test error 2');
|
||||
|
||||
const step1 = sinon.stub).resolves(1);
|
||||
const step2 = sinon.stub).rejects(new AggregateError([error1, error2]));
|
||||
const step3 = sinon.stub).resolves(3);
|
||||
const step1 = stub().resolves(1);
|
||||
const step2 = stub().rejects(new AggregateError([error1, error2]));
|
||||
const step3 = stub().resolves(3);
|
||||
|
||||
const errors = await t.throwsAsync(pipeline([step1, step2, step3])(0));
|
||||
|
||||
@@ -127,9 +127,9 @@ test('Throw all errors from the first step throwing an AggregateError', async (t
|
||||
test('Execute all even if a Promise rejects', async (t) => {
|
||||
const error1 = new Error('test error 1');
|
||||
const error2 = new Error('test error 2');
|
||||
const step1 = sinon.stub).resolves(1);
|
||||
const step2 = sinon.stub).rejects(error1);
|
||||
const step3 = sinon.stub).rejects(error2);
|
||||
const step1 = stub().resolves(1);
|
||||
const step2 = stub().rejects(error1);
|
||||
const step3 = stub().rejects(error2);
|
||||
|
||||
const errors = await t.throwsAsync(pipeline([step1, step2, step3], {settleAll: true})(0));
|
||||
|
||||
@@ -144,8 +144,8 @@ test('Throw all errors from all steps throwing an AggregateError', async (t) =>
|
||||
const error2 = new Error('test error 2');
|
||||
const error3 = new Error('test error 3');
|
||||
const error4 = new Error('test error 4');
|
||||
const step1 = sinon.stub).rejects(new AggregateError([error1, error2]));
|
||||
const step2 = sinon.stub).rejects(new AggregateError([error3, error4]));
|
||||
const step1 = stub().rejects(new AggregateError([error1, error2]));
|
||||
const step2 = stub().rejects(new AggregateError([error3, error4]));
|
||||
|
||||
const errors = await t.throwsAsync(pipeline([step1, step2], {settleAll: true})(0));
|
||||
|
||||
@@ -157,10 +157,10 @@ test('Throw all errors from all steps throwing an AggregateError', async (t) =>
|
||||
test('Execute each function in series passing a transformed input even if a step rejects', async (t) => {
|
||||
const error2 = new Error('test error 2');
|
||||
const error3 = new Error('test error 3');
|
||||
const step1 = sinon.stub).resolves(1);
|
||||
const step2 = sinon.stub).rejects(error2);
|
||||
const step3 = sinon.stub).rejects(error3);
|
||||
const step4 = sinon.stub).resolves(4);
|
||||
const step1 = stub().resolves(1);
|
||||
const step2 = stub().rejects(error2);
|
||||
const step3 = stub().rejects(error3);
|
||||
const step4 = stub().resolves(4);
|
||||
const getNextInput = (previousResult, result) => previousResult + result;
|
||||
|
||||
const errors = await t.throwsAsync(pipeline([step1, step2, step3, step4], {settleAll: true, getNextInput})(0));
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import path from 'path';
|
||||
import test from 'ava';
|
||||
import {copy, outputFile} from 'fs-extra';
|
||||
import sinon from 'sinon';
|
||||
import tempy from 'tempy';
|
||||
import getPlugins from '../../lib/plugins';
|
||||
const path = require('path');
|
||||
const test = require('ava');
|
||||
const {copy, outputFile} = require('fs-extra');
|
||||
const {stub} = require('sinon');
|
||||
const tempy = require('tempy');
|
||||
const getPlugins = require('../../lib/plugins');
|
||||
|
||||
// Save the current working diretory
|
||||
const cwd = process.cwd();
|
||||
|
||||
test.beforeEach((t) => {
|
||||
// Stub the logger functions
|
||||
t.context.log = sinon.stub);
|
||||
t.context.success = sinon.stub);
|
||||
t.context.log = stub();
|
||||
t.context.success = stub();
|
||||
t.context.logger = {log: t.context.log, success: t.context.success, scope: () => t.context.logger};
|
||||
});
|
||||
|
||||
@@ -56,8 +56,8 @@ test('Export plugins based on steps config', (t) => {
|
||||
});
|
||||
|
||||
test('Export plugins based on "plugins" config (array)', async (t) => {
|
||||
const plugin1 = {verifyConditions: sinon.stub), publish: sinon.stub)};
|
||||
const plugin2 = {verifyConditions: sinon.stub), verifyRelease: sinon.stub)};
|
||||
const plugin1 = {verifyConditions: stub(), publish: stub()};
|
||||
const plugin2 = {verifyConditions: stub(), verifyRelease: stub()};
|
||||
const plugins = getPlugins(
|
||||
{cwd, logger: t.context.logger, options: {plugins: [plugin1, [plugin2, {}]], verifyRelease: () => {}}},
|
||||
{}
|
||||
@@ -85,7 +85,7 @@ test('Export plugins based on "plugins" config (array)', async (t) => {
|
||||
});
|
||||
|
||||
test('Export plugins based on "plugins" config (single definition)', async (t) => {
|
||||
const plugin1 = {verifyConditions: sinon.stub), publish: sinon.stub)};
|
||||
const plugin1 = {verifyConditions: stub(), publish: stub()};
|
||||
const plugins = getPlugins({cwd, logger: t.context.logger, options: {plugins: plugin1}}, {});
|
||||
|
||||
await plugins.verifyConditions({options: {}});
|
||||
@@ -106,8 +106,8 @@ test('Export plugins based on "plugins" config (single definition)', async (t) =
|
||||
});
|
||||
|
||||
test('Merge global options, "plugins" options and step options', async (t) => {
|
||||
const plugin1 = [{verifyConditions: sinon.stub), publish: sinon.stub)}, {pluginOpt1: 'plugin1'}];
|
||||
const plugin2 = [{verifyConditions: sinon.stub)}, {pluginOpt2: 'plugin2'}];
|
||||
const plugin1 = [{verifyConditions: stub(), publish: stub()}, {pluginOpt1: 'plugin1'}];
|
||||
const plugin2 = [{verifyConditions: stub()}, {pluginOpt2: 'plugin2'}];
|
||||
const plugin3 = [stub(), {pluginOpt3: 'plugin3'}];
|
||||
const plugins = getPlugins(
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import test from 'ava';
|
||||
import {validatePlugin, validateStep, loadPlugin, parseConfig} from '../../lib/plugins/utils.js';
|
||||
const test = require('ava');
|
||||
const {validatePlugin, validateStep, loadPlugin, parseConfig} = require('../../lib/plugins/utils');
|
||||
|
||||
test('validatePlugin', (t) => {
|
||||
const path = 'plugin-module';
|
||||
|
||||
+4
-5
@@ -1,7 +1,6 @@
|
||||
import test from 'ava';
|
||||
import AggregateError from 'aggregate-error';
|
||||
|
||||
import {
|
||||
const test = require('ava');
|
||||
const AggregateError = require('aggregate-error');
|
||||
const {
|
||||
extractErrors,
|
||||
tagsToVersions,
|
||||
isMajorRange,
|
||||
@@ -16,7 +15,7 @@ import {
|
||||
getRange,
|
||||
makeTag,
|
||||
isSameChannel,
|
||||
} from '../lib/utils.js';
|
||||
} = require('../lib/utils');
|
||||
|
||||
test('extractErrors', (t) => {
|
||||
const errors = [new Error('Error 1'), new Error('Error 2')];
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
import test from 'ava';
|
||||
import tempy from 'tempy';
|
||||
import verify from '../lib/verify.js';
|
||||
import {gitRepo} from './helpers/git-utils.js';
|
||||
const test = require('ava');
|
||||
const tempy = require('tempy');
|
||||
const verify = require('../lib/verify');
|
||||
const {gitRepo} = require('./helpers/git-utils');
|
||||
|
||||
test('Throw a AggregateError', async (t) => {
|
||||
const {cwd} = await gitRepo();
|
||||
|
||||
Reference in New Issue
Block a user