fork-version 5.1.5 → 5.1.7
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 +16 -0
- package/README.md +23 -519
- package/dist/cli.js +1 -1
- package/dist/commands/inspect.d.ts +1 -1
- package/dist/commands/main.d.ts +1 -1
- package/dist/config/define-config.d.ts +16 -1
- package/dist/config/define-config.js +16 -1
- package/dist/config/define-file-manager.d.ts +42 -0
- package/dist/config/define-file-manager.js +42 -0
- package/dist/config/types.d.ts +1 -1
- package/dist/{files → file-managers}/arm-bicep.js +2 -2
- package/dist/{files → file-managers}/install-shield-ism.js +2 -2
- package/dist/{files → file-managers}/json-package.js +2 -2
- package/dist/{files → file-managers}/ms-build-project.js +2 -2
- package/dist/{files → file-managers}/plain-text.js +2 -2
- package/dist/{files → file-managers}/yaml-package.js +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/process/commit.d.ts +1 -1
- package/dist/process/get-current-version.d.ts +1 -1
- package/dist/{files → services}/file-manager.d.ts +3 -9
- package/dist/{files → services}/file-manager.js +8 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Fork Version
|
|
2
2
|
|
|
3
|
+
## [5.1.7](https://github.com/eglavin/fork-version/compare/v5.1.6...v5.1.7) (2026-05-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Refactor
|
|
7
|
+
|
|
8
|
+
* restructure file managers within source code ([#134](https://github.com/eglavin/fork-version/issues/134)) ([71fedc8](https://github.com/eglavin/fork-version/commit/71fedc87d146222f2320bf0756d8592e67e74290))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## [5.1.6](https://github.com/eglavin/fork-version/compare/v5.1.5...v5.1.6) (2026-05-02)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Docs
|
|
15
|
+
|
|
16
|
+
* split docs out from single readme file ([#133](https://github.com/eglavin/fork-version/issues/133)) ([fb84f0c](https://github.com/eglavin/fork-version/commit/fb84f0c016b834eda248fd0d497bdeb08c748eb6))
|
|
17
|
+
|
|
18
|
+
|
|
3
19
|
## [5.1.5](https://github.com/eglavin/fork-version/compare/v5.1.4...v5.1.5) (2026-04-26)
|
|
4
20
|
|
|
5
21
|
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Although there are many alternatives such as <a href=https://github.com/googleap
|
|
|
23
23
|
By following the [conventional commit](https://www.conventionalcommits.org) standard Fork-Version can automate the following tasks for you:
|
|
24
24
|
|
|
25
25
|
1. Determine the current and next version
|
|
26
|
-
1. Update the version in the selected files [(View the supported files)](
|
|
26
|
+
1. Update the version in the selected files [(View the supported files)](./docs/Supported-File-Managers.md)
|
|
27
27
|
1. Update your changelog
|
|
28
28
|
1. Commit the changed files
|
|
29
29
|
1. Create a tag for the new version
|
|
@@ -32,14 +32,11 @@ Fork-Version won't attempt to push changes to git or to a package manager, this
|
|
|
32
32
|
|
|
33
33
|
## Using Fork-Version
|
|
34
34
|
|
|
35
|
-
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).
|
|
35
|
+
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) or a node compatible runtime.
|
|
36
36
|
|
|
37
|
-
Fork-Version can be configured either through a config file or by passing options to the tool when ran
|
|
37
|
+
Fork-Version can be configured either through a config file or by passing options to the tool when ran. To see command line options you can run `fork-version --help` or [view the Configuration documentation](./docs/Configuration.md) for details on the supported options and how to use them.
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
> Command line options get merged with config file options, any options that are declared through the cli will override options that are also in the config file (Except for the list of [files](#configfiles) which get merged).
|
|
41
|
-
|
|
42
|
-
### Using `npx` (Recommended)
|
|
39
|
+
### Using `npx`
|
|
43
40
|
|
|
44
41
|
To use Fork-Version without installation you can use `npx`:
|
|
45
42
|
|
|
@@ -50,9 +47,14 @@ npx fork-version
|
|
|
50
47
|
`npx` is a package runner which allows you to execute npm packages without installation, this can be useful when working on projects outside of the Node ecosystem.
|
|
51
48
|
|
|
52
49
|
> [!NOTE]
|
|
53
|
-
> By default `npx` will use the latest
|
|
50
|
+
> By default `npx` [will use a cached version if available on your system](https://github.com/npm/cli/issues/4108#issuecomment-1022827890) or the latest version otherwise. You can use the `latest` tag to force npx to use the latest version. Alternatively if you want to use a specific version or pin to a range you can add a version tag to the end of the package name:
|
|
54
51
|
>
|
|
55
|
-
>
|
|
52
|
+
> - `npx fork-version@5` (Recommended)
|
|
53
|
+
> - Use the latest version of fork-version in the 5.x range
|
|
54
|
+
> - `npx fork-version@5.1`
|
|
55
|
+
> - Use the latest version of fork-version in the 5.1.x range
|
|
56
|
+
> - `npx fork-version@5.1.0`
|
|
57
|
+
> - Use the specific version 5.1.0 of fork-version
|
|
56
58
|
>
|
|
57
59
|
> The version tag needs to match against one of the [published versions on npm](https://www.npmjs.com/package/fork-version?activeTab=versions).
|
|
58
60
|
|
|
@@ -70,8 +72,8 @@ To install the package locally to your project you can use one of the following
|
|
|
70
72
|
| Package Manager | Install Command |
|
|
71
73
|
| --------------- | ------------------------------------- |
|
|
72
74
|
| npm | `npm install fork-version --save-dev` |
|
|
73
|
-
| yarn | `yarn add fork-version --dev` |
|
|
74
75
|
| pnpm | `pnpm add fork-version --save-dev` |
|
|
76
|
+
| yarn | `yarn add fork-version --dev` |
|
|
75
77
|
| bun | `bun install fork-version --dev` |
|
|
76
78
|
|
|
77
79
|
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.
|
|
@@ -80,7 +82,7 @@ You can then add the following entry to your package.json scripts section and us
|
|
|
80
82
|
// package.json
|
|
81
83
|
{
|
|
82
84
|
"scripts": {
|
|
83
|
-
"release": "fork-version"
|
|
85
|
+
"release": "fork-version -G \"{*/*.csproj,*/package.json}\""
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
```
|
|
@@ -94,7 +96,7 @@ Fork-Version has a number of command modes which will make the program behave di
|
|
|
94
96
|
| Command | Description |
|
|
95
97
|
| ------------------- | ---------------------------------------------------------------------- |
|
|
96
98
|
| `main` | Bumps the version, update files, generate changelog, commits, and tag. |
|
|
97
|
-
| `inspect` | Print the current version and git tag, then exit.
|
|
99
|
+
| `inspect` | Print the current version and git tag, then exit. |
|
|
98
100
|
| `inspect-version` | Print the current version then exit. |
|
|
99
101
|
| `inspect-tag` | Print the current git tag then exit. |
|
|
100
102
|
| `validate-config` | Validates the configuration and exit. |
|
|
@@ -110,516 +112,18 @@ When ran as a cli tool Fork-Version will exit with one of the following exit cod
|
|
|
110
112
|
| 2 | Unknown Command |
|
|
111
113
|
| 3 | Config File Validation Error |
|
|
112
114
|
|
|
113
|
-
###
|
|
114
|
-
|
|
115
|
-
The following help text can be viewed by running the following command: `npx fork-version --help`
|
|
116
|
-
|
|
117
|
-
<!-- START COMMAND LINE OPTIONS -->
|
|
118
|
-
|
|
119
|
-
```text
|
|
120
|
-
Usage:
|
|
121
|
-
$ fork-version [command?] [options?]
|
|
122
|
-
|
|
123
|
-
Commands:
|
|
124
|
-
main Bumps the version, update files, generate changelog, commit, and tag. [Default when no command is provided]
|
|
125
|
-
inspect Print the current version and git tag, then exits.
|
|
126
|
-
inspect-version Print the current version then exits.
|
|
127
|
-
inspect-tag Print the current git tag then exits.
|
|
128
|
-
validate-config Validates the configuration and exits.
|
|
129
|
-
|
|
130
|
-
General Options:
|
|
131
|
-
--version Show the current version of Fork-Version and exit.
|
|
132
|
-
--help Show this help message and exit.
|
|
133
|
-
|
|
134
|
-
Location Options:
|
|
135
|
-
--file, -F List of the files to be updated. [Default: ["bower.json", "deno.json", "deno.jsonc", "jsr.json", "jsr.jsonc", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]]
|
|
136
|
-
--glob, -G Glob pattern to match files to be updated.
|
|
137
|
-
--path, -P The path Fork-Version will run from. [Default: process.cwd()]
|
|
138
|
-
|
|
139
|
-
Options:
|
|
140
|
-
--changelog Name of the changelog file. [Default: "CHANGELOG.md"]
|
|
141
|
-
--header The header text for the changelog.
|
|
142
|
-
--tag-prefix Specify a prefix for the created tag. [Default: "v"]
|
|
143
|
-
--pre-release Mark this release as a pre-release.
|
|
144
|
-
--pre-release-tag Mark this release with a tagged pre-release. [Example: "alpha", "beta", "rc"]
|
|
145
|
-
--current-version If set, Fork-Version will use this version instead of trying to determine one.
|
|
146
|
-
--next-version If set, Fork-Version will attempt to update to this version, instead of incrementing using "conventional-commit".
|
|
147
|
-
--release-as Release as increments the version by the specified level. [Choices: "major", "minor", "patch"]
|
|
148
|
-
|
|
149
|
-
Flags:
|
|
150
|
-
--allow-multiple-versions Don't throw an error if multiple versions are found in the given files. [Default: true]
|
|
151
|
-
--commit-all Commit all changes, not just files updated by Fork-Version.
|
|
152
|
-
--changelog-all If this flag is set, all default commit types will be added to the changelog.
|
|
153
|
-
--debug Output debug information.
|
|
154
|
-
--dry-run No output will be written to disk or committed.
|
|
155
|
-
--silent Run without logging to the terminal.
|
|
156
|
-
--git-tag-fallback If unable to find a version in the given files, fallback and attempt to use the latest git tag. [Default: true]
|
|
157
|
-
--sign If true, git will sign the commit with the systems GPG key.
|
|
158
|
-
--verify If true, git will run user defined git hooks before committing.
|
|
159
|
-
--as-json Output the result as JSON.
|
|
160
|
-
|
|
161
|
-
To negate a flag you can prefix it with "no-", for example "--no-git-tag-fallback" will not fallback to the latest git tag.
|
|
162
|
-
|
|
163
|
-
Skip Steps:
|
|
164
|
-
--skip-bump Skip the version bump step.
|
|
165
|
-
--skip-changelog Skip updating the changelog.
|
|
166
|
-
--skip-commit Skip committing the changes.
|
|
167
|
-
--skip-tag Skip tagging the commit.
|
|
168
|
-
|
|
169
|
-
Conventional Changelog Overrides:
|
|
170
|
-
--commit-url-format Override the default commit URL format.
|
|
171
|
-
--compare-url-format Override the default compare URL format.
|
|
172
|
-
--issue-url-format Override the default issue URL format.
|
|
173
|
-
--user-url-format Override the default user URL format.
|
|
174
|
-
--release-commit-message-format Override the default release commit message format.
|
|
175
|
-
--release-message-suffix Add a suffix to the end of the release message.
|
|
176
|
-
|
|
177
|
-
Exit Codes:
|
|
178
|
-
0: Success
|
|
179
|
-
1: General Error
|
|
180
|
-
2: Unknown Command
|
|
181
|
-
3: Config File Validation Error
|
|
182
|
-
|
|
183
|
-
Examples:
|
|
184
|
-
$ fork-version
|
|
185
|
-
Run fork-version in the current directory with default options.
|
|
186
|
-
|
|
187
|
-
$ fork-version --path ./packages/my-package
|
|
188
|
-
Run fork-version in the "./packages/my-package" directory.
|
|
189
|
-
|
|
190
|
-
$ fork-version --file package.json --file MyApi.csproj
|
|
191
|
-
Run fork-version and update the "package.json" and "MyApi.csproj" files.
|
|
192
|
-
|
|
193
|
-
$ fork-version --glob "*/package.json"
|
|
194
|
-
Run fork-version and update all "package.json" files in subdirectories.
|
|
195
|
-
|
|
196
|
-
$ fork-version inspect-version
|
|
197
|
-
Prints the current version and exits.
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
<!-- END COMMAND LINE OPTIONS -->
|
|
201
|
-
|
|
202
|
-
### Configuration File
|
|
203
|
-
|
|
204
|
-
You can configure Fork-Version using one of the following files:
|
|
205
|
-
|
|
206
|
-
- [A javascript file](#javascript-config):
|
|
207
|
-
- fork.config.ts
|
|
208
|
-
- fork.config.js
|
|
209
|
-
- fork.config.cjs
|
|
210
|
-
- fork.config.mjs
|
|
211
|
-
- [A json file](#json-config):
|
|
212
|
-
- fork.config.json
|
|
213
|
-
- package.json >> Key Name: "fork-version"
|
|
214
|
-
|
|
215
|
-
#### Javascript Config
|
|
216
|
-
|
|
217
|
-
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, using it will give you intellisense information in your code editor of choice.
|
|
218
|
-
|
|
219
|
-
```js
|
|
220
|
-
// fork.config.ts
|
|
221
|
-
import { defineConfig } from 'fork-version';
|
|
222
|
-
|
|
223
|
-
export default defineConfig({
|
|
224
|
-
header: `# My Changelog`,
|
|
225
|
-
files: ["package.json", "package-lock.json"],
|
|
226
|
-
});
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
Alternatively you can use typescript type annotations in a typescript file:
|
|
230
|
-
|
|
231
|
-
```ts
|
|
232
|
-
// fork.config.ts
|
|
233
|
-
import type { Config } from 'fork-version';
|
|
234
|
-
|
|
235
|
-
const config: Config = {
|
|
236
|
-
header: `# My Changelog`,
|
|
237
|
-
files: ["package.json", "package-lock.json"],
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
export default config;
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
Or jsdocs in a javascript file:
|
|
244
|
-
|
|
245
|
-
```js
|
|
246
|
-
// fork.config.js
|
|
247
|
-
/** @type {import("fork-version").Config} */
|
|
248
|
-
export default {
|
|
249
|
-
header: `# My Changelog`,
|
|
250
|
-
files: ["package.json", "package-lock.json"],
|
|
251
|
-
};
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
Or just raw dog it without type information. ಠ_ಠ
|
|
255
|
-
|
|
256
|
-
#### Json Config
|
|
257
|
-
|
|
258
|
-
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.
|
|
259
|
-
|
|
260
|
-
If you still want intellisense information you can use the following schema in your json file, otherwise `$schema` is an optional key.
|
|
261
|
-
|
|
262
|
-
```json
|
|
263
|
-
// fork.config.json
|
|
264
|
-
{
|
|
265
|
-
"$schema": "https://raw.githubusercontent.com/eglavin/fork-version/main/schema/latest.json",
|
|
266
|
-
"header": "# My Changelog",
|
|
267
|
-
"files": [
|
|
268
|
-
"package.json",
|
|
269
|
-
"package-lock.json"
|
|
270
|
-
]
|
|
271
|
-
}
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
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.
|
|
275
|
-
|
|
276
|
-
Alternatively you can define your config using a key in your `package.json` file called `fork-version`:
|
|
277
|
-
|
|
278
|
-
```json
|
|
279
|
-
// package.json
|
|
280
|
-
{
|
|
281
|
-
"name": "my-js-project",
|
|
282
|
-
"version": "1.2.3",
|
|
283
|
-
"fork-version": {
|
|
284
|
-
"header": "# My Changelog",
|
|
285
|
-
"files": [
|
|
286
|
-
"package.json",
|
|
287
|
-
"package-lock.json"
|
|
288
|
-
]
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
#### Config Properties
|
|
294
|
-
|
|
295
|
-
| Property | Type | Default | Description |
|
|
296
|
-
| :---------------------------------------------------- | :------------------- | :---------------------- | :------------------------------------------------------------------------------------------------------------------ |
|
|
297
|
-
| command | string | `main` | The command to run. Can be one of: main, inspect-version, inspect-tag, validate-config. Defaults to main. |
|
|
298
|
-
| [files](#configfiles) | Array\<string> | `["package.json", ...]` | List of the files to be updated |
|
|
299
|
-
| [customFileManagers](#custom-file-updaters) | Array\<IFileManager> | - | Support for user provided custom file managers |
|
|
300
|
-
| [glob](#configglob) | string | - | Glob pattern to match files to be updated |
|
|
301
|
-
| path | string | `process.cwd()` | The path Fork-Version will run from |
|
|
302
|
-
| changelog | string | `CHANGELOG.md` | Name of the changelog file |
|
|
303
|
-
| header | string | `# Changelog...` | The header text for the changelog |
|
|
304
|
-
| [tagPrefix](#configtagprefix) | string | `v` | Prefix for the created tag |
|
|
305
|
-
| [preRelease](#configprerelease) | string / boolean | - | Make a pre-release with optional label if given value is a string |
|
|
306
|
-
| currentVersion | string | - | Use this version instead of trying to determine one |
|
|
307
|
-
| nextVersion | string | - | Attempt to update to this version, instead of incrementing using "conventional-commit" |
|
|
308
|
-
| [releaseAs](#configreleaseas) | string | - | Release as increments the version by the specified level. Overrides the default behaviour of "conventional-commit". |
|
|
309
|
-
| allowMultipleVersions | boolean | true | Don't throw an error if multiple versions are found in the given files. |
|
|
310
|
-
| commitAll | boolean | false | Commit all changes, not just files updated by Fork-Version |
|
|
311
|
-
| changelogAll | boolean | false | If this flag is set, all default commit types will be added to the changelog, not just `feat` and `fix`. |
|
|
312
|
-
| debug | boolean | false | Output debug information |
|
|
313
|
-
| dryRun | boolean | false | No output will be written to disk or committed |
|
|
314
|
-
| silent | boolean | false | Run without logging to the terminal |
|
|
315
|
-
| gitTagFallback | boolean | true | If unable to find a version in the given files, fallback and attempt to use the latest git tag |
|
|
316
|
-
| sign | boolean | false | Sign the commit with the systems GPG key |
|
|
317
|
-
| verify | boolean | false | Run user defined git hooks before committing |
|
|
318
|
-
| asJson | boolean | false | Print inspected output as a parsable json string |
|
|
319
|
-
| skipBump | boolean | false | Skip the bump step |
|
|
320
|
-
| skipChangelog | boolean | false | Skip the changelog step |
|
|
321
|
-
| skipCommit | boolean | false | Skip the commit step |
|
|
322
|
-
| skipTag | boolean | false | Skip the tag step |
|
|
323
|
-
| [changelogPresetConfig](#configchangelogpresetconfig) | object | {} | Override defaults from the "conventional-changelog-conventionalcommits" preset configuration |
|
|
324
|
-
| releaseMessageSuffix | string | - | Add a suffix to the end of the release message |
|
|
325
|
-
| [commitParserOptions](#configcommitparseroptions) | object | {} | Options to pass to commits parser |
|
|
326
|
-
|
|
327
|
-
##### config.files
|
|
328
|
-
|
|
329
|
-
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.
|
|
330
|
-
|
|
331
|
-
- "package.json"
|
|
332
|
-
- "package-lock.json"
|
|
333
|
-
- "npm-shrinkwrap.json"
|
|
334
|
-
- "jsr.json"
|
|
335
|
-
- "jsr.jsonc"
|
|
336
|
-
- "deno.json"
|
|
337
|
-
- "deno.jsonc"
|
|
338
|
-
- "manifest.json"
|
|
339
|
-
- "bower.json"
|
|
340
|
-
|
|
341
|
-
See the [Supported File Types](#supported-file-types) section below to see the currently supported file types and the [Custom File Updater's](#custom-file-updaters) section below to see how to support other file types.
|
|
342
|
-
|
|
343
|
-
##### config.glob
|
|
344
|
-
|
|
345
|
-
An alternative to [config.files](#configfiles), a glob allows you to search for files using wildcard characters.
|
|
346
|
-
|
|
347
|
-
For example if you have the following folder structure:
|
|
348
|
-
|
|
349
|
-
```text
|
|
350
|
-
API/
|
|
351
|
-
- MyAPI.csproj
|
|
352
|
-
Library/
|
|
353
|
-
- MyLibrary.csproj
|
|
354
|
-
Web/
|
|
355
|
-
- package.json
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
Running `npx fork-version -G "{*/*.csproj,*/package.json}"` will update both csproj files and the package.json file.
|
|
359
|
-
|
|
360
|
-
Internally Fork-Version uses [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).
|
|
361
|
-
|
|
362
|
-
> [!WARNING]
|
|
363
|
-
> Ensure you wrap your glob pattern in quotes to prevent shell expansion.
|
|
364
|
-
|
|
365
|
-
##### config.tagPrefix
|
|
366
|
-
|
|
367
|
-
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.
|
|
368
|
-
|
|
369
|
-
| Example Value | Tag Created |
|
|
370
|
-
|:-------------------------|:------------------------------|
|
|
371
|
-
| "v" (Default) | `v1.2.3` |
|
|
372
|
-
| "" | `1.2.3` |
|
|
373
|
-
| "version/" | `version/1.2.3` |
|
|
374
|
-
| "@eglavin/fork-version-" | `@eglavin/fork-version-1.2.3` |
|
|
375
|
-
|
|
376
|
-
##### config.preRelease
|
|
377
|
-
|
|
378
|
-
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.
|
|
379
|
-
|
|
380
|
-
| Example Value | Version Created |
|
|
381
|
-
|:--------------|:----------------|
|
|
382
|
-
| `true` | `1.2.3-0` |
|
|
383
|
-
| `alpha` | `1.2.3-alpha.0` |
|
|
384
|
-
|
|
385
|
-
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:
|
|
386
|
-
|
|
387
|
-
| Example CLI Usage | Version Created |
|
|
388
|
-
|:---------------------------------------|:----------------|
|
|
389
|
-
| `fork-version --pre-release` | `1.2.3-0` |
|
|
390
|
-
| `fork-version --pre-release-tag alpha` | `1.2.3-alpha.0` |
|
|
391
|
-
|
|
392
|
-
##### config.releaseAs
|
|
393
|
-
|
|
394
|
-
Allows you to override the default versioning behaviour of Fork-Version and increment by the specified level. For example if the current version is `1.2.3` and you run Fork-Version with one of the following arguments, the version will be incremented as shown below.
|
|
395
|
-
|
|
396
|
-
| Example Value | Version Created |
|
|
397
|
-
|:--------------|:----------------|
|
|
398
|
-
| `major` | 2.0.0 |
|
|
399
|
-
| `minor` | 1.3.0 |
|
|
400
|
-
| `patch` | 1.2.4 |
|
|
401
|
-
|
|
402
|
-
##### config.changelogPresetConfig
|
|
403
|
-
|
|
404
|
-
Fork-Version uses the [conventional changelog config spec](https://github.com/conventional-changelog/conventional-changelog-config-spec). The following is an excerpt of the configurable options.
|
|
405
|
-
|
|
406
|
-
| Property | Type | Default | Description |
|
|
407
|
-
|:-------------------------------------------|:---------------|:-----------------------------------------------------------------------------|:------------------------------------------------------------------------|
|
|
408
|
-
| [types](#configchangelogpresetconfigtypes) | Array\<Type> | {} | List of explicitly supported commit message types |
|
|
409
|
-
| commitUrlFormat | string | `{{host}}/{{owner}}/{{repository}}/commit/{{hash}}` | A URL representing a specific commit at a hash |
|
|
410
|
-
| compareUrlFormat | string | `{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}` | A URL representing the comparison between two git SHAs |
|
|
411
|
-
| issueUrlFormat | string | `{{host}}/{{owner}}/{{repository}}/issues/{{id}}` | A URL representing the issue format |
|
|
412
|
-
| userUrlFormat | string | `{{host}}/{{user}}` | A URL representing a user's profile |
|
|
413
|
-
| releaseCommitMessageFormat | string | `chore(release): {{currentTag}}` | A string to be used to format the auto-generated release commit message |
|
|
414
|
-
| issuePrefixes | Array\<string> | `["#"]` | List of prefixes used to detect references to issues |
|
|
415
|
-
|
|
416
|
-
###### config.changelogPresetConfig.types
|
|
417
|
-
|
|
418
|
-
By default only `feat` and `fix` commits are added to your changelog, you can configure extra sections to show by modifying this section.
|
|
419
|
-
|
|
420
|
-
Checkout the `fork.config.js` file [here](./fork.config.js) to see an example of modifying the types.
|
|
421
|
-
|
|
422
|
-
| Property | Type | Description |
|
|
423
|
-
|:---------|:--------|:-------------------------------------------------------------------------|
|
|
424
|
-
| type | string | The type of commit message. "feat", "fix", "chore", etc.. |
|
|
425
|
-
| scope | string | The scope of the commit message. |
|
|
426
|
-
| section | string | The name of the section in the `CHANGELOG` the commit should show up in. |
|
|
427
|
-
| hidden | boolean | Should show in the generated changelog message? |
|
|
115
|
+
### Supported File Managers
|
|
428
116
|
|
|
429
|
-
|
|
117
|
+
Fork-Version supports a number of built in file managers for popular file types, the following file types are supported out of the box:
|
|
430
118
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
- [
|
|
434
|
-
- [
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
The commit parser options allow you to configure the regex patterns used to parse commits. This is useful if your team has a specific commit message format that doesn't match the default conventional commit format.
|
|
439
|
-
|
|
440
|
-
| Property | Type | Description |
|
|
441
|
-
| :--------------------- | :------------- | :------------------------------------------------ |
|
|
442
|
-
| subjectPattern | Regex | Pattern to match commit subjects |
|
|
443
|
-
| mergePattern | Regex | Pattern to match merge commits |
|
|
444
|
-
| revertPattern | Regex | Pattern to match revert commits |
|
|
445
|
-
| commentPattern | Regex | Pattern to match commented out lines |
|
|
446
|
-
| mentionPattern | Regex | Pattern to match mentions |
|
|
447
|
-
| referenceActions | Array\<string> | List of action labels to match reference sections |
|
|
448
|
-
| referenceActionPattern | Regex | Pattern to match reference sections |
|
|
449
|
-
| issuePrefixes | Array\<string> | List of issue prefixes to match issue ids |
|
|
450
|
-
| issuePattern | Regex | Pattern to match issue references |
|
|
451
|
-
| noteKeywords | Array\<string> | List of keywords to match note titles |
|
|
452
|
-
| notePattern | Regex | Pattern to match note sections |
|
|
453
|
-
|
|
454
|
-
[View the commit parser options to see the default patterns used.](./src/commit-parser/options.ts)
|
|
455
|
-
|
|
456
|
-
If you are using one of the following Git hosts, Fork-Version will automatically use the correct commit parser options for that host:
|
|
457
|
-
|
|
458
|
-
- GitHub
|
|
459
|
-
- GitLab
|
|
460
|
-
- BitBucket
|
|
461
|
-
- Azure DevOps
|
|
462
|
-
|
|
463
|
-
[View the `detect-git-host` function to see how Fork-Version detects the git host.](./src/detect-git-host/detect-git-host.ts)
|
|
464
|
-
|
|
465
|
-
### Supported File Types
|
|
466
|
-
|
|
467
|
-
- [Json Package](#json-package)
|
|
468
|
-
- [Yaml Package](#yaml-package)
|
|
469
|
-
- [Plain Text](#plain-text)
|
|
470
|
-
- [MS Build](#ms-build)
|
|
471
|
-
- [ARM Bicep](#arm-bicep)
|
|
472
|
-
- [Install Shield ISM](#install-shield-ism)
|
|
473
|
-
- [Custom File Updater's](#custom-file-updaters)
|
|
474
|
-
|
|
475
|
-
> [!Note]
|
|
476
|
-
> If your version strings include build metadata like one of the following examples:
|
|
477
|
-
>
|
|
478
|
-
> - 1.2.3+49a3f2b
|
|
479
|
-
> - 1.2.3-0+49a3f2b
|
|
480
|
-
> - 1.2.3-alpha.0+49a3f2b
|
|
481
|
-
>
|
|
482
|
-
> this metadata will be retained without modification.
|
|
483
|
-
|
|
484
|
-
#### Json Package
|
|
485
|
-
|
|
486
|
-
A json package is a json file which contains a version property, such as a npm package.json file.
|
|
487
|
-
|
|
488
|
-
```json
|
|
489
|
-
{
|
|
490
|
-
"name": "my-project",
|
|
491
|
-
"version": "1.2.3",
|
|
492
|
-
"private": false,
|
|
493
|
-
}
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
#### Yaml Package
|
|
497
|
-
|
|
498
|
-
A yaml package is a yaml file which contains a version property, such as a dart pubspec.yaml file.
|
|
499
|
-
|
|
500
|
-
```yaml
|
|
501
|
-
name: wordionary
|
|
502
|
-
description: "My project"
|
|
503
|
-
publish_to: 'none'
|
|
504
|
-
version: 1.2.3
|
|
505
|
-
```
|
|
506
|
-
|
|
507
|
-
#### Plain Text
|
|
508
|
-
|
|
509
|
-
A plain text file is a file which contains just the version as the content. Files that end with `version.txt` will be treated as a plain text version file.
|
|
510
|
-
|
|
511
|
-
```text
|
|
512
|
-
1.2.3
|
|
513
|
-
```
|
|
514
|
-
|
|
515
|
-
#### MS Build
|
|
516
|
-
|
|
517
|
-
A MS build project is an xml file with with a `Version` property under the `Project > PropertyGroup` node group.
|
|
518
|
-
|
|
519
|
-
```xml
|
|
520
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
|
521
|
-
<PropertyGroup>
|
|
522
|
-
<Version>1.2.3</Version>
|
|
523
|
-
</PropertyGroup>
|
|
524
|
-
</Project>
|
|
525
|
-
```
|
|
526
|
-
|
|
527
|
-
Fork-Version currently supports reading and updating the following file extensions: `.csproj` `.dbproj` `.esproj` `.fsproj` `.props` `.vbproj` `.vcxproj`
|
|
528
|
-
|
|
529
|
-
#### ARM Bicep
|
|
530
|
-
|
|
531
|
-
An ARM bicep file with metadata and variable called contentVersion.
|
|
532
|
-
|
|
533
|
-
```bicep
|
|
534
|
-
metadata contentVersion = '1.2.3.4'
|
|
535
|
-
var contentVersion string = '1.2.3.4'
|
|
536
|
-
```
|
|
537
|
-
|
|
538
|
-
#### Install Shield ISM
|
|
539
|
-
|
|
540
|
-
An Install Shield `*.ism` file can be either binary or an xml file. Fork-Version only supports the xml version.
|
|
541
|
-
|
|
542
|
-
```xml
|
|
543
|
-
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
544
|
-
<?xml-stylesheet type="text/xsl" href="is.xsl" ?>
|
|
545
|
-
<!DOCTYPE msi [...]>
|
|
546
|
-
<msi version="2.0" xmlns:dt="urn:schemas-microsoft-com:datatypes">
|
|
547
|
-
|
|
548
|
-
<table name="Property">
|
|
549
|
-
<row><td>ProductVersion</td><td>1.2.3</td><td/></row>
|
|
550
|
-
</table>
|
|
551
|
-
|
|
552
|
-
</msi>
|
|
553
|
-
```
|
|
554
|
-
|
|
555
|
-
#### Custom File Updater's
|
|
556
|
-
|
|
557
|
-
***Released in version 5.1.0***
|
|
558
|
-
|
|
559
|
-
If you have a file type that isn't supported by default, you can create a custom file manager to read and write the updated version to that file.
|
|
560
|
-
|
|
561
|
-
To do this you will need to create a class or an object that implements the `IFileManager` interface and add an instance of that class or object to the `customFileManagers` array in your config.
|
|
562
|
-
|
|
563
|
-
The following example show a custom file manager for a json file with the name of `test.json` with the following structure:
|
|
564
|
-
|
|
565
|
-
Example `test.json` file:
|
|
566
|
-
|
|
567
|
-
```json
|
|
568
|
-
{
|
|
569
|
-
"package": {
|
|
570
|
-
"version": "1.2.3"
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
```
|
|
574
|
-
|
|
575
|
-
Example Custom File Manager implementation:
|
|
576
|
-
|
|
577
|
-
- [Using a class to define a file manager](./examples/custom-file-manager/fork.config.ts)
|
|
578
|
-
- [Using the defineFileManager function](./examples/custom-file-manager/fork.config.defineFileManager.ts)
|
|
579
|
-
|
|
580
|
-
```ts
|
|
581
|
-
// fork.config.ts
|
|
582
|
-
import { readFile, writeFile } from "node:fs/promises";
|
|
583
|
-
import { defineConfig, MissingPropertyException, type FileState, type IFileManager } from "fork-version";
|
|
584
|
-
|
|
585
|
-
class CustomFileManager implements IFileManager {
|
|
586
|
-
async read(filePath: string): Promise<FileState | undefined> {
|
|
587
|
-
const fileContent = await readFile(filePath, "utf-8");
|
|
588
|
-
if (fileContent) {
|
|
589
|
-
const parsedContent = JSON.parse(fileContent);
|
|
590
|
-
if ("package" in parsedContent && "version" in parsedContent.package) {
|
|
591
|
-
return {
|
|
592
|
-
path: filePath,
|
|
593
|
-
version: parsedContent.package.version,
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
throw new MissingPropertyException("My Custom File", "package.version");
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
async write(fileState: FileState, newVersion: string): Promise<void> {
|
|
601
|
-
const fileContent = await readFile(fileState.path, "utf-8");
|
|
602
|
-
if (fileContent) {
|
|
603
|
-
const parsedContent = JSON.parse(fileContent);
|
|
604
|
-
if ("package" in parsedContent && "version" in parsedContent.package) {
|
|
605
|
-
parsedContent.package.version = newVersion;
|
|
606
|
-
const updatedContent = JSON.stringify(parsedContent, null, 2);
|
|
607
|
-
await writeFile(fileState.path, updatedContent, "utf-8");
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
isSupportedFile(fileName: string) {
|
|
613
|
-
return fileName === "test.json";
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
export default defineConfig({
|
|
618
|
-
customFileManagers: [new CustomFileManager()],
|
|
619
|
-
});
|
|
620
|
-
```
|
|
119
|
+
- [Json Package](./docs/Supported-File-Managers.md#json-package)
|
|
120
|
+
- [Yaml Package](./docs/Supported-File-Managers.md#yaml-package)
|
|
121
|
+
- [Plain Text](./docs/Supported-File-Managers.md#plain-text)
|
|
122
|
+
- [MS Build](./docs/Supported-File-Managers.md#ms-build)
|
|
123
|
+
- [ARM Bicep](./docs/Supported-File-Managers.md#arm-bicep)
|
|
124
|
+
- [Install Shield ISM](./docs/Supported-File-Managers.md#install-shield-ism)
|
|
621
125
|
|
|
622
|
-
|
|
126
|
+
[Read more about the supported file managers and how to create your own custom file managers.](./docs/Supported-File-Managers.md)
|
|
623
127
|
|
|
624
128
|
### Code Usage
|
|
625
129
|
|
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import { main } from "./commands/main.js";
|
|
|
4
4
|
import { validateConfig } from "./commands/validate-config.js";
|
|
5
5
|
import { Git } from "./services/git.js";
|
|
6
6
|
import { getUserConfig } from "./config/user-config.js";
|
|
7
|
-
import { FileManager } from "./
|
|
7
|
+
import { FileManager } from "./services/file-manager.js";
|
|
8
8
|
import { Logger } from "./services/logger.js";
|
|
9
9
|
import { getCliArguments } from "./config/cli-arguments.js";
|
|
10
10
|
import { join } from "node:path";
|
package/dist/commands/main.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Logger } from "../services/logger.js";
|
|
2
|
-
import { FileManager } from "../
|
|
2
|
+
import { FileManager } from "../services/file-manager.js";
|
|
3
3
|
import { ForkConfig } from "../config/types.js";
|
|
4
4
|
import { Git } from "../services/git.js";
|
|
5
5
|
import { CommitsSinceTag } from "../process/get-commits.js";
|
|
@@ -2,7 +2,22 @@ import { Config } from "./types.js";
|
|
|
2
2
|
|
|
3
3
|
//#region src/config/define-config.d.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Optional helper function to enable intellisense and type checking when defining a Fork-Version configuration object.
|
|
6
|
+
*
|
|
7
|
+
* [Fork-Version - Config Options](https://github.com/eglavin/fork-version/blob/main/docs/Configuration.md#config-options)
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* // File: fork.config.ts
|
|
12
|
+
* import { defineConfig } from "fork-version";
|
|
13
|
+
*
|
|
14
|
+
* export default defineConfig({
|
|
15
|
+
* header: "# Changelog\n\nMy Custom Changelog Header",
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param config The configuration object to be defined.
|
|
20
|
+
* @returns The same configuration object that was passed in.
|
|
6
21
|
*/
|
|
7
22
|
declare function defineConfig(config: Config): Config;
|
|
8
23
|
//#endregion
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
//#region src/config/define-config.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Optional helper function to enable intellisense and type checking when defining a Fork-Version configuration object.
|
|
4
|
+
*
|
|
5
|
+
* [Fork-Version - Config Options](https://github.com/eglavin/fork-version/blob/main/docs/Configuration.md#config-options)
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* // File: fork.config.ts
|
|
10
|
+
* import { defineConfig } from "fork-version";
|
|
11
|
+
*
|
|
12
|
+
* export default defineConfig({
|
|
13
|
+
* header: "# Changelog\n\nMy Custom Changelog Header",
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param config The configuration object to be defined.
|
|
18
|
+
* @returns The same configuration object that was passed in.
|
|
4
19
|
*/
|
|
5
20
|
function defineConfig(config) {
|
|
6
21
|
return config;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { IFileManager } from "../services/file-manager.js";
|
|
2
|
+
|
|
3
|
+
//#region src/config/define-file-manager.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Optional helper function to enable intellisense and type checking when defining a custom file manager.
|
|
6
|
+
*
|
|
7
|
+
* [Fork-Version - Custom File Managers](https://github.com/eglavin/fork-version/blob/main/docs/Supported-File-Managers.md#custom-file-updaters)
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* // File: fork.config.ts
|
|
13
|
+
* import { defineFileManager } from "fork-version";
|
|
14
|
+
*
|
|
15
|
+
* const myFileManager = defineFileManager({
|
|
16
|
+
* async read(filePath) {
|
|
17
|
+
* // Logic to read the file and extract the version.
|
|
18
|
+
* return {
|
|
19
|
+
* path: "/path/to/file",
|
|
20
|
+
* version: "1.2.3",
|
|
21
|
+
* };
|
|
22
|
+
* },
|
|
23
|
+
* async write(fileState, newVersion) {
|
|
24
|
+
* // Logic to write the updated version.
|
|
25
|
+
* },
|
|
26
|
+
* isSupportedFile(fileName) {
|
|
27
|
+
* // Logic to determine if the file is supported by this file manager.
|
|
28
|
+
* return fileName.endsWith(".custom");
|
|
29
|
+
* },
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* export default {
|
|
33
|
+
* customFileManagers: [myFileManager],
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @param fileManager The custom file manager to be defined.
|
|
38
|
+
* @returns The same file manager object that was passed in.
|
|
39
|
+
*/
|
|
40
|
+
declare function defineFileManager(fileManager: IFileManager): IFileManager;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { defineFileManager };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region src/config/define-file-manager.ts
|
|
2
|
+
/**
|
|
3
|
+
* Optional helper function to enable intellisense and type checking when defining a custom file manager.
|
|
4
|
+
*
|
|
5
|
+
* [Fork-Version - Custom File Managers](https://github.com/eglavin/fork-version/blob/main/docs/Supported-File-Managers.md#custom-file-updaters)
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // File: fork.config.ts
|
|
11
|
+
* import { defineFileManager } from "fork-version";
|
|
12
|
+
*
|
|
13
|
+
* const myFileManager = defineFileManager({
|
|
14
|
+
* async read(filePath) {
|
|
15
|
+
* // Logic to read the file and extract the version.
|
|
16
|
+
* return {
|
|
17
|
+
* path: "/path/to/file",
|
|
18
|
+
* version: "1.2.3",
|
|
19
|
+
* };
|
|
20
|
+
* },
|
|
21
|
+
* async write(fileState, newVersion) {
|
|
22
|
+
* // Logic to write the updated version.
|
|
23
|
+
* },
|
|
24
|
+
* isSupportedFile(fileName) {
|
|
25
|
+
* // Logic to determine if the file is supported by this file manager.
|
|
26
|
+
* return fileName.endsWith(".custom");
|
|
27
|
+
* },
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* export default {
|
|
31
|
+
* customFileManagers: [myFileManager],
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @param fileManager The custom file manager to be defined.
|
|
36
|
+
* @returns The same file manager object that was passed in.
|
|
37
|
+
*/
|
|
38
|
+
function defineFileManager(fileManager) {
|
|
39
|
+
return fileManager;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { defineFileManager };
|
package/dist/config/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getCliArguments } from "./cli-arguments.js";
|
|
2
2
|
import { ParserOptions } from "../commit-parser/options.js";
|
|
3
|
-
import { IFileManager } from "../
|
|
3
|
+
import { IFileManager } from "../services/file-manager.js";
|
|
4
4
|
|
|
5
5
|
//#region src/config/types.d.ts
|
|
6
6
|
interface ChangelogPresetConfigType {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MissingPropertyException } from "
|
|
1
|
+
import { MissingPropertyException } from "../services/file-manager.js";
|
|
2
2
|
import { readFile, writeFile } from "node:fs/promises";
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/file-managers/arm-bicep.ts
|
|
4
4
|
/**
|
|
5
5
|
* An ARM bicep file with metadata and variable called contentVersion.
|
|
6
6
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MissingPropertyException } from "
|
|
1
|
+
import { MissingPropertyException } from "../services/file-manager.js";
|
|
2
2
|
import { readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import * as cheerio from "cheerio/slim";
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/file-managers/install-shield-ism.ts
|
|
5
5
|
/**
|
|
6
6
|
* An InstallShield ISM file can be either XML or binary, only the XML format is supported
|
|
7
7
|
* by this file manager. The XML format typically contains a "Property" table with a
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MissingPropertyException } from "
|
|
1
|
+
import { MissingPropertyException } from "../services/file-manager.js";
|
|
2
2
|
import { readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { applyEdits, modify, parse } from "jsonc-parser";
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/file-managers/json-package.ts
|
|
5
5
|
/**
|
|
6
6
|
* A json package file should have a version property, like what can be seen
|
|
7
7
|
* in the package.json file in the root of this project.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MissingPropertyException } from "
|
|
1
|
+
import { MissingPropertyException } from "../services/file-manager.js";
|
|
2
2
|
import { readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import * as cheerio from "cheerio/slim";
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/file-managers/ms-build-project.ts
|
|
5
5
|
/**
|
|
6
6
|
* A ms-build file is an xml file with a version property under the Project > PropertyGroup node.
|
|
7
7
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MissingPropertyException } from "
|
|
1
|
+
import { MissingPropertyException } from "../services/file-manager.js";
|
|
2
2
|
import { readFile, writeFile } from "node:fs/promises";
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/file-managers/plain-text.ts
|
|
4
4
|
/**
|
|
5
5
|
* A plain text file will have just the version as the content.
|
|
6
6
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MissingPropertyException } from "
|
|
1
|
+
import { MissingPropertyException } from "../services/file-manager.js";
|
|
2
2
|
import { readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { parse, parseDocument } from "yaml";
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/file-managers/yaml-package.ts
|
|
5
5
|
/**
|
|
6
6
|
* A yaml package file should have a version property on the top level, like what can be seen
|
|
7
7
|
* in [this example project](https://github.com/eglavin/wordionary/blob/01ae9b9d604cecdf9d320ed6028a727be5e5349e/pubspec.yaml#L19C1-L19C17).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ParserOptions, createParserOptions } from "./commit-parser/options.js";
|
|
2
2
|
import { Logger } from "./services/logger.js";
|
|
3
|
-
import { FileManager, FileState, IFileManager, MissingPropertyException
|
|
3
|
+
import { FileManager, FileState, IFileManager, MissingPropertyException } from "./services/file-manager.js";
|
|
4
4
|
import { ChangelogPresetConfig, ChangelogPresetConfigType, Config, ForkConfig } from "./config/types.js";
|
|
5
5
|
import { Git } from "./services/git.js";
|
|
6
6
|
import { inspect } from "./commands/inspect.js";
|
|
@@ -11,6 +11,7 @@ import { CommitParser } from "./commit-parser/commit-parser.js";
|
|
|
11
11
|
import { filterRevertedCommits } from "./commit-parser/filter-reverted-commits.js";
|
|
12
12
|
import { ForkConfigJSONSchema, ForkConfigJSSchema } from "./config/schema.js";
|
|
13
13
|
import { defineConfig } from "./config/define-config.js";
|
|
14
|
+
import { defineFileManager } from "./config/define-file-manager.js";
|
|
14
15
|
import { getUserConfig } from "./config/user-config.js";
|
|
15
16
|
import { CommitsSinceTag, getCommitsSinceTag } from "./process/get-commits.js";
|
|
16
17
|
import { CurrentVersion, getCurrentVersion } from "./process/get-current-version.js";
|
package/dist/index.js
CHANGED
|
@@ -12,8 +12,9 @@ import { main } from "./commands/main.js";
|
|
|
12
12
|
import { validateConfig } from "./commands/validate-config.js";
|
|
13
13
|
import { ForkConfigJSONSchema, ForkConfigJSSchema } from "./config/schema.js";
|
|
14
14
|
import { defineConfig } from "./config/define-config.js";
|
|
15
|
+
import { defineFileManager } from "./config/define-file-manager.js";
|
|
15
16
|
import { Git } from "./services/git.js";
|
|
16
17
|
import { getUserConfig } from "./config/user-config.js";
|
|
17
|
-
import { FileManager, MissingPropertyException
|
|
18
|
+
import { FileManager, MissingPropertyException } from "./services/file-manager.js";
|
|
18
19
|
import { Logger } from "./services/logger.js";
|
|
19
20
|
export { CommitParser, FileManager, ForkConfigJSONSchema, ForkConfigJSSchema, Git, Logger, MissingPropertyException, commitChanges, createParserOptions, defineConfig, defineFileManager, filterRevertedCommits, getCommitsSinceTag, getCurrentVersion, getNextVersion, getUserConfig, inspect, main, tagChanges, updateChangelog, validateConfig };
|
package/dist/process/commit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Logger } from "../services/logger.js";
|
|
2
|
-
import { FileManager, FileState } from "../
|
|
2
|
+
import { FileManager, FileState } from "../services/file-manager.js";
|
|
3
3
|
import { ForkConfig } from "../config/types.js";
|
|
4
4
|
import { Git } from "../services/git.js";
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Logger } from "
|
|
1
|
+
import { Logger } from "./logger.js";
|
|
2
2
|
import { ForkConfig } from "../config/types.js";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/services/file-manager.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Exception thrown if a file manager encounters a file missing a required property,
|
|
7
7
|
* such as the "version" property in a JSON package file.
|
|
@@ -61,12 +61,6 @@ interface IFileManager {
|
|
|
61
61
|
*/
|
|
62
62
|
isSupportedFile(filePath: string): boolean;
|
|
63
63
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Helper function to define a custom file manager with proper typing.
|
|
66
|
-
*
|
|
67
|
-
* [Fork-Version - Custom File Managers](https://github.com/eglavin/fork-version#custom-file-updaters)
|
|
68
|
-
*/
|
|
69
|
-
declare function defineFileManager(fileManager: IFileManager): IFileManager;
|
|
70
64
|
declare class FileManager {
|
|
71
65
|
#private;
|
|
72
66
|
constructor(config: ForkConfig, logger: Logger);
|
|
@@ -96,4 +90,4 @@ declare class FileManager {
|
|
|
96
90
|
write(fileState: FileState, newVersion: string): Promise<void>;
|
|
97
91
|
}
|
|
98
92
|
//#endregion
|
|
99
|
-
export { FileManager, FileState, IFileManager, MissingPropertyException
|
|
93
|
+
export { FileManager, FileState, IFileManager, MissingPropertyException };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { fileExists } from "../utils/file-state.js";
|
|
2
|
-
import { JSONPackage } from "
|
|
3
|
-
import { YAMLPackage } from "
|
|
4
|
-
import { PlainText } from "
|
|
5
|
-
import { MSBuildProject } from "
|
|
6
|
-
import { ARMBicep } from "
|
|
7
|
-
import { InstallShieldISM } from "
|
|
2
|
+
import { JSONPackage } from "../file-managers/json-package.js";
|
|
3
|
+
import { YAMLPackage } from "../file-managers/yaml-package.js";
|
|
4
|
+
import { PlainText } from "../file-managers/plain-text.js";
|
|
5
|
+
import { MSBuildProject } from "../file-managers/ms-build-project.js";
|
|
6
|
+
import { ARMBicep } from "../file-managers/arm-bicep.js";
|
|
7
|
+
import { InstallShieldISM } from "../file-managers/install-shield-ism.js";
|
|
8
8
|
import { extractBuildMetadata } from "../utils/extract-build-metadata.js";
|
|
9
9
|
import { isAbsolute, relative, resolve } from "node:path";
|
|
10
|
-
//#region src/
|
|
10
|
+
//#region src/services/file-manager.ts
|
|
11
11
|
/**
|
|
12
12
|
* Exception thrown if a file manager encounters a file missing a required property,
|
|
13
13
|
* such as the "version" property in a JSON package file.
|
|
@@ -22,14 +22,6 @@ var MissingPropertyException = class extends Error {
|
|
|
22
22
|
this.propertyName = propertyName;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
/**
|
|
26
|
-
* Helper function to define a custom file manager with proper typing.
|
|
27
|
-
*
|
|
28
|
-
* [Fork-Version - Custom File Managers](https://github.com/eglavin/fork-version#custom-file-updaters)
|
|
29
|
-
*/
|
|
30
|
-
function defineFileManager(fileManager) {
|
|
31
|
-
return fileManager;
|
|
32
|
-
}
|
|
33
25
|
var FileManager = class {
|
|
34
26
|
#config;
|
|
35
27
|
#logger;
|
|
@@ -105,4 +97,4 @@ var FileManager = class {
|
|
|
105
97
|
}
|
|
106
98
|
};
|
|
107
99
|
//#endregion
|
|
108
|
-
export { FileManager, MissingPropertyException
|
|
100
|
+
export { FileManager, MissingPropertyException };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fork-version",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Fork-Version automates version control tasks such as determining, updating, and committing versions, files, and changelogs, simplifying the process when adhering to the conventional commit standard.",
|
|
6
6
|
"keywords": [
|