-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: context available in replacement function #167
Closed
ei-ds
wants to merge
1
commit into
jpoehnelt:master
from
ei-ds:feat/context-available-in-replacement-function
Closed
feat: context available in replacement function #167
ei-ds
wants to merge
1
commit into
jpoehnelt:master
from
ei-ds:feat/context-available-in-replacement-function
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Make `context` available in replacement function by binding the function's execution environment to the `semantic-release` context.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). For more information, open the CLA check for this pull request. |
@ei-ds I would be interested in this feature, are you willing to sign the cla? |
jpoehnelt
pushed a commit
that referenced
this pull request
Dec 20, 2022
* docs: generate documentation for current HEAD The documentation was not completely up-to-date with the state of the code. The URLs now all point back to the main repository. * test: fix "file contents contain" assertion This previously only set up a matcher and did not actually assert anything. This can be verified by changing to `expect.not.stringContaining` and seeing whether any tests start to fail. * feat: support full `from` functionality of `replace-in-file` To better support configuration through JSON, the default behavior of `from` for string inputs was previously changed relative to that of the `replace-in-file` package. For more advanced use cases, i.e. where a JavaScript configuration file is used, the full functionality of the `replace-in-file` package is made available. * fix: improve typing for multi-argument callback functions for `to` The `to` callback function can be as simple as a two-argument function receiving the matched string and the filename it was matched in. However if `from` is a regular expression, the function arguments may additionally contain captures, the offset for the matched substring, the whole string being inspected, etc. This type definition ensures those functions are accepted, but require providing additional type information. * feat: pass the `semantic-release` `Context` to `from` callback functions Information from the `semantic-release` `Context` may be useful when determining the which content should be replaced. The `Context` is made available as the last argument to the callback function. Alternative implementation of #167. * feat: pass the `semantic-release` `Context` to `to` callback functions Information from the `semantic-release` `Context` may be useful when determining the replacement text. The `Context` is made available as the last argument to the callback function. Alternative implementation of #167. * feat: accept multiple `from` matchers The underlying `replace-in-file` package accepts multiple matchers to be passed as an array. This functionality is made available for multiple basic string and more advanced replacements. * feat: accept multiple `to` replacements The underlying `replace-in-file` package accepts multiple replacements to be passed as an array. This functionality is made available for multiple basic string replacements and callback functions. When using multiple replacements the number of replacements needs to be the same as the number of matchers. Otherwise only a subset of the replacements is used, e.g. it's not possible to use a single string matcher and provide multiple replacements.
closing in favor of solution in #172 |
AsifNawaz-cnic
referenced
this pull request
in centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin
Mar 27, 2024
# 1.0.0 (2024-03-27) ### Bug Fixes * build before release ([36a4632](36a4632)) * build before release ([bef4c0a](bef4c0a)) * **deps:** move lodash to dependencies ([#19](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/issues/19)) ([81c8098](81c8098)) * enables multiline regex mode ([#140](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/issues/140)) ([e14d13f](e14d13f)) * improve error message ([#3](#3)) ([b7871c6](b7871c6)) * **index.ts and index.test.ts:** refactored the plugin to support latest version of semantic release ([618cf92](618cf92)) * rename package ([d105286](d105286)) * switch to esm ([#222](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/issues/222)) ([d785268](d785268)) * trigger release ([5a2606b](5a2606b)) * trigger release ([d1112bd](d1112bd)) * trigger release ([a4bd09f](a4bd09f)) * update package.json ([90c2976](90c2976)) ### Features * add support for passing in `replace-in-file` functions ([#156](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/issues/156)) ([4bfa3c7](4bfa3c7)) * support more replace-in-file functionality ([#172](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/issues/172)) ([429ed59](429ed59)), closes [#167](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/issues/167) [#167](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/issues/167)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make
context
available in replacement function by binding the function's execution environment to thesemantic-release
context.