fork-version 1.4.73 → 1.4.79
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/CHANGELOG.md +48 -0
- package/README.md +262 -47
- package/dist/{chunk-B3CLPRGG.js → chunk-NDJZP53S.js} +57 -54
- package/dist/chunk-NDJZP53S.js.map +1 -0
- package/dist/{chunk-UCNX6MBY.cjs → chunk-XRFBIMVN.cjs} +57 -54
- package/dist/chunk-XRFBIMVN.cjs.map +1 -0
- package/dist/cli.cjs +10 -10
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +10 -10
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +1 -1
- package/package.json +5 -1
- package/dist/chunk-B3CLPRGG.js.map +0 -1
- package/dist/chunk-UCNX6MBY.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# Fork Version
|
|
2
2
|
|
|
3
|
+
## 1.4.79 (2024-05-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Refactor
|
|
7
|
+
|
|
8
|
+
* improve support for other type of ms build projects ([#53](https://github.com/eglavin/fork-version/issues/53)) ([51ef765](https://github.com/eglavin/fork-version/commit/51ef765653a121e15fe418b339c8d1beab3ed182))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## 1.4.78 (2024-05-06)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Refactor
|
|
15
|
+
|
|
16
|
+
* rename preReleaseTag to preRelease ([#49](https://github.com/eglavin/fork-version/issues/49)) ([0da33e1](https://github.com/eglavin/fork-version/commit/0da33e133890ca92bbba9bbb7c4adc7623d999e7))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## 1.4.77 (2024-05-06)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Docs
|
|
23
|
+
|
|
24
|
+
* add todo messages to the planned sections ([630edbd](https://github.com/eglavin/fork-version/commit/630edbd4e0efc3d8796897a7950a75bd5583f0ce))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## 1.4.76 (2024-05-06)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Docs
|
|
31
|
+
|
|
32
|
+
* improve descriptions of some sections ([#48](https://github.com/eglavin/fork-version/issues/48)) ([89375af](https://github.com/eglavin/fork-version/commit/89375afe645f5bc87ca643ba43dc567bd861560a))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## 1.4.75 (2024-05-05)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Docs
|
|
39
|
+
|
|
40
|
+
* start documentation for config files ([#47](https://github.com/eglavin/fork-version/issues/47)) ([0f5f2d0](https://github.com/eglavin/fork-version/commit/0f5f2d079b4658e0446948a171baaa06e808b66f))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## 1.4.74 (2024-05-03)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Refactor
|
|
47
|
+
|
|
48
|
+
* change to cli helper text display ([#46](https://github.com/eglavin/fork-version/issues/46)) ([2427eee](https://github.com/eglavin/fork-version/commit/2427eeefb355a14a304fdfb1d2c629d65d395e4c))
|
|
49
|
+
|
|
50
|
+
|
|
3
51
|
## 1.4.73 (2024-05-03)
|
|
4
52
|
|
|
5
53
|
|
package/README.md
CHANGED
|
@@ -29,25 +29,27 @@ By following the [conventional commit](https://www.conventionalcommits.org) stan
|
|
|
29
29
|
|
|
30
30
|
## Using Fork-Version
|
|
31
31
|
|
|
32
|
-
Primarily designed to be used
|
|
32
|
+
Primarily designed to be used with `npx`, Fork-Version can also be installed globally or directly to the node package you're working on. The only software prerequisites you need are [git](https://git-scm.com) and [node](https://nodejs.org).
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
Fork-Version can be configured either through a config file or by passing options to the tool when ran, see the [Configuration File](#configuration-file) and [Command Line Options](#command-line-options) sections below for details on the supported options.
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
> [!NOTE]
|
|
37
|
+
> Command line options override defined config file options.
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
### Using `npx` (Recommended)
|
|
39
40
|
|
|
40
|
-
To use Fork-Version with `npx` you can use the following command
|
|
41
|
+
To use Fork-Version with `npx` you can use the following command, by using `npx` you can also use Fork-Version without installation and on other projects including non node projects.
|
|
41
42
|
|
|
42
43
|
```sh
|
|
43
44
|
npx fork-version
|
|
44
45
|
```
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
npx fork-version@1.4.67
|
|
50
|
-
|
|
47
|
+
> [!NOTE]
|
|
48
|
+
> If you want to use a specific version you can add a version tag to the end of the name.
|
|
49
|
+
>
|
|
50
|
+
> Example: `npx fork-version@1.4.67`
|
|
51
|
+
>
|
|
52
|
+
> The version tag needs to match against one of the [published versions on npm](https://www.npmjs.com/package/fork-version?activeTab=versions).
|
|
51
53
|
|
|
52
54
|
### Install Locally
|
|
53
55
|
|
|
@@ -59,7 +61,7 @@ To install the package locally to your project you can use one of the following
|
|
|
59
61
|
| yarn | `yarn add fork-version --dev` |
|
|
60
62
|
| pnpm | `pnpm add fork-version --save-dev` |
|
|
61
63
|
|
|
62
|
-
You can then add the following entry to your package.json scripts section and use it like
|
|
64
|
+
You can then add the following entry to your package.json scripts section and use it like any other script you already use in your project.
|
|
63
65
|
|
|
64
66
|
```json
|
|
65
67
|
{
|
|
@@ -69,55 +71,268 @@ You can then add the following entry to your package.json scripts section and us
|
|
|
69
71
|
}
|
|
70
72
|
```
|
|
71
73
|
|
|
74
|
+
For example if you use npm you can now use `npm run release` to run Fork-Version.
|
|
75
|
+
|
|
72
76
|
### Command Line Options
|
|
73
77
|
|
|
74
78
|
<!-- START COMMAND LINE OPTIONS -->
|
|
75
79
|
|
|
76
|
-
```
|
|
80
|
+
```text
|
|
77
81
|
Usage:
|
|
78
82
|
$ fork-version [options]
|
|
79
83
|
|
|
80
84
|
Commands:
|
|
81
|
-
--help
|
|
82
|
-
|
|
83
|
-
--inspect-version
|
|
85
|
+
--help Show this help message.
|
|
86
|
+
--version Show the current version of fork-version.
|
|
87
|
+
--inspect-version If set, fork-version will print the current project version and exit.
|
|
84
88
|
|
|
85
89
|
Options:
|
|
86
|
-
--
|
|
87
|
-
|
|
88
|
-
--
|
|
89
|
-
|
|
90
|
-
--
|
|
91
|
-
|
|
92
|
-
--
|
|
93
|
-
|
|
94
|
-
--
|
|
95
|
-
|
|
96
|
-
--tag-prefix [Default: "v"]
|
|
97
|
-
Specify a prefix for the created tag.
|
|
98
|
-
--pre-release-tag [Default: undefined]
|
|
99
|
-
Make a pre-release with optional label if given value is a string.
|
|
100
|
-
--current-version
|
|
101
|
-
If set, fork-version will use this version instead of trying to determine one.
|
|
102
|
-
--next-version
|
|
103
|
-
If set, fork-version will attempt to update to this version, instead of incrementing using "conventional-commit".
|
|
90
|
+
--file, -F List of the files to be updated. [Default: ["bower.json", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]]
|
|
91
|
+
--glob, -G Glob pattern to match files to be updated.
|
|
92
|
+
--path, -P The path fork-version will run from. [Default: process.cwd()]
|
|
93
|
+
--changelog Name of the changelog file. [Default: "CHANGELOG.md"]
|
|
94
|
+
--header The header text for the changelog.
|
|
95
|
+
--tag-prefix Specify a prefix for the created tag. [Default: "v"]
|
|
96
|
+
--pre-release Mark this release as a pre-release.
|
|
97
|
+
--pre-release-tag Mark this release with a tagged pre-release. [Example: "alpha", "beta", "rc"]
|
|
98
|
+
--current-version If set, fork-version will use this version instead of trying to determine one.
|
|
99
|
+
--next-version If set, fork-version will attempt to update to this version, instead of incrementing using "conventional-commit".
|
|
104
100
|
|
|
105
101
|
Flags:
|
|
102
|
+
--commit-all Commit all changes, not just files updated by fork-version.
|
|
103
|
+
--debug Output debug information.
|
|
104
|
+
--dry-run No output will be written to disk or committed.
|
|
105
|
+
--silent Run without logging to the terminal.
|
|
106
|
+
--git-tag-fallback If unable to find a version in the given files, fallback and attempt to use the latest git tag. [Default: true]
|
|
107
|
+
--sign If true, git will sign the commit with the systems GPG key.
|
|
108
|
+
--verify If true, git will run user defined git hooks before committing.
|
|
106
109
|
|
|
107
|
-
--
|
|
108
|
-
Commit all staged changes, not just files updated by fork-version.
|
|
109
|
-
--debug
|
|
110
|
-
Output debug information.
|
|
111
|
-
--dry-run
|
|
112
|
-
No output will be written to disk or committed.
|
|
113
|
-
--silent
|
|
114
|
-
Run without logging to the terminal.
|
|
115
|
-
--git-tag-fallback [Default: true]
|
|
116
|
-
If unable to find a version in the given files, fallback and attempt to use the latest git tag.
|
|
117
|
-
--sign
|
|
118
|
-
If true, git will sign the commit with the systems GPG key.
|
|
119
|
-
--verify
|
|
120
|
-
If true, git will run user defined git hooks before committing.
|
|
110
|
+
To negate a flag you can prefix it with "no-", for example "--no-git-tag-fallback" will not fallback to the latest git tag.
|
|
121
111
|
```
|
|
122
112
|
|
|
123
113
|
<!-- END COMMAND LINE OPTIONS -->
|
|
114
|
+
|
|
115
|
+
### Configuration File
|
|
116
|
+
|
|
117
|
+
You can configure Fork-Version using one of the following files:
|
|
118
|
+
|
|
119
|
+
- [A javascript file](#javascript-config):
|
|
120
|
+
- fork.config.ts
|
|
121
|
+
- fork.config.js
|
|
122
|
+
- fork.config.cjs
|
|
123
|
+
- fork.config.mjs
|
|
124
|
+
- [A json file](#json-config):
|
|
125
|
+
- fork.config.json
|
|
126
|
+
- package.json >> Key Name: "fork-version"
|
|
127
|
+
|
|
128
|
+
#### Javascript Config
|
|
129
|
+
|
|
130
|
+
Configuring using a javascript file is the most flexible option. You can use any javascript file type you prefer including typescript, both commonjs and esm exports styles are supported. The `defineConfig` function in the following snippet is optional, though using it gives you intellisense information.
|
|
131
|
+
|
|
132
|
+
```js
|
|
133
|
+
import { defineConfig } from 'fork-version';
|
|
134
|
+
|
|
135
|
+
export default defineConfig({
|
|
136
|
+
header: `# My Changelog`,
|
|
137
|
+
files: ["package.json", "package-lock.json"],
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Alternatively you can use typescript type annotations:
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
import type { ForkConfig } from 'fork-version';
|
|
145
|
+
|
|
146
|
+
const config: ForkConfig = {
|
|
147
|
+
header: `# My Changelog`,
|
|
148
|
+
files: ["package.json", "package-lock.json"],
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export default config;
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Or jsdocs:
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
/** @type {import("fork-version").ForkConfig} */
|
|
158
|
+
export default {
|
|
159
|
+
header: `# My Changelog`,
|
|
160
|
+
files: ["package.json", "package-lock.json"],
|
|
161
|
+
};
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Or just raw dog it without type information. ಠ_ಠ
|
|
165
|
+
|
|
166
|
+
#### Json Config
|
|
167
|
+
|
|
168
|
+
Another way you can configure Fork-Version is by using a json file called `fork.config.json`. This is a good option if you're using Fork-Version on a non javascript project, or without installation.
|
|
169
|
+
|
|
170
|
+
If you still want intellisense information you can use the following schema in your json file, otherwise `$schema` is an optional key.
|
|
171
|
+
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"$schema": "https://raw.githubusercontent.com/eglavin/fork-version/main/schema/latest.json",
|
|
175
|
+
"header": "# My Changelog",
|
|
176
|
+
"files": [
|
|
177
|
+
"package.json",
|
|
178
|
+
"package-lock.json"
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Internally we're using [zod-to-json-schema](https://github.com/StefanTerdell/zod-to-json-schema) to generate the schema. Checkout the [schema folder](./schema/latest.json) to see the current state.
|
|
184
|
+
|
|
185
|
+
Alternatively you can define your config using a key in your `package.json` file called `fork-version`:
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"name": "my-js-project",
|
|
190
|
+
"version": "1.2.3",
|
|
191
|
+
"fork-version": {
|
|
192
|
+
"header": "# My Changelog",
|
|
193
|
+
"files": [
|
|
194
|
+
"package.json",
|
|
195
|
+
"package-lock.json"
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### Config Properties
|
|
202
|
+
|
|
203
|
+
| Property | Type | Default | Description |
|
|
204
|
+
| :---------------------------------------------------- | :--------------- | :---------------------- | :--------------------------------------------------------------------------------------------- |
|
|
205
|
+
| inspectVersion | boolean | - | Print the current version and exits |
|
|
206
|
+
| [files](#configfiles) | Array\<string> | `["package.json", ...]` | List of the files to be updated |
|
|
207
|
+
| [glob](#configglob) | string | - | Glob pattern to match files to be updated |
|
|
208
|
+
| path | string | `process.cwd()` | The path fork-version will run from |
|
|
209
|
+
| changelog | string | `CHANGELOG.md` | Name of the changelog file |
|
|
210
|
+
| header | string | `# Changelog...` | The header text for the changelog |
|
|
211
|
+
| [tagPrefix](#configtagprefix) | string | `v` | Prefix for the created tag |
|
|
212
|
+
| [preRelease](#configprerelease) | string / boolean | - | Make a pre-release with optional label if given value is a string |
|
|
213
|
+
| currentVersion | string | - | Use this version instead of trying to determine one |
|
|
214
|
+
| nextVersion | string | - | Attempt to update to this version, instead of incrementing using "conventional-commit" |
|
|
215
|
+
| commitAll | boolean | false | Commit all changes, not just files updated by fork-version |
|
|
216
|
+
| debug | boolean | false | Output debug information |
|
|
217
|
+
| dryRun | boolean | false | No output will be written to disk or committed |
|
|
218
|
+
| silent | boolean | false | Run without logging to the terminal |
|
|
219
|
+
| gitTagFallback | boolean | true | If unable to find a version in the given files, fallback and attempt to use the latest git tag |
|
|
220
|
+
| sign | boolean | false | Sign the commit with the systems GPG key |
|
|
221
|
+
| verify | boolean | false | Run user defined git hooks before committing |
|
|
222
|
+
| [changelogPresetConfig](#configchangelogpresetconfig) | object | {} | Override defaults from the "conventional-changelog-conventionalcommits" preset configuration |
|
|
223
|
+
|
|
224
|
+
##### config.files
|
|
225
|
+
|
|
226
|
+
By default Fork-Version will attempt to read versions from and update these files, if you define your own list it will override the default list instead of merging.
|
|
227
|
+
|
|
228
|
+
- "package.json"
|
|
229
|
+
- "package-lock.json"
|
|
230
|
+
- "npm-shrinkwrap.json"
|
|
231
|
+
- "manifest.json"
|
|
232
|
+
- "bower.json"
|
|
233
|
+
|
|
234
|
+
See the [Supported File Types](#supported-file-types) section below to see the currently supported file types.
|
|
235
|
+
|
|
236
|
+
##### config.glob
|
|
237
|
+
|
|
238
|
+
An alternative to [config.files](#configfiles), a glob allows you to search for files using wildcard characters.
|
|
239
|
+
|
|
240
|
+
For example if you have the following folder structure:
|
|
241
|
+
|
|
242
|
+
```text
|
|
243
|
+
API/
|
|
244
|
+
- MyAPI.csproj
|
|
245
|
+
Library/
|
|
246
|
+
- MyLibrary.csproj
|
|
247
|
+
Web/
|
|
248
|
+
- package.json
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Running `npx fork-version -G "{*/*.csproj,*/package.json}"` will update both csproj files and the package.json file.
|
|
252
|
+
|
|
253
|
+
Internally we're using [isaacs glob](https://github.com/isaacs/node-glob) to match files, read more about the pattern syntax [here](https://github.com/isaacs/node-glob/tree/v10.3.12?tab=readme-ov-file#glob-primer).
|
|
254
|
+
|
|
255
|
+
> [!WARNING]
|
|
256
|
+
> Ensure you wrap your glob pattern in quotes to prevent shell expansion.
|
|
257
|
+
|
|
258
|
+
##### config.tagPrefix
|
|
259
|
+
|
|
260
|
+
Allows you to control the prefix for the created tag. This is useful if your using a mono repo in which you version multiple projects separately or simply want to use a different prefix for your tags.
|
|
261
|
+
|
|
262
|
+
| Example Value | Tag Created |
|
|
263
|
+
|:-------------------------|:------------------------------|
|
|
264
|
+
| "v" (Default) | `v1.2.3` |
|
|
265
|
+
| "" | `1.2.3` |
|
|
266
|
+
| "version/" | `version/1.2.3` |
|
|
267
|
+
| "@eglavin/fork-version-" | `@eglavin/fork-version-1.2.3` |
|
|
268
|
+
|
|
269
|
+
##### config.preRelease
|
|
270
|
+
|
|
271
|
+
Marking a release as a pre-release allows you to define a change as a patch to a specific version. This allows you to mark a fix for a version or an alpha build for example.
|
|
272
|
+
|
|
273
|
+
| Example Value | Version Created |
|
|
274
|
+
|:--------------|:----------------|
|
|
275
|
+
| `true` | `1.2.3-0` |
|
|
276
|
+
| `alpha` | `1.2.3-alpha-0` |
|
|
277
|
+
|
|
278
|
+
Fork-Version uses [meow](https://github.com/sindresorhus/meow) to parse cli arguments which is unable to take a single argument and parse it as either a string and or a boolean. So to do the above through the cli interface you'll need to use two different arguments:
|
|
279
|
+
|
|
280
|
+
| Example CLI Usage | Version Created |
|
|
281
|
+
|:---------------------------------------|:----------------|
|
|
282
|
+
| `fork-version --pre-release` | `1.2.3-0` |
|
|
283
|
+
| `fork-version --pre-release-tag alpha` | `1.2.3-alpha-0` |
|
|
284
|
+
|
|
285
|
+
##### config.changelogPresetConfig
|
|
286
|
+
|
|
287
|
+
`TODO`
|
|
288
|
+
|
|
289
|
+
#### Supported File Types
|
|
290
|
+
|
|
291
|
+
- [Json Package](#json-package)
|
|
292
|
+
- [Plain Text](#plain-text)
|
|
293
|
+
- [MS Build](#ms-build)
|
|
294
|
+
|
|
295
|
+
##### Json Package
|
|
296
|
+
|
|
297
|
+
A json package is a json file which contains a version property, such as a npm package.json file.
|
|
298
|
+
|
|
299
|
+
```json
|
|
300
|
+
{
|
|
301
|
+
"name": "my-project",
|
|
302
|
+
"version": "1.2.3",
|
|
303
|
+
"private": false,
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
##### Plain Text
|
|
308
|
+
|
|
309
|
+
A plain text file will have just the version as the content.
|
|
310
|
+
|
|
311
|
+
```text
|
|
312
|
+
1.2.3
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
##### MS Build
|
|
316
|
+
|
|
317
|
+
A MS build project is an xml file with with a `Version` property under the `Project > PropertyGroup` node group.
|
|
318
|
+
|
|
319
|
+
```xml
|
|
320
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
321
|
+
<PropertyGroup>
|
|
322
|
+
<Version>1.2.3</Version>
|
|
323
|
+
</PropertyGroup>
|
|
324
|
+
</Project>
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
We currently support reading and updating the following file extensions: `.csproj` `.dbproj` `.esproj` `.fsproj` `.props` `.vbproj` `.vcxproj`
|
|
328
|
+
|
|
329
|
+
#### Custom File Updater's
|
|
330
|
+
|
|
331
|
+
`TODO` [add support for custom file readers and writers through config #5](https://github.com/eglavin/fork-version/issues/5)
|
|
332
|
+
|
|
333
|
+
### Code Usage
|
|
334
|
+
|
|
335
|
+
> [!WARNING]
|
|
336
|
+
> Code usage is not recommended, as the api is not stable and may change between versions.
|
|
337
|
+
>
|
|
338
|
+
> In the future this might be stabilized and documented but this is not a focus at this time.
|
|
@@ -154,7 +154,7 @@ var ForkConfigSchema = z.object({
|
|
|
154
154
|
* @example true, "alpha", "beta", "rc"
|
|
155
155
|
* @default undefined
|
|
156
156
|
*/
|
|
157
|
-
|
|
157
|
+
preRelease: z.string().or(z.boolean()).optional().describe("Make a pre-release with optional label if given value is a string."),
|
|
158
158
|
/**
|
|
159
159
|
* If set, fork-version will use this version instead of trying to determine one.
|
|
160
160
|
* @example "1.0.0"
|
|
@@ -172,10 +172,10 @@ var ForkConfigSchema = z.object({
|
|
|
172
172
|
// Flags
|
|
173
173
|
//
|
|
174
174
|
/**
|
|
175
|
-
* Commit all
|
|
175
|
+
* Commit all changes, not just files updated by fork-version.
|
|
176
176
|
* @default false
|
|
177
177
|
*/
|
|
178
|
-
commitAll: z.boolean().describe("Commit all
|
|
178
|
+
commitAll: z.boolean().describe("Commit all changes, not just files updated by fork-version."),
|
|
179
179
|
/**
|
|
180
180
|
* Output debug information.
|
|
181
181
|
* @default false
|
|
@@ -254,45 +254,32 @@ var helperText = `Usage:
|
|
|
254
254
|
$ fork-version [options]
|
|
255
255
|
|
|
256
256
|
Commands:
|
|
257
|
-
--help
|
|
258
|
-
|
|
259
|
-
--inspect-version
|
|
257
|
+
--help Show this help message.
|
|
258
|
+
--version Show the current version of fork-version.
|
|
259
|
+
--inspect-version If set, fork-version will print the current project version and exit.
|
|
260
260
|
|
|
261
261
|
Options:
|
|
262
|
-
--
|
|
263
|
-
|
|
264
|
-
--
|
|
265
|
-
|
|
266
|
-
--
|
|
267
|
-
|
|
268
|
-
--
|
|
269
|
-
|
|
270
|
-
--
|
|
271
|
-
|
|
272
|
-
--tag-prefix [Default: "v"]
|
|
273
|
-
Specify a prefix for the created tag.
|
|
274
|
-
--pre-release-tag [Default: undefined]
|
|
275
|
-
Make a pre-release with optional label if given value is a string.
|
|
276
|
-
--current-version
|
|
277
|
-
If set, fork-version will use this version instead of trying to determine one.
|
|
278
|
-
--next-version
|
|
279
|
-
If set, fork-version will attempt to update to this version, instead of incrementing using "conventional-commit".
|
|
262
|
+
--file, -F List of the files to be updated. [Default: ["bower.json", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]]
|
|
263
|
+
--glob, -G Glob pattern to match files to be updated.
|
|
264
|
+
--path, -P The path fork-version will run from. [Default: process.cwd()]
|
|
265
|
+
--changelog Name of the changelog file. [Default: "CHANGELOG.md"]
|
|
266
|
+
--header The header text for the changelog.
|
|
267
|
+
--tag-prefix Specify a prefix for the created tag. [Default: "v"]
|
|
268
|
+
--pre-release Mark this release as a pre-release.
|
|
269
|
+
--pre-release-tag Mark this release with a tagged pre-release. [Example: "alpha", "beta", "rc"]
|
|
270
|
+
--current-version If set, fork-version will use this version instead of trying to determine one.
|
|
271
|
+
--next-version If set, fork-version will attempt to update to this version, instead of incrementing using "conventional-commit".
|
|
280
272
|
|
|
281
273
|
Flags:
|
|
282
|
-
--commit-all
|
|
283
|
-
|
|
284
|
-
--
|
|
285
|
-
|
|
286
|
-
--
|
|
287
|
-
|
|
288
|
-
--
|
|
289
|
-
|
|
290
|
-
--git-tag-fallback
|
|
291
|
-
If unable to find a version in the given files, fallback and attempt to use the latest git tag.
|
|
292
|
-
--sign
|
|
293
|
-
If true, git will sign the commit with the systems GPG key.
|
|
294
|
-
--verify
|
|
295
|
-
If true, git will run user defined git hooks before committing.`;
|
|
274
|
+
--commit-all Commit all changes, not just files updated by fork-version.
|
|
275
|
+
--debug Output debug information.
|
|
276
|
+
--dry-run No output will be written to disk or committed.
|
|
277
|
+
--silent Run without logging to the terminal.
|
|
278
|
+
--git-tag-fallback If unable to find a version in the given files, fallback and attempt to use the latest git tag. [Default: true]
|
|
279
|
+
--sign If true, git will sign the commit with the systems GPG key.
|
|
280
|
+
--verify If true, git will run user defined git hooks before committing.
|
|
281
|
+
|
|
282
|
+
To negate a flag you can prefix it with "no-", for example "--no-git-tag-fallback" will not fallback to the latest git tag.`;
|
|
296
283
|
function getCliArguments() {
|
|
297
284
|
return meow(helperText, {
|
|
298
285
|
importMeta: import.meta,
|
|
@@ -308,6 +295,7 @@ function getCliArguments() {
|
|
|
308
295
|
changelog: { type: "string" },
|
|
309
296
|
header: { type: "string" },
|
|
310
297
|
tagPrefix: { type: "string" },
|
|
298
|
+
preRelease: { type: "boolean" },
|
|
311
299
|
preReleaseTag: { type: "string" },
|
|
312
300
|
currentVersion: { type: "string" },
|
|
313
301
|
nextVersion: { type: "string" },
|
|
@@ -377,11 +365,15 @@ async function getUserConfig() {
|
|
|
377
365
|
}
|
|
378
366
|
return {
|
|
379
367
|
...mergedConfig,
|
|
380
|
-
path: cwd,
|
|
381
368
|
files: filterGitIgnoredFiles(
|
|
382
369
|
cwd,
|
|
383
370
|
getFilesList(configFile?.files, cliArguments.flags?.files, globResults)
|
|
384
371
|
),
|
|
372
|
+
path: cwd,
|
|
373
|
+
preRelease: (
|
|
374
|
+
// Meow doesn't support multiple flags with the same name, so we need to check both.
|
|
375
|
+
cliArguments.flags.preReleaseTag ?? cliArguments.flags.preRelease ?? configFile.preRelease
|
|
376
|
+
),
|
|
385
377
|
changelogPresetConfig: getChangelogPresetConfig(mergedConfig?.changelogPresetConfig)
|
|
386
378
|
};
|
|
387
379
|
}
|
|
@@ -541,7 +533,7 @@ async function getNextVersion(config, logger, currentVersion) {
|
|
|
541
533
|
const releaseType = getReleaseType(
|
|
542
534
|
recommendedBump.releaseType,
|
|
543
535
|
currentVersion,
|
|
544
|
-
config.
|
|
536
|
+
config.preRelease
|
|
545
537
|
);
|
|
546
538
|
const state = {
|
|
547
539
|
...recommendedBump,
|
|
@@ -550,7 +542,7 @@ async function getNextVersion(config, logger, currentVersion) {
|
|
|
550
542
|
version: semver3.inc(
|
|
551
543
|
currentVersion,
|
|
552
544
|
releaseType,
|
|
553
|
-
typeof config.
|
|
545
|
+
typeof config.preRelease === "string" ? config.preRelease : void 0
|
|
554
546
|
) ?? ""
|
|
555
547
|
};
|
|
556
548
|
logger.log(`Next version: ${state.version} (${state.releaseType})`);
|
|
@@ -801,6 +793,9 @@ var JSONPackage = class {
|
|
|
801
793
|
"utf8"
|
|
802
794
|
);
|
|
803
795
|
}
|
|
796
|
+
isSupportedFile(fileName) {
|
|
797
|
+
return fileName.endsWith(".json");
|
|
798
|
+
}
|
|
804
799
|
};
|
|
805
800
|
var PlainText = class {
|
|
806
801
|
constructor(config, logger) {
|
|
@@ -822,8 +817,11 @@ var PlainText = class {
|
|
|
822
817
|
write(fileState, newVersion) {
|
|
823
818
|
writeFileSync(fileState.path, newVersion, "utf8");
|
|
824
819
|
}
|
|
820
|
+
isSupportedFile(fileName) {
|
|
821
|
+
return fileName.endsWith("version.txt");
|
|
822
|
+
}
|
|
825
823
|
};
|
|
826
|
-
var
|
|
824
|
+
var MSBuildProject = class {
|
|
827
825
|
constructor(config, logger) {
|
|
828
826
|
this.config = config;
|
|
829
827
|
this.logger = logger;
|
|
@@ -841,7 +839,7 @@ var CSharpProject = class {
|
|
|
841
839
|
version
|
|
842
840
|
};
|
|
843
841
|
}
|
|
844
|
-
this.logger.warn(`[File Manager] Unable to determine
|
|
842
|
+
this.logger.warn(`[File Manager] Unable to determine ms-build package: ${fileName}`);
|
|
845
843
|
}
|
|
846
844
|
}
|
|
847
845
|
write(fileState, newVersion) {
|
|
@@ -851,6 +849,11 @@ var CSharpProject = class {
|
|
|
851
849
|
const updatedContent = $.xml().replaceAll('"/>', '" />');
|
|
852
850
|
writeFileSync(fileState.path, updatedContent, "utf8");
|
|
853
851
|
}
|
|
852
|
+
isSupportedFile(fileName) {
|
|
853
|
+
return [".csproj", ".dbproj", ".esproj", ".fsproj", ".props", ".vbproj", ".vcxproj"].findIndex(
|
|
854
|
+
(ext) => fileName.endsWith(ext)
|
|
855
|
+
) !== -1;
|
|
856
|
+
}
|
|
854
857
|
};
|
|
855
858
|
|
|
856
859
|
// src/strategies/file-manager.ts
|
|
@@ -860,11 +863,11 @@ var FileManager = class {
|
|
|
860
863
|
this.logger = logger;
|
|
861
864
|
this.JSONPackage = new JSONPackage(config, logger);
|
|
862
865
|
this.PlainText = new PlainText(config, logger);
|
|
863
|
-
this.
|
|
866
|
+
this.MSBuildProject = new MSBuildProject(config, logger);
|
|
864
867
|
}
|
|
865
868
|
JSONPackage;
|
|
866
869
|
PlainText;
|
|
867
|
-
|
|
870
|
+
MSBuildProject;
|
|
868
871
|
/**
|
|
869
872
|
* Get the state from the given file name.
|
|
870
873
|
*
|
|
@@ -880,14 +883,14 @@ var FileManager = class {
|
|
|
880
883
|
*/
|
|
881
884
|
read(fileName) {
|
|
882
885
|
const _fileName = fileName.toLowerCase();
|
|
883
|
-
if (
|
|
886
|
+
if (this.JSONPackage.isSupportedFile(_fileName)) {
|
|
884
887
|
return this.JSONPackage.read(fileName);
|
|
885
888
|
}
|
|
886
|
-
if (
|
|
889
|
+
if (this.PlainText.isSupportedFile(_fileName)) {
|
|
887
890
|
return this.PlainText.read(fileName);
|
|
888
891
|
}
|
|
889
|
-
if (
|
|
890
|
-
return this.
|
|
892
|
+
if (this.MSBuildProject.isSupportedFile(_fileName)) {
|
|
893
|
+
return this.MSBuildProject.read(fileName);
|
|
891
894
|
}
|
|
892
895
|
this.logger.error(`[File Manager] Unsupported file: ${fileName}`);
|
|
893
896
|
}
|
|
@@ -907,14 +910,14 @@ var FileManager = class {
|
|
|
907
910
|
return;
|
|
908
911
|
}
|
|
909
912
|
const _fileName = fileState.name.toLowerCase();
|
|
910
|
-
if (
|
|
913
|
+
if (this.JSONPackage.isSupportedFile(_fileName)) {
|
|
911
914
|
return this.JSONPackage.write(fileState, newVersion);
|
|
912
915
|
}
|
|
913
|
-
if (
|
|
916
|
+
if (this.PlainText.isSupportedFile(_fileName)) {
|
|
914
917
|
return this.PlainText.write(fileState, newVersion);
|
|
915
918
|
}
|
|
916
|
-
if (
|
|
917
|
-
return this.
|
|
919
|
+
if (this.MSBuildProject.isSupportedFile(_fileName)) {
|
|
920
|
+
return this.MSBuildProject.write(fileState, newVersion);
|
|
918
921
|
}
|
|
919
922
|
this.logger.error(`[File Manager] Unsupported file: ${fileState.path}`);
|
|
920
923
|
}
|
|
@@ -922,4 +925,4 @@ var FileManager = class {
|
|
|
922
925
|
|
|
923
926
|
export { FileManager, ForkConfigSchema, Git, commitChanges, defineConfig, getCurrentVersion, getNextVersion, getUserConfig, tagChanges, updateChangelog };
|
|
924
927
|
//# sourceMappingURL=out.js.map
|
|
925
|
-
//# sourceMappingURL=chunk-
|
|
928
|
+
//# sourceMappingURL=chunk-NDJZP53S.js.map
|