1. semantic-release-replace-plugin
Semantic Release Replace Plugin
semantic-release-replace-plugin
Package: semantic-release-replace-plugin
Created by: jpoehnelt
Last modified: Thu, 20 Jul 2023 08:07:48 GMT
Version: 1.2.7
License: Apache-2.0
Downloads: 42,785
Repository: https://github.com/jpoehnelt/semantic-release-replace-plugin

Install

npm install semantic-release-replace-plugin
yarn add semantic-release-replace-plugin

Semantic Release Replace Plugin

npm
Build
Release
codecov
GitHub contributors
semantic-release

The semantic-release-replace-plugin plugin provides functionality to update version strings throughout a project. This enables semantic release to be used in many different languages and build processes.

Read more about Semantic Release.

Install

 $ npm install semantic-release-replace-plugin -D

Usage

The following example uses this plugin to demonstrate using semantic-release in a Python package where __VERSION__ is defined in the root __init__.py file.

 {
  "plugins": [
    "@semantic-release/commit-analyzer",
    [
      "semantic-release-replace-plugin",
      {
        "replacements": [
          {
            "files": ["foo/__init__.py"],
            "from": "__VERSION__ = \".*\"",
            "to": "__VERSION__ = \"${nextRelease.version}\"",
            "results": [
              {
                "file": "foo/__init__.py",
                "hasChanged": true,
                "numMatches": 1,
                "numReplacements": 1
              }
            ],
            "countMatches": true
          }
        ]
      }
    ],
    [
      "@semantic-release/git",
      {
        "assets": ["foo/*.py"]
      }
    ]
  ]
}

Validation

The presence of the results array will trigger validation that a replacement has been made. This is optional but recommended.

Warning

This plugin will not commit changes unless you specify assets for the @semantic-release/git plugin! This is highlighted below.

[
  "@semantic-release/git",
  {
    "assets": ["foo/*.py"]
  }
]

Options

Please refer to the documentation for more options.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code