fork-version 1.4.95 → 1.6.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/CHANGELOG.md +24 -0
- package/README.md +73 -59
- package/dist/{chunk-7ZOLJADN.js → chunk-32HUIAGX.js} +104 -82
- package/dist/chunk-32HUIAGX.js.map +1 -0
- package/dist/{chunk-6SI2AHBP.cjs → chunk-MC3XSR7P.cjs} +105 -84
- package/dist/chunk-MC3XSR7P.cjs.map +1 -0
- package/dist/cli.cjs +9 -9
- package/dist/cli.js +1 -1
- package/dist/index.cjs +11 -11
- package/dist/index.d.cts +14 -6
- package/dist/index.d.ts +14 -6
- package/dist/index.js +1 -1
- package/package.json +18 -9
- package/dist/chunk-6SI2AHBP.cjs.map +0 -1
- package/dist/chunk-7ZOLJADN.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Fork Version
|
|
2
2
|
|
|
3
|
+
## 1.6.0 (2024-10-27)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* support deno.jsonc, jsr.jsonc ([#74](https://github.com/eglavin/fork-version/issues/74)) ([7506497](https://github.com/eglavin/fork-version/commit/7506497c7f49a4dd9b35f6787ce59a8d22592d3d))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## 1.5.0 (2024-10-20)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* add release as support ([9ed9c19](https://github.com/eglavin/fork-version/commit/9ed9c19d8b1b8bad94fe01a7eb7559af02f8084f))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## 1.4.96 (2024-10-20)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Docs
|
|
23
|
+
|
|
24
|
+
* align cli helper text ([#73](https://github.com/eglavin/fork-version/issues/73)) ([ca13862](https://github.com/eglavin/fork-version/commit/ca1386244dc0ac4a9ed71904d4eaa1471d8d21a2))
|
|
25
|
+
|
|
26
|
+
|
|
3
27
|
## 1.4.95 (2024-10-06)
|
|
4
28
|
|
|
5
29
|
|
package/README.md
CHANGED
|
@@ -85,48 +85,49 @@ Usage:
|
|
|
85
85
|
$ fork-version [options]
|
|
86
86
|
|
|
87
87
|
Commands:
|
|
88
|
-
--help
|
|
89
|
-
--version
|
|
90
|
-
--inspect-version
|
|
88
|
+
--help Show this help message.
|
|
89
|
+
--version Show the current version of Fork-Version.
|
|
90
|
+
--inspect-version If set, Fork-Version will print the current project version and exit.
|
|
91
91
|
|
|
92
92
|
Options:
|
|
93
|
-
--file, -F
|
|
94
|
-
--glob, -G
|
|
95
|
-
--path, -P
|
|
96
|
-
--changelog
|
|
97
|
-
--header
|
|
98
|
-
--tag-prefix
|
|
99
|
-
--pre-release
|
|
100
|
-
--pre-release-tag
|
|
101
|
-
--current-version
|
|
102
|
-
--next-version
|
|
93
|
+
--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"]]
|
|
94
|
+
--glob, -G Glob pattern to match files to be updated.
|
|
95
|
+
--path, -P The path Fork-Version will run from. [Default: process.cwd()]
|
|
96
|
+
--changelog Name of the changelog file. [Default: "CHANGELOG.md"]
|
|
97
|
+
--header The header text for the changelog.
|
|
98
|
+
--tag-prefix Specify a prefix for the created tag. [Default: "v"]
|
|
99
|
+
--pre-release Mark this release as a pre-release.
|
|
100
|
+
--pre-release-tag Mark this release with a tagged pre-release. [Example: "alpha", "beta", "rc"]
|
|
101
|
+
--current-version If set, Fork-Version will use this version instead of trying to determine one.
|
|
102
|
+
--next-version If set, Fork-Version will attempt to update to this version, instead of incrementing using "conventional-commit".
|
|
103
|
+
--release-as Release as increments the version by the specified level. [Choices: "major", "minor", "patch"]
|
|
103
104
|
|
|
104
105
|
Flags:
|
|
105
|
-
--allow-multiple-versions
|
|
106
|
-
--commit-all
|
|
107
|
-
--changelog-all
|
|
108
|
-
--debug
|
|
109
|
-
--dry-run
|
|
110
|
-
--silent
|
|
111
|
-
--git-tag-fallback
|
|
112
|
-
--sign
|
|
113
|
-
--verify
|
|
106
|
+
--allow-multiple-versions Don't throw an error if multiple versions are found in the given files. [Default: true]
|
|
107
|
+
--commit-all Commit all changes, not just files updated by Fork-Version.
|
|
108
|
+
--changelog-all If this flag is set, all default commit types will be added to the changelog.
|
|
109
|
+
--debug Output debug information.
|
|
110
|
+
--dry-run No output will be written to disk or committed.
|
|
111
|
+
--silent Run without logging to the terminal.
|
|
112
|
+
--git-tag-fallback If unable to find a version in the given files, fallback and attempt to use the latest git tag. [Default: true]
|
|
113
|
+
--sign If true, git will sign the commit with the systems GPG key.
|
|
114
|
+
--verify If true, git will run user defined git hooks before committing.
|
|
114
115
|
|
|
115
116
|
To negate a flag you can prefix it with "no-", for example "--no-git-tag-fallback" will not fallback to the latest git tag.
|
|
116
117
|
|
|
117
118
|
Skip Steps:
|
|
118
|
-
--skip-bump
|
|
119
|
-
--skip-changelog
|
|
120
|
-
--skip-commit
|
|
121
|
-
--skip-tag
|
|
119
|
+
--skip-bump Skip the version bump step.
|
|
120
|
+
--skip-changelog Skip updating the changelog.
|
|
121
|
+
--skip-commit Skip committing the changes.
|
|
122
|
+
--skip-tag Skip tagging the commit.
|
|
122
123
|
|
|
123
124
|
Conventional Changelog Overrides:
|
|
124
|
-
--commit-url-format
|
|
125
|
-
--compare-url-format
|
|
126
|
-
--issue-url-format
|
|
127
|
-
--user-url-format
|
|
128
|
-
--release-commit-message-format
|
|
129
|
-
--release-message-suffix
|
|
125
|
+
--commit-url-format Override the default commit URL format.
|
|
126
|
+
--compare-url-format Override the default compare URL format.
|
|
127
|
+
--issue-url-format Override the default issue URL format.
|
|
128
|
+
--user-url-format Override the default user URL format.
|
|
129
|
+
--release-commit-message-format Override the default release commit message format.
|
|
130
|
+
--release-message-suffix Add a suffix to the end of the release message.
|
|
130
131
|
|
|
131
132
|
Examples:
|
|
132
133
|
$ fork-version
|
|
@@ -232,33 +233,34 @@ Alternatively you can define your config using a key in your `package.json` file
|
|
|
232
233
|
|
|
233
234
|
#### Config Properties
|
|
234
235
|
|
|
235
|
-
| Property | Type | Default | Description
|
|
236
|
-
| :---------------------------------------------------- | :--------------- | :---------------------- |
|
|
237
|
-
| inspectVersion | boolean | - | Print the current version and exits
|
|
238
|
-
| [files](#configfiles) | Array\<string> | `["package.json", ...]` | List of the files to be updated
|
|
239
|
-
| [glob](#configglob) | string | - | Glob pattern to match files to be updated
|
|
240
|
-
| path | string | `process.cwd()` | The path
|
|
241
|
-
| changelog | string | `CHANGELOG.md` | Name of the changelog file
|
|
242
|
-
| header | string | `# Changelog...` | The header text for the changelog
|
|
243
|
-
| [tagPrefix](#configtagprefix) | string | `v` | Prefix for the created tag
|
|
244
|
-
| [preRelease](#configprerelease) | string / boolean | - | Make a pre-release with optional label if given value is a string
|
|
245
|
-
| currentVersion | string | - | Use this version instead of trying to determine one
|
|
246
|
-
| nextVersion | string | - | Attempt to update to this version, instead of incrementing using "conventional-commit"
|
|
247
|
-
|
|
|
248
|
-
|
|
|
249
|
-
|
|
|
250
|
-
|
|
|
251
|
-
|
|
|
252
|
-
|
|
|
253
|
-
|
|
|
254
|
-
|
|
|
255
|
-
|
|
|
256
|
-
|
|
|
257
|
-
|
|
|
258
|
-
|
|
|
259
|
-
|
|
|
260
|
-
|
|
|
261
|
-
|
|
|
236
|
+
| Property | Type | Default | Description |
|
|
237
|
+
| :---------------------------------------------------- | :--------------- | :---------------------- | :------------------------------------------------------------------------------------------------------------------ |
|
|
238
|
+
| inspectVersion | boolean | - | Print the current version and exits |
|
|
239
|
+
| [files](#configfiles) | Array\<string> | `["package.json", ...]` | List of the files to be updated |
|
|
240
|
+
| [glob](#configglob) | string | - | Glob pattern to match files to be updated |
|
|
241
|
+
| path | string | `process.cwd()` | The path Fork-Version will run from |
|
|
242
|
+
| changelog | string | `CHANGELOG.md` | Name of the changelog file |
|
|
243
|
+
| header | string | `# Changelog...` | The header text for the changelog |
|
|
244
|
+
| [tagPrefix](#configtagprefix) | string | `v` | Prefix for the created tag |
|
|
245
|
+
| [preRelease](#configprerelease) | string / boolean | - | Make a pre-release with optional label if given value is a string |
|
|
246
|
+
| currentVersion | string | - | Use this version instead of trying to determine one |
|
|
247
|
+
| nextVersion | string | - | Attempt to update to this version, instead of incrementing using "conventional-commit" |
|
|
248
|
+
| [releaseAs](#configreleaseas) | string | - | Release as increments the version by the specified level. Overrides the default behaviour of "conventional-commit". |
|
|
249
|
+
| allowMultipleVersions | boolean | true | Don't throw an error if multiple versions are found in the given files. |
|
|
250
|
+
| commitAll | boolean | false | Commit all changes, not just files updated by Fork-Version |
|
|
251
|
+
| changelogAll | boolean | false | If this flag is set, all default commit types will be added to the changelog, not just `feat` and `fix`. |
|
|
252
|
+
| debug | boolean | false | Output debug information |
|
|
253
|
+
| dryRun | boolean | false | No output will be written to disk or committed |
|
|
254
|
+
| silent | boolean | false | Run without logging to the terminal |
|
|
255
|
+
| gitTagFallback | boolean | true | If unable to find a version in the given files, fallback and attempt to use the latest git tag |
|
|
256
|
+
| sign | boolean | false | Sign the commit with the systems GPG key |
|
|
257
|
+
| verify | boolean | false | Run user defined git hooks before committing |
|
|
258
|
+
| skipBump | boolean | false | Skip the bump step |
|
|
259
|
+
| skipChangelog | boolean | false | Skip the changelog step |
|
|
260
|
+
| skipCommit | boolean | false | Skip the commit step |
|
|
261
|
+
| skipTag | boolean | false | Skip the tag step |
|
|
262
|
+
| [changelogPresetConfig](#configchangelogpresetconfig) | object | {} | Override defaults from the "conventional-changelog-conventionalcommits" preset configuration |
|
|
263
|
+
| releaseMessageSuffix | string | - | Add a suffix to the end of the release message |
|
|
262
264
|
|
|
263
265
|
##### config.files
|
|
264
266
|
|
|
@@ -268,7 +270,9 @@ By default Fork-Version will attempt to read versions from and update these file
|
|
|
268
270
|
- "package-lock.json"
|
|
269
271
|
- "npm-shrinkwrap.json"
|
|
270
272
|
- "jsr.json"
|
|
273
|
+
- "jsr.jsonc"
|
|
271
274
|
- "deno.json"
|
|
275
|
+
- "deno.jsonc"
|
|
272
276
|
- "manifest.json"
|
|
273
277
|
- "bower.json"
|
|
274
278
|
|
|
@@ -323,6 +327,16 @@ Fork-Version uses [meow](https://github.com/sindresorhus/meow) to parse cli argu
|
|
|
323
327
|
| `fork-version --pre-release` | `1.2.3-0` |
|
|
324
328
|
| `fork-version --pre-release-tag alpha` | `1.2.3-alpha-0` |
|
|
325
329
|
|
|
330
|
+
##### config.releaseAs
|
|
331
|
+
|
|
332
|
+
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.
|
|
333
|
+
|
|
334
|
+
| Example Value | Version Created |
|
|
335
|
+
|:--------------|:----------------|
|
|
336
|
+
| `major` | 2.0.0 |
|
|
337
|
+
| `minor` | 1.3.0 |
|
|
338
|
+
| `patch` | 1.2.4 |
|
|
339
|
+
|
|
326
340
|
##### config.changelogPresetConfig
|
|
327
341
|
|
|
328
342
|
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.
|
|
@@ -7,8 +7,7 @@ import { glob } from 'glob';
|
|
|
7
7
|
import meow from 'meow';
|
|
8
8
|
import conventionalChangelogConfigSpec from 'conventional-changelog-config-spec';
|
|
9
9
|
import { execFile } from 'node:child_process';
|
|
10
|
-
import
|
|
11
|
-
import { detectNewline } from 'detect-newline';
|
|
10
|
+
import { parse as parse$1, modify, applyEdits } from 'jsonc-parser';
|
|
12
11
|
import { lstatSync } from 'fs';
|
|
13
12
|
import * as cheerio from 'cheerio/slim';
|
|
14
13
|
import semver3 from 'semver';
|
|
@@ -78,17 +77,17 @@ var ForkConfigSchema = z.object({
|
|
|
78
77
|
// Commands
|
|
79
78
|
//
|
|
80
79
|
/**
|
|
81
|
-
* If set,
|
|
80
|
+
* If set, Fork-Version will print the current version and exit.
|
|
82
81
|
* @default false
|
|
83
82
|
*/
|
|
84
|
-
inspectVersion: z.boolean().describe("If set,
|
|
83
|
+
inspectVersion: z.boolean().describe("If set, Fork-Version will print the current version and exit."),
|
|
85
84
|
// Options
|
|
86
85
|
//
|
|
87
86
|
/**
|
|
88
87
|
* List of the files to be updated.
|
|
89
88
|
* @default
|
|
90
89
|
* ```js
|
|
91
|
-
* ["bower.json", "deno.json", "jsr.json", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]
|
|
90
|
+
* ["bower.json", "deno.json", "deno.jsonc", "jsr.json", "jsr.jsonc", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]
|
|
92
91
|
* ```
|
|
93
92
|
*/
|
|
94
93
|
files: z.array(z.string()).describe("List of the files to be updated."),
|
|
@@ -104,13 +103,13 @@ var ForkConfigSchema = z.object({
|
|
|
104
103
|
*/
|
|
105
104
|
glob: z.string().optional().describe("Glob pattern to match files to be updated."),
|
|
106
105
|
/**
|
|
107
|
-
* The path
|
|
106
|
+
* The path Fork-Version will run from.
|
|
108
107
|
* @default
|
|
109
108
|
* ```js
|
|
110
109
|
* process.cwd()
|
|
111
110
|
* ```
|
|
112
111
|
*/
|
|
113
|
-
path: z.string().describe('The path
|
|
112
|
+
path: z.string().describe('The path Fork-Version will run from. Defaults to "process.cwd()".'),
|
|
114
113
|
/**
|
|
115
114
|
* Name of the changelog file.
|
|
116
115
|
* @default "CHANGELOG.md"
|
|
@@ -160,18 +159,26 @@ var ForkConfigSchema = z.object({
|
|
|
160
159
|
*/
|
|
161
160
|
preRelease: z.string().or(z.boolean()).optional().describe("Make a pre-release with optional label if given value is a string."),
|
|
162
161
|
/**
|
|
163
|
-
* If set,
|
|
162
|
+
* If set, Fork-Version will use this version instead of trying to determine one.
|
|
164
163
|
* @example "1.0.0"
|
|
165
164
|
* @default undefined
|
|
166
165
|
*/
|
|
167
|
-
currentVersion: z.string().optional().describe("If set,
|
|
166
|
+
currentVersion: z.string().optional().describe("If set, Fork-Version will use this version instead of trying to determine one."),
|
|
168
167
|
/**
|
|
169
|
-
* If set,
|
|
168
|
+
* If set, Fork-Version will attempt to update to this version, instead of incrementing using "conventional-commit".
|
|
170
169
|
* @example "2.0.0"
|
|
171
170
|
* @default undefined
|
|
172
171
|
*/
|
|
173
172
|
nextVersion: z.string().optional().describe(
|
|
174
|
-
'If set,
|
|
173
|
+
'If set, Fork-Version will attempt to update to this version, instead of incrementing using "conventional-commit".'
|
|
174
|
+
),
|
|
175
|
+
/**
|
|
176
|
+
* Release as increments the version by the specified level. Overrides the default behaviour of "conventional-commit".
|
|
177
|
+
* @example "major", "minor", "patch"
|
|
178
|
+
* @default undefined
|
|
179
|
+
*/
|
|
180
|
+
releaseAs: z.union([z.literal("major"), z.literal("minor"), z.literal("patch")]).optional().describe(
|
|
181
|
+
'Release as increments the version by the specified level. Overrides the default behaviour of "conventional-commit".'
|
|
175
182
|
),
|
|
176
183
|
// Flags
|
|
177
184
|
//
|
|
@@ -181,10 +188,10 @@ var ForkConfigSchema = z.object({
|
|
|
181
188
|
*/
|
|
182
189
|
allowMultipleVersions: z.boolean().describe("Don't throw an error if multiple versions are found in the given files."),
|
|
183
190
|
/**
|
|
184
|
-
* Commit all changes, not just files updated by
|
|
191
|
+
* Commit all changes, not just files updated by Fork-Version.
|
|
185
192
|
* @default false
|
|
186
193
|
*/
|
|
187
|
-
commitAll: z.boolean().describe("Commit all changes, not just files updated by
|
|
194
|
+
commitAll: z.boolean().describe("Commit all changes, not just files updated by Fork-Version."),
|
|
188
195
|
/**
|
|
189
196
|
* By default the conventional-changelog spec will only add commit types of `feat` and `fix` to the generated changelog.
|
|
190
197
|
* If this flag is set, all [default commit types](https://github.com/conventional-changelog/conventional-changelog-config-spec/blob/238093090c14bd7d5151eb5316e635623ce633f9/versions/2.2.0/schema.json#L18)
|
|
@@ -272,7 +279,9 @@ var DEFAULT_CONFIG = {
|
|
|
272
279
|
"package-lock.json",
|
|
273
280
|
"npm-shrinkwrap.json",
|
|
274
281
|
"jsr.json",
|
|
282
|
+
"jsr.jsonc",
|
|
275
283
|
"deno.json",
|
|
284
|
+
"deno.jsonc",
|
|
276
285
|
"manifest.json",
|
|
277
286
|
// Chrome extensions
|
|
278
287
|
"bower.json"
|
|
@@ -305,48 +314,49 @@ var helperText = `Usage:
|
|
|
305
314
|
$ fork-version [options]
|
|
306
315
|
|
|
307
316
|
Commands:
|
|
308
|
-
--help
|
|
309
|
-
--version
|
|
310
|
-
--inspect-version
|
|
317
|
+
--help Show this help message.
|
|
318
|
+
--version Show the current version of Fork-Version.
|
|
319
|
+
--inspect-version If set, Fork-Version will print the current project version and exit.
|
|
311
320
|
|
|
312
321
|
Options:
|
|
313
|
-
--file, -F
|
|
314
|
-
--glob, -G
|
|
315
|
-
--path, -P
|
|
316
|
-
--changelog
|
|
317
|
-
--header
|
|
318
|
-
--tag-prefix
|
|
319
|
-
--pre-release
|
|
320
|
-
--pre-release-tag
|
|
321
|
-
--current-version
|
|
322
|
-
--next-version
|
|
322
|
+
--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"]]
|
|
323
|
+
--glob, -G Glob pattern to match files to be updated.
|
|
324
|
+
--path, -P The path Fork-Version will run from. [Default: process.cwd()]
|
|
325
|
+
--changelog Name of the changelog file. [Default: "CHANGELOG.md"]
|
|
326
|
+
--header The header text for the changelog.
|
|
327
|
+
--tag-prefix Specify a prefix for the created tag. [Default: "v"]
|
|
328
|
+
--pre-release Mark this release as a pre-release.
|
|
329
|
+
--pre-release-tag Mark this release with a tagged pre-release. [Example: "alpha", "beta", "rc"]
|
|
330
|
+
--current-version If set, Fork-Version will use this version instead of trying to determine one.
|
|
331
|
+
--next-version If set, Fork-Version will attempt to update to this version, instead of incrementing using "conventional-commit".
|
|
332
|
+
--release-as Release as increments the version by the specified level. [Choices: "major", "minor", "patch"]
|
|
323
333
|
|
|
324
334
|
Flags:
|
|
325
|
-
--allow-multiple-versions
|
|
326
|
-
--commit-all
|
|
327
|
-
--changelog-all
|
|
328
|
-
--debug
|
|
329
|
-
--dry-run
|
|
330
|
-
--silent
|
|
331
|
-
--git-tag-fallback
|
|
332
|
-
--sign
|
|
333
|
-
--verify
|
|
335
|
+
--allow-multiple-versions Don't throw an error if multiple versions are found in the given files. [Default: true]
|
|
336
|
+
--commit-all Commit all changes, not just files updated by Fork-Version.
|
|
337
|
+
--changelog-all If this flag is set, all default commit types will be added to the changelog.
|
|
338
|
+
--debug Output debug information.
|
|
339
|
+
--dry-run No output will be written to disk or committed.
|
|
340
|
+
--silent Run without logging to the terminal.
|
|
341
|
+
--git-tag-fallback If unable to find a version in the given files, fallback and attempt to use the latest git tag. [Default: true]
|
|
342
|
+
--sign If true, git will sign the commit with the systems GPG key.
|
|
343
|
+
--verify If true, git will run user defined git hooks before committing.
|
|
334
344
|
|
|
335
345
|
To negate a flag you can prefix it with "no-", for example "--no-git-tag-fallback" will not fallback to the latest git tag.
|
|
336
346
|
|
|
337
347
|
Skip Steps:
|
|
338
|
-
--skip-bump
|
|
339
|
-
--skip-changelog
|
|
340
|
-
--skip-commit
|
|
341
|
-
--skip-tag
|
|
348
|
+
--skip-bump Skip the version bump step.
|
|
349
|
+
--skip-changelog Skip updating the changelog.
|
|
350
|
+
--skip-commit Skip committing the changes.
|
|
351
|
+
--skip-tag Skip tagging the commit.
|
|
342
352
|
|
|
343
353
|
Conventional Changelog Overrides:
|
|
344
|
-
--commit-url-format
|
|
345
|
-
--compare-url-format
|
|
346
|
-
--issue-url-format
|
|
347
|
-
--user-url-format
|
|
348
|
-
--release-commit-message-format
|
|
349
|
-
--release-message-suffix
|
|
354
|
+
--commit-url-format Override the default commit URL format.
|
|
355
|
+
--compare-url-format Override the default compare URL format.
|
|
356
|
+
--issue-url-format Override the default issue URL format.
|
|
357
|
+
--user-url-format Override the default user URL format.
|
|
358
|
+
--release-commit-message-format Override the default release commit message format.
|
|
359
|
+
--release-message-suffix Add a suffix to the end of the release message.
|
|
350
360
|
|
|
351
361
|
Examples:
|
|
352
362
|
$ fork-version
|
|
@@ -379,6 +389,7 @@ function getCliArguments() {
|
|
|
379
389
|
preReleaseTag: { type: "string" },
|
|
380
390
|
currentVersion: { type: "string" },
|
|
381
391
|
nextVersion: { type: "string" },
|
|
392
|
+
releaseAs: { type: "string", choices: ["major", "minor", "patch"] },
|
|
382
393
|
// Flags
|
|
383
394
|
allowMultipleVersions: { type: "boolean" },
|
|
384
395
|
commitAll: { type: "boolean" },
|
|
@@ -628,18 +639,6 @@ var Logger = class {
|
|
|
628
639
|
}
|
|
629
640
|
}
|
|
630
641
|
};
|
|
631
|
-
|
|
632
|
-
// src/libs/stringify-package.ts
|
|
633
|
-
var DEFAULT_INDENT = 2;
|
|
634
|
-
var CRLF = "\r\n";
|
|
635
|
-
var LF = "\n";
|
|
636
|
-
function stringifyPackage(data, indent, newline) {
|
|
637
|
-
const stringified = JSON.stringify(data, null, indent ?? DEFAULT_INDENT);
|
|
638
|
-
if (newline === CRLF) {
|
|
639
|
-
return stringified.replace(new RegExp(LF, "g"), CRLF);
|
|
640
|
-
}
|
|
641
|
-
return stringified;
|
|
642
|
-
}
|
|
643
642
|
function fileExists(filePath) {
|
|
644
643
|
try {
|
|
645
644
|
return lstatSync(filePath).isFile();
|
|
@@ -649,6 +648,11 @@ function fileExists(filePath) {
|
|
|
649
648
|
}
|
|
650
649
|
|
|
651
650
|
// src/strategies/json-package.ts
|
|
651
|
+
var PARSE_OPTIONS = {
|
|
652
|
+
allowTrailingComma: true,
|
|
653
|
+
allowEmptyContent: false,
|
|
654
|
+
disallowComments: false
|
|
655
|
+
};
|
|
652
656
|
var JSONPackage = class {
|
|
653
657
|
constructor(config, logger) {
|
|
654
658
|
this.config = config;
|
|
@@ -658,8 +662,13 @@ var JSONPackage = class {
|
|
|
658
662
|
const filePath = resolve(this.config.path, fileName);
|
|
659
663
|
if (fileExists(filePath)) {
|
|
660
664
|
const fileContents = readFileSync(filePath, "utf8");
|
|
661
|
-
const
|
|
662
|
-
|
|
665
|
+
const parseErrors = [];
|
|
666
|
+
const parsedJson = parse$1(fileContents, parseErrors, PARSE_OPTIONS);
|
|
667
|
+
if (parseErrors.length) {
|
|
668
|
+
this.logger.warn(`[File Manager] Unable to parse JSON: ${fileName}`, parseErrors);
|
|
669
|
+
return void 0;
|
|
670
|
+
}
|
|
671
|
+
if (parsedJson?.version) {
|
|
663
672
|
return {
|
|
664
673
|
name: fileName,
|
|
665
674
|
path: filePath,
|
|
@@ -671,22 +680,27 @@ var JSONPackage = class {
|
|
|
671
680
|
}
|
|
672
681
|
}
|
|
673
682
|
write(fileState, newVersion) {
|
|
674
|
-
|
|
675
|
-
const
|
|
676
|
-
parsedJson
|
|
677
|
-
if (
|
|
678
|
-
|
|
683
|
+
let fileContents = readFileSync(fileState.path, "utf8");
|
|
684
|
+
const parseErrors = [];
|
|
685
|
+
const parsedJson = parse$1(fileContents, parseErrors, PARSE_OPTIONS);
|
|
686
|
+
if (parseErrors.length) {
|
|
687
|
+
this.logger.warn(`[File Manager] Unable to parse JSON: ${fileState.path}`, parseErrors);
|
|
688
|
+
return;
|
|
679
689
|
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
);
|
|
690
|
+
fileContents = setStringInJsonc(fileContents, ["version"], newVersion);
|
|
691
|
+
if (parsedJson?.packages?.[""]) {
|
|
692
|
+
fileContents = setStringInJsonc(fileContents, ["packages", "", "version"], newVersion);
|
|
693
|
+
}
|
|
694
|
+
writeFileSync(fileState.path, fileContents, "utf8");
|
|
685
695
|
}
|
|
686
696
|
isSupportedFile(fileName) {
|
|
687
|
-
return fileName.endsWith(".json");
|
|
697
|
+
return fileName.endsWith(".json") || fileName.endsWith(".jsonc");
|
|
688
698
|
}
|
|
689
699
|
};
|
|
700
|
+
function setStringInJsonc(jsonc, jsonPath, newString) {
|
|
701
|
+
const edits = modify(jsonc, jsonPath, newString, {});
|
|
702
|
+
return applyEdits(jsonc, edits);
|
|
703
|
+
}
|
|
690
704
|
var PlainText = class {
|
|
691
705
|
constructor(config, logger) {
|
|
692
706
|
this.config = config;
|
|
@@ -920,16 +934,24 @@ async function getNextVersion(config, logger, currentVersion) {
|
|
|
920
934
|
const isPreMajor = semver3.lt(currentVersion, "1.0.0");
|
|
921
935
|
let recommendedBump;
|
|
922
936
|
try {
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
937
|
+
if (config.releaseAs) {
|
|
938
|
+
recommendedBump = {
|
|
939
|
+
releaseType: config.releaseAs,
|
|
940
|
+
level: -1,
|
|
941
|
+
reason: "User defined"
|
|
942
|
+
};
|
|
943
|
+
} else {
|
|
944
|
+
recommendedBump = await conventionalRecommendedBump({
|
|
945
|
+
preset: {
|
|
946
|
+
name: "conventionalcommits",
|
|
947
|
+
...config.changelogPresetConfig,
|
|
948
|
+
preMajor: isPreMajor
|
|
949
|
+
},
|
|
950
|
+
path: config.path,
|
|
951
|
+
tagPrefix: config.tagPrefix,
|
|
952
|
+
cwd: config.path
|
|
953
|
+
});
|
|
954
|
+
}
|
|
933
955
|
} catch (_error) {
|
|
934
956
|
throw new Error(`[conventional-recommended-bump] Unable to determine next version`);
|
|
935
957
|
}
|
|
@@ -1080,5 +1102,5 @@ async function tagChanges(config, logger, git, nextVersion) {
|
|
|
1080
1102
|
}
|
|
1081
1103
|
|
|
1082
1104
|
export { FileManager, ForkConfigSchema, Logger, commitChanges, defineConfig, getCurrentVersion, getNextVersion, getUserConfig, tagChanges, updateChangelog };
|
|
1083
|
-
//# sourceMappingURL=chunk-
|
|
1084
|
-
//# sourceMappingURL=chunk-
|
|
1105
|
+
//# sourceMappingURL=chunk-32HUIAGX.js.map
|
|
1106
|
+
//# sourceMappingURL=chunk-32HUIAGX.js.map
|