{"id":20434369,"url":"https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin","last_synced_at":"2026-04-10T19:03:43.062Z","repository":{"id":229856706,"uuid":"777827706","full_name":"centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin","owner":"centralnicgroup-opensource","description":"The rtldev-middleware-semantic-release-replace-plugin automates version and string updates in project files for seamless, error-free releases. Developed by CentralNic Group.","archived":false,"fork":false,"pushed_at":"2025-02-18T11:31:13.000Z","size":1247,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-18T11:39:53.221Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"jpoehnelt/semantic-release-replace-plugin","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/centralnicgroup-opensource.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-26T15:20:07.000Z","updated_at":"2025-02-06T15:39:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"0344fd2a-72ea-4b0f-86a3-cd8c0858392f","html_url":"https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin","commit_stats":null,"previous_names":["centralnicgroup-opensource/semantic-release-replace-plugin"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centralnicgroup-opensource%2Frtldev-middleware-semantic-release-replace-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centralnicgroup-opensource%2Frtldev-middleware-semantic-release-replace-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centralnicgroup-opensource%2Frtldev-middleware-semantic-release-replace-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centralnicgroup-opensource%2Frtldev-middleware-semantic-release-replace-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/centralnicgroup-opensource","download_url":"https://codeload.github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241977010,"owners_count":20051759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T08:26:14.910Z","updated_at":"2026-04-10T19:03:43.051Z","avatar_url":"https://github.com/centralnicgroup-opensource.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Automated Semantic Release Plugin for Version Number Replacement and Date Management\n\n[![npm](https://img.shields.io/npm/v/semantic-release-replace-plugin)](https://www.npmjs.com/package/semantic-release-replace-plugin)\n![Build](https://github.com/jpoehnelt/semantic-release-replace-plugin/workflows/Build/badge.svg)\n![Release](https://github.com/jpoehnelt/semantic-release-replace-plugin/workflows/Release/badge.svg)\n[![codecov](https://codecov.io/gh/jpoehnelt/semantic-release-replace-plugin/branch/master/graph/badge.svg)](https://codecov.io/gh/jpoehnelt/semantic-release-replace-plugin)\n![GitHub contributors](https://img.shields.io/github/contributors/jpoehnelt/semantic-release-replace-plugin?color=green)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\nThe `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.\n\nRead more about [Semantic Release](https://semantic-release.gitbook.io/).\n\n## Install\n\n```bash\n$ npm install https://github.com/centralnicgroup-opensource/semantic-release-replace-plugin -D\n```\n\n## Usage\n\nThe following example uses this plugin to demonstrate using semantic-release in a Python package where `__VERSION__` is defined in the root `__init__.py` file.\n\n### Configuration Example\n\n```json\n{\n  \"plugins\": [\n    \"@semantic-release/commit-analyzer\",\n    [\n      \"semantic-release-replace-plugin\",\n      {\n        \"replacements\": [\n          {\n            \"files\": [\"foo/**/*.py\"],\n            \"from\": \"__VERSION__ = \\\".*\\\"\",\n            \"to\": \"__VERSION__ = \\\"${nextRelease.version}\\\"\",\n            \"ignore\": [\"foo/go.py\"],\n            \"results\": [\n              {\n                \"file\": \"foo/__init__.py\",\n                \"hasChanged\": true,\n                \"numMatches\": 1,\n                \"numReplacements\": 1\n              }\n            ],\n            \"countMatches\": true\n          }\n        ]\n      }\n    ],\n    [\n      \"@semantic-release/git\",\n      {\n        \"assets\": [\"foo/**/*.py\"]\n      }\n    ]\n  ]\n}\n```\n\n### Real-world Examples\n\n#### JSON Version (like whmcs.json)\n```json\n{\n  \"replacements\": [\n    {\n      \"files\": [\"./modules/addons/cnicdnsmanager/whmcs.json\"],\n      \"from\": \"\\\"version\\\": \\\"\\\\d+\\\\.\\\\d+\\\\.\\\\d+\\\"\",\n      \"to\": \"\\\"version\\\": \\\"${nextRelease.version}\\\"\",\n      \"countMatches\": true\n    }\n  ]\n}\n```\n\n#### Gradle Build File\n```json\n{\n  \"replacements\": [\n    {\n      \"files\": [\"./build.gradle\"],\n      \"from\": \"version = '[^']+'\",\n      \"to\": \"version = '${nextRelease.version}'\",\n      \"countMatches\": true\n    }\n  ]\n}\n```\n\n#### Multiple Files with Results Validation\n```json\n{\n  \"replacements\": [\n    {\n      \"files\": [\"./release.json\", \"./COPYRIGHTS\"],\n      \"from\": \"(19|20)\\\\d{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12]\\\\d|3[01])\",\n      \"to\": \"${(new Date()).toISOString().split('T')[0]}\",\n      \"countMatches\": true,\n      \"results\": [\n        {\n          \"file\": \"./release.json\",\n          \"hasChanged\": true,\n          \"numMatches\": 1,\n          \"numReplacements\": 1\n        },\n        {\n          \"file\": \"./COPYRIGHTS\",\n          \"hasChanged\": true,\n          \"numMatches\": 1,\n          \"numReplacements\": 1\n        }\n      ]\n    }\n  ]\n}\n```\n\n### Validation\n\nThe presence of the `results` array will trigger validation that a replacement has been made. This is optional but recommended.\n\n### Warning\n\nThis plugin will not commit changes unless you specify assets for the @semantic-release/git plugin! This is highlighted below.\n\n```\n[\n  \"@semantic-release/git\",\n  {\n    \"assets\": [\"foo/*.py\"]\n  }\n]\n```\n\n## Troubleshooting\n\n### Common Issues\n\n#### Pattern Not Matching\n**Problem:** \"No files found matching pattern\"\n\n**Solutions:**\n- Verify glob pattern is correct (use `foo/**/*.py` not `foo/**.py`)\n- Check file paths relative to project root\n- Use `countMatches: true` to get detailed feedback\n- Test your regex pattern at [regex101.com](https://regex101.com/)\n\n#### JSON Escaping Issues\n**Problem:** Regex pattern not matching (common in `.releaserc.json`)\n\n**Remember:** In JSON, backslashes must be escaped with another backslash:\n- ❌ Wrong: `\"from\": \"\\d+\\.\\d+\"`\n- ✅ Correct: `\"from\": \"\\\\d+\\\\.\\\\d+\"`\n\n**Rule:** Double every backslash in JSON strings\n\n#### Results Validation Failed\n**Problem:** \"Expected match not found\"\n\n**Check:**\n1. Does the file actually exist?\n2. Is the glob pattern matching the right file?\n3. Do the `numMatches` and `numReplacements` match actual replacements?\n4. Is `countMatches: true` enabled?\n\n### Debugging Tips\n\n1. **Enable verbose logging**: The plugin logs all matched files and replacements\n2. **Start simple**: Test with a single replacement first\n3. **Use `results` validation**: It forces you to be explicit about expectations\n4. **Test regex patterns separately**: Use online tools before adding to config\n\n## Options\n\nPlease refer to the [documentation](./docs/README.md) for more options.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentralnicgroup-opensource%2Frtldev-middleware-semantic-release-replace-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcentralnicgroup-opensource%2Frtldev-middleware-semantic-release-replace-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentralnicgroup-opensource%2Frtldev-middleware-semantic-release-replace-plugin/lists"}