fork-version 1.4.79 → 1.4.83
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 +32 -0
- package/README.md +81 -17
- package/dist/{chunk-NDJZP53S.js → chunk-3GJOT3DD.js} +171 -99
- package/dist/chunk-3GJOT3DD.js.map +1 -0
- package/dist/{chunk-XRFBIMVN.cjs → chunk-EY37BGP3.cjs} +171 -99
- package/dist/chunk-EY37BGP3.cjs.map +1 -0
- package/dist/cli.cjs +63 -52
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +58 -47
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +14 -10
- package/dist/index.d.cts +61 -17
- package/dist/index.d.ts +61 -17
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-NDJZP53S.js.map +0 -1
- package/dist/chunk-XRFBIMVN.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Fork Version
|
|
2
2
|
|
|
3
|
+
## 1.4.83 (2024-05-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Refactor
|
|
7
|
+
|
|
8
|
+
* add skip step options + refactor main function ([#57](https://github.com/eglavin/fork-version/issues/57)) ([3688b6d](https://github.com/eglavin/fork-version/commit/3688b6d1f54ef4fdd6e7920b7203532a193bbb66))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## 1.4.82 (2024-05-13)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Refactor
|
|
15
|
+
|
|
16
|
+
* add conventional changelog overrides to cli ([#56](https://github.com/eglavin/fork-version/issues/56)) ([cddeda6](https://github.com/eglavin/fork-version/commit/cddeda6c81c50682329f4a44d9036b72a6045055))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## 1.4.81 (2024-05-08)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Docs
|
|
23
|
+
|
|
24
|
+
* improve documentation ([#55](https://github.com/eglavin/fork-version/issues/55)) ([0cdea27](https://github.com/eglavin/fork-version/commit/0cdea276a4913b15d00b611171d7bfd71f809846))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## 1.4.80 (2024-05-07)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Refactor
|
|
31
|
+
|
|
32
|
+
* export partial config for external use instead of internal config type ([#54](https://github.com/eglavin/fork-version/issues/54)) ([d7e16e8](https://github.com/eglavin/fork-version/commit/d7e16e8e03f43d9fedcc648f6b926030a9e2a9ec))
|
|
33
|
+
|
|
34
|
+
|
|
3
35
|
## 1.4.79 (2024-05-06)
|
|
4
36
|
|
|
5
37
|
|
package/README.md
CHANGED
|
@@ -27,6 +27,8 @@ By following the [conventional commit](https://www.conventionalcommits.org) stan
|
|
|
27
27
|
1. Commit the changed files
|
|
28
28
|
1. Create a tag for the new version
|
|
29
29
|
|
|
30
|
+
Fork-Version won't attempt to push changes to git or to a package manager, this allows you to decide how you publish your changes.
|
|
31
|
+
|
|
30
32
|
## Using Fork-Version
|
|
31
33
|
|
|
32
34
|
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).
|
|
@@ -34,7 +36,7 @@ Primarily designed to be used with `npx`, Fork-Version can also be installed glo
|
|
|
34
36
|
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
37
|
|
|
36
38
|
> [!NOTE]
|
|
37
|
-
> Command line options override
|
|
39
|
+
> 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).
|
|
38
40
|
|
|
39
41
|
### Using `npx` (Recommended)
|
|
40
42
|
|
|
@@ -108,6 +110,33 @@ Flags:
|
|
|
108
110
|
--verify If true, git will run user defined git hooks before committing.
|
|
109
111
|
|
|
110
112
|
To negate a flag you can prefix it with "no-", for example "--no-git-tag-fallback" will not fallback to the latest git tag.
|
|
113
|
+
|
|
114
|
+
Skip Steps:
|
|
115
|
+
--skip-bump Skip the version bump step.
|
|
116
|
+
--skip-changelog Skip updating the changelog.
|
|
117
|
+
--skip-commit Skip committing the changes.
|
|
118
|
+
--skip-tag Skip tagging the commit.
|
|
119
|
+
|
|
120
|
+
Conventional Changelog Overrides:
|
|
121
|
+
--commit-url-format Override the default commit URL format.
|
|
122
|
+
--compare-url-format Override the default compare URL format.
|
|
123
|
+
--issue-url-format Override the default issue URL format.
|
|
124
|
+
--user-url-format Override the default user URL format.
|
|
125
|
+
--release-commit-message-format Override the default release commit message format.
|
|
126
|
+
--release-message-suffix Add a suffix to the end of the release message.
|
|
127
|
+
|
|
128
|
+
Examples:
|
|
129
|
+
$ fork-version
|
|
130
|
+
Run fork-version in the current directory with default options.
|
|
131
|
+
|
|
132
|
+
$ fork-version --path ./packages/my-package
|
|
133
|
+
Run fork-version in the "./packages/my-package" directory.
|
|
134
|
+
|
|
135
|
+
$ fork-version --file package.json --file MyApi.csproj
|
|
136
|
+
Run fork-version and update the "package.json" and "MyApi.csproj" files.
|
|
137
|
+
|
|
138
|
+
$ fork-version --glob "*/package.json"
|
|
139
|
+
Run fork-version and update all "package.json" files in subdirectories.
|
|
111
140
|
```
|
|
112
141
|
|
|
113
142
|
<!-- END COMMAND LINE OPTIONS -->
|
|
@@ -127,7 +156,7 @@ You can configure Fork-Version using one of the following files:
|
|
|
127
156
|
|
|
128
157
|
#### Javascript Config
|
|
129
158
|
|
|
130
|
-
Configuring using a javascript file is the most flexible option. You can use any javascript file type you prefer including typescript
|
|
159
|
+
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.
|
|
131
160
|
|
|
132
161
|
```js
|
|
133
162
|
import { defineConfig } from 'fork-version';
|
|
@@ -138,12 +167,12 @@ export default defineConfig({
|
|
|
138
167
|
});
|
|
139
168
|
```
|
|
140
169
|
|
|
141
|
-
Alternatively you can use typescript type annotations:
|
|
170
|
+
Alternatively you can use typescript type annotations in a typescript file:
|
|
142
171
|
|
|
143
172
|
```ts
|
|
144
|
-
import type {
|
|
173
|
+
import type { Config } from 'fork-version';
|
|
145
174
|
|
|
146
|
-
const config:
|
|
175
|
+
const config: Config = {
|
|
147
176
|
header: `# My Changelog`,
|
|
148
177
|
files: ["package.json", "package-lock.json"],
|
|
149
178
|
};
|
|
@@ -151,10 +180,10 @@ const config: ForkConfig = {
|
|
|
151
180
|
export default config;
|
|
152
181
|
```
|
|
153
182
|
|
|
154
|
-
Or jsdocs:
|
|
183
|
+
Or jsdocs in a javascript file:
|
|
155
184
|
|
|
156
185
|
```js
|
|
157
|
-
/** @type {import("fork-version").
|
|
186
|
+
/** @type {import("fork-version").Config} */
|
|
158
187
|
export default {
|
|
159
188
|
header: `# My Changelog`,
|
|
160
189
|
files: ["package.json", "package-lock.json"],
|
|
@@ -219,7 +248,12 @@ Alternatively you can define your config using a key in your `package.json` file
|
|
|
219
248
|
| gitTagFallback | boolean | true | If unable to find a version in the given files, fallback and attempt to use the latest git tag |
|
|
220
249
|
| sign | boolean | false | Sign the commit with the systems GPG key |
|
|
221
250
|
| verify | boolean | false | Run user defined git hooks before committing |
|
|
251
|
+
| skipBump | boolean | false | Skip the bump step |
|
|
252
|
+
| skipChangelog | boolean | false | Skip the changelog step |
|
|
253
|
+
| skipCommit | boolean | false | Skip the commit step |
|
|
254
|
+
| skipTag | boolean | false | Skip the tag step |
|
|
222
255
|
| [changelogPresetConfig](#configchangelogpresetconfig) | object | {} | Override defaults from the "conventional-changelog-conventionalcommits" preset configuration |
|
|
256
|
+
| releaseMessageSuffix | string | - | Add a suffix to the end of the release message |
|
|
223
257
|
|
|
224
258
|
##### config.files
|
|
225
259
|
|
|
@@ -250,14 +284,14 @@ Web/
|
|
|
250
284
|
|
|
251
285
|
Running `npx fork-version -G "{*/*.csproj,*/package.json}"` will update both csproj files and the package.json file.
|
|
252
286
|
|
|
253
|
-
Internally
|
|
287
|
+
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).
|
|
254
288
|
|
|
255
289
|
> [!WARNING]
|
|
256
290
|
> Ensure you wrap your glob pattern in quotes to prevent shell expansion.
|
|
257
291
|
|
|
258
292
|
##### config.tagPrefix
|
|
259
293
|
|
|
260
|
-
Allows you to control the prefix for the created tag. This is useful if your using a mono
|
|
294
|
+
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
295
|
|
|
262
296
|
| Example Value | Tag Created |
|
|
263
297
|
|:-------------------------|:------------------------------|
|
|
@@ -284,15 +318,45 @@ Fork-Version uses [meow](https://github.com/sindresorhus/meow) to parse cli argu
|
|
|
284
318
|
|
|
285
319
|
##### config.changelogPresetConfig
|
|
286
320
|
|
|
287
|
-
|
|
321
|
+
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.
|
|
322
|
+
|
|
323
|
+
| Property | Type | Default | Description |
|
|
324
|
+
|:-------------------------------------------|:---------------|:-----------------------------------------------------------------------------|:------------------------------------------------------------------------|
|
|
325
|
+
| [types](#configchangelogpresetconfigtypes) | Array\<Type> | {} | List of explicitly supported commit message types |
|
|
326
|
+
| commitUrlFormat | string | `{{host}}/{{owner}}/{{repository}}/commit/{{hash}}` | A URL representing a specific commit at a hash |
|
|
327
|
+
| compareUrlFormat | string | `{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}` | A URL representing the comparison between two git SHAs |
|
|
328
|
+
| issueUrlFormat | string | `{{host}}/{{owner}}/{{repository}}/issues/{{id}}` | A URL representing the issue format |
|
|
329
|
+
| userUrlFormat | string | `{{host}}/{{user}}` | A URL representing a user's profile |
|
|
330
|
+
| releaseCommitMessageFormat | string | `chore(release): {{currentTag}}` | A string to be used to format the auto-generated release commit message |
|
|
331
|
+
| issuePrefixes | Array\<string> | `["#"]` | List of prefixes used to detect references to issues |
|
|
332
|
+
|
|
333
|
+
###### config.changelogPresetConfig.types
|
|
334
|
+
|
|
335
|
+
By default only `feat` and `fix` commits are added to your changelog, you can configure extra sections to show by modifying this section.
|
|
336
|
+
|
|
337
|
+
Checkout the `fork.config.js` file [here](./fork.config.js) to see an example of modifying the types.
|
|
338
|
+
|
|
339
|
+
| Property | Type | Description |
|
|
340
|
+
|:---------|:--------|:-------------------------------------------------------------------------|
|
|
341
|
+
| type | string | The type of commit message. "feat", "fix", "chore", etc.. |
|
|
342
|
+
| scope | string | The scope of the commit message. |
|
|
343
|
+
| section | string | The name of the section in the `CHANGELOG` the commit should show up in. |
|
|
344
|
+
| hidden | boolean | Should show in the generated changelog message? |
|
|
345
|
+
|
|
346
|
+
###### config.releaseMessageSuffix
|
|
347
|
+
|
|
348
|
+
Adds a suffix to the end of the release message, useful to add a `[skip ci]` message to the end of the created commit.
|
|
349
|
+
|
|
350
|
+
- [GitHub Actions - Skipping workflow runs](https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs)
|
|
351
|
+
- [Azure Devops - Skipping CI for individual pushes](https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/azure-repos-git?view=azure-devops&tabs=yaml#skipping-ci-for-individual-pushes)
|
|
288
352
|
|
|
289
|
-
|
|
353
|
+
### Supported File Types
|
|
290
354
|
|
|
291
355
|
- [Json Package](#json-package)
|
|
292
356
|
- [Plain Text](#plain-text)
|
|
293
357
|
- [MS Build](#ms-build)
|
|
294
358
|
|
|
295
|
-
|
|
359
|
+
#### Json Package
|
|
296
360
|
|
|
297
361
|
A json package is a json file which contains a version property, such as a npm package.json file.
|
|
298
362
|
|
|
@@ -304,7 +368,7 @@ A json package is a json file which contains a version property, such as a npm p
|
|
|
304
368
|
}
|
|
305
369
|
```
|
|
306
370
|
|
|
307
|
-
|
|
371
|
+
#### Plain Text
|
|
308
372
|
|
|
309
373
|
A plain text file will have just the version as the content.
|
|
310
374
|
|
|
@@ -312,7 +376,7 @@ A plain text file will have just the version as the content.
|
|
|
312
376
|
1.2.3
|
|
313
377
|
```
|
|
314
378
|
|
|
315
|
-
|
|
379
|
+
#### MS Build
|
|
316
380
|
|
|
317
381
|
A MS build project is an xml file with with a `Version` property under the `Project > PropertyGroup` node group.
|
|
318
382
|
|
|
@@ -324,7 +388,7 @@ A MS build project is an xml file with with a `Version` property under the `Proj
|
|
|
324
388
|
</Project>
|
|
325
389
|
```
|
|
326
390
|
|
|
327
|
-
|
|
391
|
+
Fork-Version currently supports reading and updating the following file extensions: `.csproj` `.dbproj` `.esproj` `.fsproj` `.props` `.vbproj` `.vcxproj`
|
|
328
392
|
|
|
329
393
|
#### Custom File Updater's
|
|
330
394
|
|
|
@@ -333,6 +397,6 @@ We currently support reading and updating the following file extensions: `.cspro
|
|
|
333
397
|
### Code Usage
|
|
334
398
|
|
|
335
399
|
> [!WARNING]
|
|
336
|
-
> Code usage is not recommended
|
|
400
|
+
> Code usage is not recommended as the public api is not stable and may change between versions.
|
|
337
401
|
>
|
|
338
|
-
> In the future
|
|
402
|
+
> In the future the api may be stabilized and documented but this is not a focus at this time.
|
|
@@ -11,7 +11,6 @@ import semver3 from 'semver';
|
|
|
11
11
|
import conventionalRecommendedBump from 'conventional-recommended-bump';
|
|
12
12
|
import gitSemverTags from 'git-semver-tags';
|
|
13
13
|
import conventionalChangelog from 'conventional-changelog';
|
|
14
|
-
import { execFile } from 'child_process';
|
|
15
14
|
import detectIndent from 'detect-indent';
|
|
16
15
|
import { detectNewline } from 'detect-newline';
|
|
17
16
|
import * as cheerio from 'cheerio/lib/slim';
|
|
@@ -23,6 +22,10 @@ var ChangelogPresetConfigTypeSchema = z.object({
|
|
|
23
22
|
* @example "feat", "fix", "chore", etc..
|
|
24
23
|
*/
|
|
25
24
|
type: z.string().describe('The type of commit message, such as "feat", "fix", "chore".'),
|
|
25
|
+
/**
|
|
26
|
+
* The scope of the commit message.
|
|
27
|
+
*/
|
|
28
|
+
scope: z.string().optional().describe("The scope of the commit message."),
|
|
26
29
|
/**
|
|
27
30
|
* The section of the `CHANGELOG` the commit should show up in.
|
|
28
31
|
*/
|
|
@@ -209,12 +212,39 @@ var ForkConfigSchema = z.object({
|
|
|
209
212
|
* @default false
|
|
210
213
|
*/
|
|
211
214
|
verify: z.boolean().describe("If true, git will run user defined git hooks before committing."),
|
|
215
|
+
// Skip Steps
|
|
216
|
+
//
|
|
217
|
+
/**
|
|
218
|
+
* Skip the bump step.
|
|
219
|
+
* @default false
|
|
220
|
+
*/
|
|
221
|
+
skipBump: z.boolean().describe("Skip the bump step."),
|
|
222
|
+
/**
|
|
223
|
+
* Skip the changelog step.
|
|
224
|
+
* @default false
|
|
225
|
+
*/
|
|
226
|
+
skipChangelog: z.boolean().describe("Skip the changelog step."),
|
|
227
|
+
/**
|
|
228
|
+
* Skip the commit step.
|
|
229
|
+
* @default false
|
|
230
|
+
*/
|
|
231
|
+
skipCommit: z.boolean().describe("Skip the commit step."),
|
|
232
|
+
/**
|
|
233
|
+
* Skip the tag step.
|
|
234
|
+
* @default false
|
|
235
|
+
*/
|
|
236
|
+
skipTag: z.boolean().describe("Skip the tag step."),
|
|
212
237
|
/**
|
|
213
238
|
* Override the default "conventional-changelog-conventionalcommits" preset configuration.
|
|
214
239
|
*/
|
|
215
240
|
changelogPresetConfig: ChangelogPresetConfigSchema.partial().describe(
|
|
216
241
|
'Override the default "conventional-changelog-conventionalcommits" preset configuration.'
|
|
217
|
-
)
|
|
242
|
+
),
|
|
243
|
+
/**
|
|
244
|
+
* Add a suffix to the release commit message.
|
|
245
|
+
* @example "[skip ci]"
|
|
246
|
+
*/
|
|
247
|
+
releaseMessageSuffix: z.string().optional().describe("Add a suffix to the release commit message.")
|
|
218
248
|
});
|
|
219
249
|
function defineConfig(config) {
|
|
220
250
|
return config;
|
|
@@ -248,6 +278,11 @@ All notable changes to this project will be documented in this file. See [fork-v
|
|
|
248
278
|
gitTagFallback: true,
|
|
249
279
|
sign: false,
|
|
250
280
|
verify: false,
|
|
281
|
+
// Skip Steps
|
|
282
|
+
skipBump: false,
|
|
283
|
+
skipChangelog: false,
|
|
284
|
+
skipCommit: false,
|
|
285
|
+
skipTag: false,
|
|
251
286
|
changelogPresetConfig: {}
|
|
252
287
|
};
|
|
253
288
|
var helperText = `Usage:
|
|
@@ -279,7 +314,34 @@ Flags:
|
|
|
279
314
|
--sign If true, git will sign the commit with the systems GPG key.
|
|
280
315
|
--verify If true, git will run user defined git hooks before committing.
|
|
281
316
|
|
|
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
|
|
317
|
+
To negate a flag you can prefix it with "no-", for example "--no-git-tag-fallback" will not fallback to the latest git tag.
|
|
318
|
+
|
|
319
|
+
Skip Steps:
|
|
320
|
+
--skip-bump Skip the version bump step.
|
|
321
|
+
--skip-changelog Skip updating the changelog.
|
|
322
|
+
--skip-commit Skip committing the changes.
|
|
323
|
+
--skip-tag Skip tagging the commit.
|
|
324
|
+
|
|
325
|
+
Conventional Changelog Overrides:
|
|
326
|
+
--commit-url-format Override the default commit URL format.
|
|
327
|
+
--compare-url-format Override the default compare URL format.
|
|
328
|
+
--issue-url-format Override the default issue URL format.
|
|
329
|
+
--user-url-format Override the default user URL format.
|
|
330
|
+
--release-commit-message-format Override the default release commit message format.
|
|
331
|
+
--release-message-suffix Add a suffix to the end of the release message.
|
|
332
|
+
|
|
333
|
+
Examples:
|
|
334
|
+
$ fork-version
|
|
335
|
+
Run fork-version in the current directory with default options.
|
|
336
|
+
|
|
337
|
+
$ fork-version --path ./packages/my-package
|
|
338
|
+
Run fork-version in the "./packages/my-package" directory.
|
|
339
|
+
|
|
340
|
+
$ fork-version --file package.json --file MyApi.csproj
|
|
341
|
+
Run fork-version and update the "package.json" and "MyApi.csproj" files.
|
|
342
|
+
|
|
343
|
+
$ fork-version --glob "*/package.json"
|
|
344
|
+
Run fork-version and update all "package.json" files in subdirectories.`;
|
|
283
345
|
function getCliArguments() {
|
|
284
346
|
return meow(helperText, {
|
|
285
347
|
importMeta: import.meta,
|
|
@@ -306,11 +368,23 @@ function getCliArguments() {
|
|
|
306
368
|
silent: { type: "boolean" },
|
|
307
369
|
gitTagFallback: { type: "boolean" },
|
|
308
370
|
sign: { type: "boolean" },
|
|
309
|
-
verify: { type: "boolean" }
|
|
371
|
+
verify: { type: "boolean" },
|
|
372
|
+
// Skip Steps
|
|
373
|
+
skipBump: { type: "boolean" },
|
|
374
|
+
skipChangelog: { type: "boolean" },
|
|
375
|
+
skipCommit: { type: "boolean" },
|
|
376
|
+
skipTag: { type: "boolean" },
|
|
377
|
+
// Changelog Overrides
|
|
378
|
+
commitUrlFormat: { type: "string" },
|
|
379
|
+
compareUrlFormat: { type: "string" },
|
|
380
|
+
issueUrlFormat: { type: "string" },
|
|
381
|
+
userUrlFormat: { type: "string" },
|
|
382
|
+
releaseCommitMessageFormat: { type: "string" },
|
|
383
|
+
releaseMessageSuffix: { type: "string" }
|
|
310
384
|
}
|
|
311
385
|
});
|
|
312
386
|
}
|
|
313
|
-
function getChangelogPresetConfig(
|
|
387
|
+
function getChangelogPresetConfig(mergedConfig, cliArgumentsFlags) {
|
|
314
388
|
const preset = {
|
|
315
389
|
name: "conventionalcommits"
|
|
316
390
|
};
|
|
@@ -321,13 +395,34 @@ function getChangelogPresetConfig(usersChangelogPresetConfig) {
|
|
|
321
395
|
}
|
|
322
396
|
});
|
|
323
397
|
}
|
|
324
|
-
if (
|
|
325
|
-
Object.entries(
|
|
398
|
+
if (mergedConfig?.changelogPresetConfig && typeof mergedConfig.changelogPresetConfig === "object") {
|
|
399
|
+
Object.entries(mergedConfig.changelogPresetConfig).forEach(([key, value]) => {
|
|
326
400
|
if (value !== void 0) {
|
|
327
401
|
preset[key] = value;
|
|
328
402
|
}
|
|
329
403
|
});
|
|
330
404
|
}
|
|
405
|
+
if (mergedConfig?.releaseMessageSuffix && !cliArgumentsFlags?.releaseMessageSuffix) {
|
|
406
|
+
preset.releaseCommitMessageFormat = `${preset.releaseCommitMessageFormat} ${mergedConfig.releaseMessageSuffix}`;
|
|
407
|
+
}
|
|
408
|
+
if (cliArgumentsFlags?.commitUrlFormat) {
|
|
409
|
+
preset.commitUrlFormat = cliArgumentsFlags.commitUrlFormat;
|
|
410
|
+
}
|
|
411
|
+
if (cliArgumentsFlags?.compareUrlFormat) {
|
|
412
|
+
preset.compareUrlFormat = cliArgumentsFlags.compareUrlFormat;
|
|
413
|
+
}
|
|
414
|
+
if (cliArgumentsFlags?.issueUrlFormat) {
|
|
415
|
+
preset.issueUrlFormat = cliArgumentsFlags.issueUrlFormat;
|
|
416
|
+
}
|
|
417
|
+
if (cliArgumentsFlags?.userUrlFormat) {
|
|
418
|
+
preset.userUrlFormat = cliArgumentsFlags.userUrlFormat;
|
|
419
|
+
}
|
|
420
|
+
if (cliArgumentsFlags?.releaseCommitMessageFormat) {
|
|
421
|
+
preset.releaseCommitMessageFormat = cliArgumentsFlags.releaseCommitMessageFormat;
|
|
422
|
+
}
|
|
423
|
+
if (cliArgumentsFlags?.releaseMessageSuffix) {
|
|
424
|
+
preset.releaseCommitMessageFormat = `${preset.releaseCommitMessageFormat} ${cliArgumentsFlags.releaseMessageSuffix}`;
|
|
425
|
+
}
|
|
331
426
|
return ChangelogPresetConfigSchema.passthrough().parse(preset);
|
|
332
427
|
}
|
|
333
428
|
|
|
@@ -374,7 +469,7 @@ async function getUserConfig() {
|
|
|
374
469
|
// Meow doesn't support multiple flags with the same name, so we need to check both.
|
|
375
470
|
cliArguments.flags.preReleaseTag ?? cliArguments.flags.preRelease ?? configFile.preRelease
|
|
376
471
|
),
|
|
377
|
-
changelogPresetConfig: getChangelogPresetConfig(mergedConfig
|
|
472
|
+
changelogPresetConfig: getChangelogPresetConfig(mergedConfig, cliArguments.flags)
|
|
378
473
|
};
|
|
379
474
|
}
|
|
380
475
|
async function loadConfigFile(configFilePath) {
|
|
@@ -507,6 +602,12 @@ async function getCurrentVersion(config, logger, fileManager) {
|
|
|
507
602
|
};
|
|
508
603
|
}
|
|
509
604
|
async function getNextVersion(config, logger, currentVersion) {
|
|
605
|
+
if (config.skipBump) {
|
|
606
|
+
logger.log("Skip bump, using current version as next version");
|
|
607
|
+
return {
|
|
608
|
+
version: currentVersion
|
|
609
|
+
};
|
|
610
|
+
}
|
|
510
611
|
if (config.nextVersion && semver3.valid(config.nextVersion)) {
|
|
511
612
|
logger.log(`Next version: ${config.nextVersion}`);
|
|
512
613
|
return {
|
|
@@ -601,6 +702,10 @@ function getNewReleaseContent(config, logger, nextVersion) {
|
|
|
601
702
|
});
|
|
602
703
|
}
|
|
603
704
|
async function updateChangelog(config, logger, nextVersion) {
|
|
705
|
+
if (config.skipChangelog) {
|
|
706
|
+
logger.log("Skip changelog update");
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
604
709
|
if (config.header.search(RELEASE_PATTERN) !== -1) {
|
|
605
710
|
throw new Error("Header cannot contain release pattern");
|
|
606
711
|
}
|
|
@@ -622,62 +727,7 @@ ${oldContent}
|
|
|
622
727
|
"utf8"
|
|
623
728
|
);
|
|
624
729
|
}
|
|
625
|
-
return {
|
|
626
|
-
changelogPath,
|
|
627
|
-
oldContent,
|
|
628
|
-
newContent
|
|
629
|
-
};
|
|
630
730
|
}
|
|
631
|
-
var Git = class {
|
|
632
|
-
constructor(config, logger) {
|
|
633
|
-
this.config = config;
|
|
634
|
-
this.logger = logger;
|
|
635
|
-
this.add = this.add.bind(this);
|
|
636
|
-
this.commit = this.commit.bind(this);
|
|
637
|
-
this.tag = this.tag.bind(this);
|
|
638
|
-
this.currentBranch = this.currentBranch.bind(this);
|
|
639
|
-
}
|
|
640
|
-
add(...args) {
|
|
641
|
-
if (this.config.dryRun) {
|
|
642
|
-
return Promise.resolve("");
|
|
643
|
-
}
|
|
644
|
-
return this.execGit("add", args.filter(Boolean));
|
|
645
|
-
}
|
|
646
|
-
commit(...args) {
|
|
647
|
-
if (this.config.dryRun) {
|
|
648
|
-
return Promise.resolve("");
|
|
649
|
-
}
|
|
650
|
-
return this.execGit("commit", args.filter(Boolean));
|
|
651
|
-
}
|
|
652
|
-
tag(...args) {
|
|
653
|
-
if (this.config.dryRun) {
|
|
654
|
-
return Promise.resolve("");
|
|
655
|
-
}
|
|
656
|
-
return this.execGit("tag", args.filter(Boolean));
|
|
657
|
-
}
|
|
658
|
-
async currentBranch() {
|
|
659
|
-
return (await this.execGit("rev-parse", ["--abbrev-ref", "HEAD"])).trim();
|
|
660
|
-
}
|
|
661
|
-
execGit(command, args) {
|
|
662
|
-
this.logger.debug(`[git ${command}] ${args.join(" ")}`);
|
|
663
|
-
return new Promise((onResolve, onReject) => {
|
|
664
|
-
execFile(
|
|
665
|
-
"git",
|
|
666
|
-
[command, ...args],
|
|
667
|
-
{
|
|
668
|
-
cwd: this.config.path
|
|
669
|
-
},
|
|
670
|
-
(error, stdout, stderr) => {
|
|
671
|
-
if (error) {
|
|
672
|
-
this.logger.error(`[git ${command}] `);
|
|
673
|
-
onReject(error);
|
|
674
|
-
}
|
|
675
|
-
onResolve(stdout ? stdout : stderr);
|
|
676
|
-
}
|
|
677
|
-
);
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
};
|
|
681
731
|
|
|
682
732
|
// src/utils/format-commit-message.ts
|
|
683
733
|
function formatCommitMessage(message, version) {
|
|
@@ -688,8 +738,11 @@ function formatCommitMessage(message, version) {
|
|
|
688
738
|
}
|
|
689
739
|
|
|
690
740
|
// src/process/commit.ts
|
|
691
|
-
async function commitChanges(config, logger, files, nextVersion) {
|
|
692
|
-
|
|
741
|
+
async function commitChanges(config, logger, git, files, nextVersion) {
|
|
742
|
+
if (config.skipCommit) {
|
|
743
|
+
logger.log("Skip commit");
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
693
746
|
logger.log("Committing changes");
|
|
694
747
|
const filesToCommit = [];
|
|
695
748
|
if (fileExists(resolve(config.path, config.changelog))) {
|
|
@@ -699,51 +752,37 @@ async function commitChanges(config, logger, files, nextVersion) {
|
|
|
699
752
|
filesToCommit.push(file.path);
|
|
700
753
|
}
|
|
701
754
|
if (filesToCommit.length === 0) {
|
|
702
|
-
return
|
|
703
|
-
filesToCommit
|
|
704
|
-
};
|
|
755
|
+
return;
|
|
705
756
|
}
|
|
706
|
-
const shouldVerify = config.verify ? void 0 : "--no-verify";
|
|
707
|
-
const shouldSign = config.sign ? "--gpg-sign" : void 0;
|
|
708
757
|
if (config.commitAll) {
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
gitCommitOutput: await git.commit(
|
|
713
|
-
shouldVerify,
|
|
714
|
-
shouldSign,
|
|
715
|
-
"--message",
|
|
716
|
-
formatCommitMessage(config.changelogPresetConfig?.releaseCommitMessageFormat, nextVersion)
|
|
717
|
-
)
|
|
718
|
-
};
|
|
758
|
+
await git.add("--all");
|
|
759
|
+
} else {
|
|
760
|
+
await git.add(...filesToCommit);
|
|
719
761
|
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
formatCommitMessage(config.changelogPresetConfig?.releaseCommitMessageFormat, nextVersion)
|
|
729
|
-
)
|
|
730
|
-
};
|
|
762
|
+
const shouldVerify = config.verify ? void 0 : "--no-verify";
|
|
763
|
+
const shouldSign = config.sign ? "--gpg-sign" : void 0;
|
|
764
|
+
await git.commit(
|
|
765
|
+
shouldVerify,
|
|
766
|
+
shouldSign,
|
|
767
|
+
"--message",
|
|
768
|
+
formatCommitMessage(config.changelogPresetConfig?.releaseCommitMessageFormat, nextVersion)
|
|
769
|
+
);
|
|
731
770
|
}
|
|
732
771
|
|
|
733
772
|
// src/process/tag.ts
|
|
734
|
-
async function tagChanges(config, logger, nextVersion) {
|
|
735
|
-
|
|
773
|
+
async function tagChanges(config, logger, git, nextVersion) {
|
|
774
|
+
if (config.skipTag) {
|
|
775
|
+
logger.log("Skip tag creation");
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
736
778
|
const tag = `${config.tagPrefix}${nextVersion}`;
|
|
737
779
|
logger.log(`Creating Tag: ${tag}`);
|
|
738
|
-
|
|
780
|
+
await git.tag(
|
|
739
781
|
config.sign ? "--sign" : "--annotate",
|
|
740
782
|
tag,
|
|
741
783
|
"--message",
|
|
742
784
|
formatCommitMessage(config.changelogPresetConfig?.releaseCommitMessageFormat, nextVersion)
|
|
743
785
|
);
|
|
744
|
-
return {
|
|
745
|
-
gitTagOutput
|
|
746
|
-
};
|
|
747
786
|
}
|
|
748
787
|
|
|
749
788
|
// src/libs/stringify-package.ts
|
|
@@ -923,6 +962,39 @@ var FileManager = class {
|
|
|
923
962
|
}
|
|
924
963
|
};
|
|
925
964
|
|
|
926
|
-
|
|
965
|
+
// src/utils/logger.ts
|
|
966
|
+
var Logger = class {
|
|
967
|
+
constructor(config) {
|
|
968
|
+
this.config = config;
|
|
969
|
+
this.log = this.log.bind(this);
|
|
970
|
+
this.warn = this.warn.bind(this);
|
|
971
|
+
this.error = this.error.bind(this);
|
|
972
|
+
this.debug = this.debug.bind(this);
|
|
973
|
+
this.disableLogs = this.config.silent || this.config.inspectVersion;
|
|
974
|
+
}
|
|
975
|
+
disableLogs = false;
|
|
976
|
+
log(...messages) {
|
|
977
|
+
if (!this.disableLogs) {
|
|
978
|
+
console.log(...messages);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
warn(...messages) {
|
|
982
|
+
if (!this.disableLogs) {
|
|
983
|
+
console.warn(...messages);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
error(...messages) {
|
|
987
|
+
if (!this.disableLogs) {
|
|
988
|
+
console.error(...messages);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
debug(...messages) {
|
|
992
|
+
if (this.config.debug && !this.disableLogs) {
|
|
993
|
+
console.debug(...messages);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
export { FileManager, ForkConfigSchema, Logger, commitChanges, defineConfig, getCurrentVersion, getNextVersion, getUserConfig, tagChanges, updateChangelog };
|
|
927
999
|
//# sourceMappingURL=out.js.map
|
|
928
|
-
//# sourceMappingURL=chunk-
|
|
1000
|
+
//# sourceMappingURL=chunk-3GJOT3DD.js.map
|