Skip to content

Commit 69142ea

Browse files
fix(index.ts): ensure replacement.from and replacement.to default to empty arrays
1 parent a490964 commit 69142ea

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

dist/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ export async function prepare(PluginConfig, context) {
4747
delete replacement.results;
4848
const replaceInFileConfig = {
4949
...replacement,
50-
from: replacement.from,
51-
to: replacement.to,
50+
from: replacement.from ?? [],
51+
to: replacement.to ?? [],
5252
};
5353
// The `replace-in-file` package uses `String.replace` under the hood for
5454
// the actual replacement. If `from` is a string, this means only a

docs/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ semantic-release-replace-plugin
2828

2929
#### Defined in
3030

31-
[index.ts:26](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L26)
31+
[index.ts:26](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L26)
3232

3333
___
3434

@@ -53,7 +53,7 @@ ___
5353

5454
#### Defined in
5555

56-
[index.ts:27](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L27)
56+
[index.ts:27](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L27)
5757

5858
___
5959

@@ -63,7 +63,7 @@ ___
6363

6464
#### Defined in
6565

66-
[index.ts:31](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L31)
66+
[index.ts:31](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L31)
6767

6868
___
6969

@@ -88,7 +88,7 @@ ___
8888

8989
#### Defined in
9090

91-
[index.ts:32](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L32)
91+
[index.ts:32](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L32)
9292

9393
## Functions
9494

@@ -109,4 +109,4 @@ ___
109109

110110
#### Defined in
111111

112-
[index.ts:163](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L163)
112+
[index.ts:163](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L163)

docs/interfaces/PluginConfig.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ An array of replacements to be made.
4444

4545
#### Defined in
4646

47-
[index.ts:132](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L132)
47+
[index.ts:132](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L132)

docs/interfaces/Replacement.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ with the difference being the single string for `to` and `from`.
2828

2929
#### Defined in
3030

31-
[index.ts:87](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L87)
31+
[index.ts:87](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L87)
3232

3333
___
3434

@@ -38,7 +38,7 @@ ___
3838

3939
#### Defined in
4040

41-
[index.ts:88](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L88)
41+
[index.ts:88](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L88)
4242

4343
___
4444

@@ -48,7 +48,7 @@ ___
4848

4949
#### Defined in
5050

51-
[index.ts:89](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L89)
51+
[index.ts:89](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L89)
5252

5353
___
5454

@@ -58,7 +58,7 @@ ___
5858

5959
#### Defined in
6060

61-
[index.ts:91](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L91)
61+
[index.ts:91](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L91)
6262

6363
___
6464

@@ -68,7 +68,7 @@ ___
6868

6969
#### Defined in
7070

71-
[index.ts:90](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L90)
71+
[index.ts:90](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L90)
7272

7373
___
7474

@@ -80,7 +80,7 @@ files to search for replacements
8080

8181
#### Defined in
8282

83-
[index.ts:42](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L42)
83+
[index.ts:42](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L42)
8484

8585
___
8686

@@ -104,7 +104,7 @@ conversion rules as mentioned above.
104104

105105
#### Defined in
106106

107-
[index.ts:58](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L58)
107+
[index.ts:58](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L58)
108108

109109
___
110110

@@ -114,7 +114,7 @@ ___
114114

115115
#### Defined in
116116

117-
[index.ts:86](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L86)
117+
[index.ts:86](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L86)
118118

119119
___
120120

@@ -127,7 +127,7 @@ have been made, and if not, throw and exception with the diff.
127127

128128
#### Defined in
129129

130-
[index.ts:96](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L96)
130+
[index.ts:96](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L96)
131131

132132
___
133133

@@ -162,4 +162,4 @@ to match the amount of `from` matchers.
162162

163163
#### Defined in
164164

165-
[index.ts:85](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/17307cb/src/index.ts#L85)
165+
[index.ts:85](https://github.com/centralnicgroup-opensource/rtldev-middleware-semantic-release-replace-plugin/blob/a490964/src/index.ts#L85)

0 commit comments

Comments
 (0)