Skip to content
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

Added support for passing in replace-in-file functions #156

Merged
merged 6 commits into from
Aug 30, 2021
Merged

Added support for passing in replace-in-file functions #156

merged 6 commits into from
Aug 30, 2021

Conversation

Borduhh
Copy link
Contributor

@Borduhh Borduhh commented Aug 30, 2021

Added the ability to pass in a function as supported by replace-in-file(https://github.com/adamreisnz/replace-in-file#using-callbacks-for-to).

This is helpful when you are updating versioning for non-standard release channels like Android (what we are using it for).

 {
    files: ['app.config.js'],
    from: 'versionCode: .*',
    to: (match) => `versionCode: ${parseInt(match.split(':')[1].trim()) + 1}`,
 },

closes #45

@google-cla
Copy link

google-cla bot commented Aug 30, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@Borduhh
Copy link
Contributor Author

Borduhh commented Aug 30, 2021

@googlebot I signed it!

@jpoehnelt jpoehnelt self-requested a review August 30, 2021 17:27
Copy link
Owner

@jpoehnelt jpoehnelt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, can you add a basic test?

docs/interfaces/_index_.pluginconfig.md Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #156 (6dd4918) into master (d2e8b02) will decrease coverage by 5.26%.
The diff coverage is 66.66%.

Impacted file tree graph

@@             Coverage Diff             @@
##            master     #156      +/-   ##
===========================================
- Coverage   100.00%   94.73%   -5.27%     
===========================================
  Files            1        1              
  Lines           17       19       +2     
  Branches         3        5       +2     
===========================================
+ Hits            17       18       +1     
- Partials         0        1       +1     
Impacted Files Coverage Δ
src/index.ts 94.73% <66.66%> (-5.27%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d2e8b02...6dd4918. Read the comment docs.

- added test cases for function usages with `to` variable
- updated documentation with examples
docs/interfaces/_index_.replacement.md Show resolved Hide resolved
src/index.ts Show resolved Hide resolved
@jpoehnelt jpoehnelt self-requested a review August 30, 2021 20:36
Copy link
Owner

@jpoehnelt jpoehnelt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just need to npm run format npm run lint-fix

@jpoehnelt jpoehnelt merged commit 4bfa3c7 into jpoehnelt:master Aug 30, 2021
@jpoehnelt
Copy link
Owner

@Borduhh Thanks for contributing back from your fork!

github-actions bot pushed a commit that referenced this pull request Aug 30, 2021
# [1.1.0](v1.0.2...v1.1.0) (2021-08-30)

### Bug Fixes

* enables multiline regex mode ([#140](#140)) ([e14d13f](e14d13f))

### Features

* add support for passing in `replace-in-file` functions ([#156](#156)) ([4bfa3c7](4bfa3c7))
@github-actions
Copy link

🎉 This PR is included in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increment value
3 participants