@j-ulrich/release-it-regex-bumper 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +41 -16
- package/index.js +231 -170
- package/package.json +19 -10
- package/.github/workflows/CI.yml +0 -64
- package/.gitignore +0 -6
- package/.release-it.json +0 -29
- package/CHANGELOG.md +0 -152
- package/test.js +0 -670
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
> Regular expression based version read/write plugin for release-it
|
|
4
4
|
|
|
5
5
|

|
|
6
|
-
[](https://www.codacy.com/
|
|
7
|
-
[](https://www.codacy.com/
|
|
6
|
+
[](https://www.codacy.com/gh/j-ulrich/release-it-regex-bumper/dashboard?utm_source=github.com&utm_medium=referral&utm_content=j-ulrich/release-it-regex-bumper&utm_campaign=Badge_Coverage)
|
|
7
|
+
[](https://www.codacy.com/gh/j-ulrich/release-it-regex-bumper/dashboard?utm_source=github.com&utm_medium=referral&utm_content=j-ulrich/release-it-regex-bumper&utm_campaign=Badge_Grade)
|
|
8
8
|
|
|
9
9
|
This [release-it](https://github.com/release-it/release-it) plugin reads and/or writes versions
|
|
10
10
|
using regular expressions.
|
|
@@ -18,6 +18,10 @@ below for details.
|
|
|
18
18
|
|
|
19
19
|
# Installation #
|
|
20
20
|
|
|
21
|
+
> ⚠️ **Note:**
|
|
22
|
+
> Version 4 and later of release-it-regex-bumper require version 15 or later of release-it.
|
|
23
|
+
> When you are using release-it version 14.x or earlier, then use release-it-regex-bumper version 3.x or earlier.
|
|
24
|
+
|
|
21
25
|
```
|
|
22
26
|
npm install --save-dev @j-ulrich/release-it-regex-bumper
|
|
23
27
|
```
|
|
@@ -40,7 +44,7 @@ For example:
|
|
|
40
44
|
{
|
|
41
45
|
"file": "README.md",
|
|
42
46
|
"search": "Version \\d+\\.\\d+\\.\\d+",
|
|
43
|
-
"replace": "Version {{
|
|
47
|
+
"replace": "Version {{versionWithoutPrerelease}}"
|
|
44
48
|
}
|
|
45
49
|
]
|
|
46
50
|
}
|
|
@@ -48,7 +52,7 @@ For example:
|
|
|
48
52
|
}
|
|
49
53
|
```
|
|
50
54
|
|
|
51
|
-
For a more complex example, see [here](https://gitlab.com/julrich/MockNetworkAccessManager/-/blob/
|
|
55
|
+
For a more complex example, see [here](https://gitlab.com/julrich/MockNetworkAccessManager/-/blob/main/.release-it.json).
|
|
52
56
|
|
|
53
57
|
|
|
54
58
|
## Regular Expressions ##
|
|
@@ -64,7 +68,8 @@ example, the pattern `\d+` needs to be written as `"\\d+"` inside JSON.
|
|
|
64
68
|
|
|
65
69
|
## Configuration Options ##
|
|
66
70
|
|
|
67
|
-
> ℹ️ **Note:**
|
|
71
|
+
> ℹ️ **Note:**
|
|
72
|
+
> Options without a default value are required.
|
|
68
73
|
|
|
69
74
|
### `in` ###
|
|
70
75
|
|
|
@@ -117,7 +122,7 @@ Capturing groups can be used to extract the version from a part of the whole mat
|
|
|
117
122
|
documentation of the configuration option `in.search.versionCaptureGroup` for a description of the
|
|
118
123
|
handling of capturing groups.
|
|
119
124
|
|
|
120
|
-
The `in.search.pattern` also supports a set of placeholders (since version
|
|
125
|
+
The `in.search.pattern` also supports a set of placeholders (since version 3.0.0):
|
|
121
126
|
|
|
122
127
|
- `{{semver}}` is matching any version string complying to the semantic versioning specification (meaning at least
|
|
123
128
|
"major.minor.patch").
|
|
@@ -128,8 +133,8 @@ The `in.search.pattern` also supports a set of placeholders (since version 2.1.0
|
|
|
128
133
|
- `{{{}}` is matching a literal `{`. This can be used to match a literal placeholder.
|
|
129
134
|
For example: `{{{}}{foo}}` is matching `{{foo}}`
|
|
130
135
|
|
|
131
|
-
> ℹ️ **Note:**
|
|
132
|
-
|
|
136
|
+
> ℹ️ **Note:**
|
|
137
|
+
> All the placeholders are contained in a non-capturing group (`(?:...)`) so they behave like "atomic" constructs.
|
|
133
138
|
|
|
134
139
|
### `in.search.flags` ###
|
|
135
140
|
|
|
@@ -138,6 +143,8 @@ The `in.search.pattern` also supports a set of placeholders (since version 2.1.0
|
|
|
138
143
|
|
|
139
144
|
The flags for the regular expression `in.search.pattern`.
|
|
140
145
|
|
|
146
|
+
If this option is `null` or not defined, the [global `search.flags`](#searchflags) are used.
|
|
147
|
+
|
|
141
148
|
### `in.search.versionCaptureGroup` ###
|
|
142
149
|
|
|
143
150
|
**Type:** `integer|string`
|
|
@@ -258,7 +265,7 @@ In contrast to `in.search.pattern`, capturing groups are not treated special in
|
|
|
258
265
|
If this option is `null` or not defined, the [global `search`](#search) resp.
|
|
259
266
|
[global `search.pattern`](#searchpattern) is used.
|
|
260
267
|
|
|
261
|
-
The `out.search.pattern` also supports a set of placeholders (since version
|
|
268
|
+
The `out.search.pattern` also supports a set of placeholders (since version 3.0.0):
|
|
262
269
|
|
|
263
270
|
- `{{version}}` is matching the current version (before the increment).
|
|
264
271
|
- `{{major}}` is matching the major part of the current version.
|
|
@@ -274,6 +281,8 @@ The `out.search.pattern` also supports a set of placeholders (since version 2.1.
|
|
|
274
281
|
does not have a build part, it is omitted (matching empty string).
|
|
275
282
|
- `{{versionWithoutBuild}}` is matching the current version without the build part.
|
|
276
283
|
- `{{versionWithoutPrerelease}}` is matching the current version without the prerelease and build parts.
|
|
284
|
+
- `{{tag}}` is matching the current VCS tag (before the bump).
|
|
285
|
+
- `{{newVersion}}` is matching the new version (after the increment).
|
|
277
286
|
- `{{semver}}` is matching any version string complying to the semantic versioning specification (meaning at least
|
|
278
287
|
"major.minor.patch").
|
|
279
288
|
- `{{now:<format>}}` is matching the current timestamp in a format specified by the `<format>` parameter.
|
|
@@ -283,8 +292,8 @@ The `out.search.pattern` also supports a set of placeholders (since version 2.1.
|
|
|
283
292
|
- `{{{}}` is matching a literal `{`. This can be used to match a literal placeholder.
|
|
284
293
|
For example: `{{{}}{foo}}` is matching `{{foo}}`
|
|
285
294
|
|
|
286
|
-
> ℹ️ **Note:**
|
|
287
|
-
|
|
295
|
+
> ℹ️ **Note:**
|
|
296
|
+
> All the placeholders are contained in a non-capturing group (`(?:...)`) so they behave like "atomic" constructs.
|
|
288
297
|
|
|
289
298
|
### `out.search.flags` ###
|
|
290
299
|
|
|
@@ -322,13 +331,13 @@ The template string also supports a set of placeholders:
|
|
|
322
331
|
Since: 1.2.0
|
|
323
332
|
- `{{prefixedPrerelease}}` is replaced by a dash ('-') followed by the prerelease part of the new version or and empty
|
|
324
333
|
string if the version does not have a prerelease part.
|
|
325
|
-
Since:
|
|
334
|
+
Since: 3.0.0
|
|
326
335
|
- `{{build}}` is replaced by the build part of the new version or an empty string if the version does not have a
|
|
327
336
|
build part.
|
|
328
337
|
Since: 1.2.0
|
|
329
338
|
- `{{prefixedBuild}}` is replaced by a plus ('+') followed by the build part of the new version or an empty string
|
|
330
339
|
if the version does not have a build part.
|
|
331
|
-
Since:
|
|
340
|
+
Since: 3.0.0
|
|
332
341
|
- `{{versionWithoutBuild}}` is replaced by the new version without the build part.
|
|
333
342
|
Since: 1.2.0
|
|
334
343
|
- `{{versionWithoutPrerelease}}` is replaced by the new version without the prerelease and build
|
|
@@ -367,7 +376,13 @@ If `search` is an object, it takes the following properties:
|
|
|
367
376
|
**Default:** `"{{semver}}"`
|
|
368
377
|
|
|
369
378
|
The default regular expression pattern template which is used when `in.search.pattern` or
|
|
370
|
-
`out.search.pattern` is `null` or not defined. See `
|
|
379
|
+
`out.search.pattern` is `null` or not defined. See [`in.search.pattern`](#insearchpattern) and
|
|
380
|
+
[`out.search.pattern`](#outsearchpattern) for more information.
|
|
381
|
+
|
|
382
|
+
> ⚠️ **Warning:**
|
|
383
|
+
> Note that the global `search.pattern` is used for both `in.search.pattern` and `out.search.pattern` unless
|
|
384
|
+
> overridden explicitly. But `in.search.pattern` does not support all the placeholders of `out.search.pattern` and
|
|
385
|
+
> using unsupported placeholders raises an error.
|
|
371
386
|
|
|
372
387
|
If this option is not defined or set to `null`, the default value is used.
|
|
373
388
|
|
|
@@ -376,7 +391,8 @@ If this option is not defined or set to `null`, the default value is used.
|
|
|
376
391
|
**Type:** `string`
|
|
377
392
|
**Default:** `null`
|
|
378
393
|
|
|
379
|
-
The flags for the
|
|
394
|
+
The default flags for the search pattern which are used when `in.search.flags` or
|
|
395
|
+
`out.search.flags` are `null` or not defined.
|
|
380
396
|
|
|
381
397
|
### `search.versionCaptureGroup` ###
|
|
382
398
|
|
|
@@ -409,9 +425,18 @@ encodings are the ones supported by Node's `fs` module.
|
|
|
409
425
|
|
|
410
426
|
If this option is not defined or set to `null`, the default value is used.
|
|
411
427
|
|
|
428
|
+
## Tips ##
|
|
429
|
+
|
|
430
|
+
### Disable Output via Command-Line Parameter ###
|
|
431
|
+
To completely disable changing any files by the plugin, you can use the command-line parameter `--no-plugins.@j-ulrich/release-it-regex-bumper.out`.
|
|
432
|
+
For example:
|
|
433
|
+
```
|
|
434
|
+
npx release-it --no-plugins.@j-ulrich/release-it-regex-bumper.out
|
|
435
|
+
```
|
|
436
|
+
|
|
412
437
|
|
|
413
438
|
# License #
|
|
414
439
|
|
|
415
|
-
Copyright (c) 2020-
|
|
440
|
+
Copyright (c) 2020-2022 Jochen Ulrich
|
|
416
441
|
|
|
417
442
|
Licensed under [MIT license](LICENSE).
|