Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/garthdb/semantic-release-mirror-version
A semantic-release plugin that mirrors the version number to additional files in the project.
https://github.com/garthdb/semantic-release-mirror-version
Last synced: about 1 month ago
JSON representation
A semantic-release plugin that mirrors the version number to additional files in the project.
- Host: GitHub
- URL: https://github.com/garthdb/semantic-release-mirror-version
- Owner: GarthDB
- Created: 2022-06-15T22:14:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-06-23T20:12:09.000Z (over 2 years ago)
- Last Synced: 2024-11-29T15:53:24.490Z (about 1 month ago)
- Language: JavaScript
- Size: 277 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
![tests workflow](https://github.com/GarthDB/semantic-release-mirror-version/actions/workflows/test.yml/badge.svg)
# Semantic Release Mirror Version
This plugin can write the next release version number to other files, in addition to the `package.json`.
## Installation
Plugins have to be installed via NPM
```bash
$ npm install semantic-release-mirror-version -D
```or Yarn.
```bash
$ yarn add semantic-release-mirror-version -D
```Then add the plugin to your [semantic-release config](https://semantic-release.gitbook.io/semantic-release/usage/configuration).
```json
{
"branches": ["main", "next"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"semantic-release-mirror-version",
{
"fileGlob": ["dist/**.md"]
}
],
"@semantic-release/github",
"@semantic-release/npm"
]
}
```## Config
### `fileGlob`
This plugin uses [Glob](https://github.com/isaacs/node-glob#glob-primer) to find files to add the version number to.
### `placeholderRegExp`
A RexExp can be defined for finding a string to replace with the version number. The default RegExp is `/0\.0\.0-development/g` to match the default placeholder version in the `package.json` file.
If `placeholderRegExp` is a `String` it will be converted to a `RegExp` with a global flag using the `RegExp` constructor:
```js
pluginConfig.placeholderRegExp = new RegExp(
pluginConfig.placeholderRegExp,
"g"
);
```## Example
This example has a JSON file located at `./dist/output.json` and will be published with the new version number `2.3.1-beta.2`
```json
{
"data": {
"version": "0.0.0",
"name": "Finn Mertens",
"alias": "Finn the Human"
}
}
```and a config file `.releaserc`
```json
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"semantic-release-mirror-version",
{
"fileGlob": "./dist/output.json",
"placeholderRegExp": "(?<=\")0.0.0"
}
],
"@semantic-release/github",
"@semantic-release/git"
]
}
```Would result in the NPM package published with the `./dist/output.json` changed to the following:
```json
{
"data": {
"version": "2.3.1-beta.2",
"name": "Finn Mertens",
"alias": "Finn the Human"
}
}
```