fork-version 1.5.0 → 1.7.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 +16 -0
- package/README.md +18 -1
- package/dist/{chunk-6F6V3HWV.js → chunk-D7324DNL.js} +96 -30
- package/dist/chunk-D7324DNL.js.map +1 -0
- package/dist/{chunk-SAIF32GN.cjs → chunk-U3KD6MC3.cjs} +97 -32
- package/dist/chunk-U3KD6MC3.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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-6F6V3HWV.js.map +0 -1
- package/dist/chunk-SAIF32GN.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Fork Version
|
|
2
2
|
|
|
3
|
+
## 1.7.0 (2024-10-31)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add yaml support ([#76](https://github.com/eglavin/fork-version/issues/76)) ([2a0d89e](https://github.com/eglavin/fork-version/commit/2a0d89e6174ef098ec7fc697ff05e24572b4a84c))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## 1.6.0 (2024-10-27)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* support deno.jsonc, jsr.jsonc ([#74](https://github.com/eglavin/fork-version/issues/74)) ([7506497](https://github.com/eglavin/fork-version/commit/7506497c7f49a4dd9b35f6787ce59a8d22592d3d))
|
|
17
|
+
|
|
18
|
+
|
|
3
19
|
## 1.5.0 (2024-10-20)
|
|
4
20
|
|
|
5
21
|
|
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ Commands:
|
|
|
90
90
|
--inspect-version If set, Fork-Version will print the current project version and exit.
|
|
91
91
|
|
|
92
92
|
Options:
|
|
93
|
-
--file, -F List of the files to be updated. [Default: ["bower.json", "deno.json", "jsr.json", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]]
|
|
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
94
|
--glob, -G Glob pattern to match files to be updated.
|
|
95
95
|
--path, -P The path Fork-Version will run from. [Default: process.cwd()]
|
|
96
96
|
--changelog Name of the changelog file. [Default: "CHANGELOG.md"]
|
|
@@ -270,7 +270,9 @@ By default Fork-Version will attempt to read versions from and update these file
|
|
|
270
270
|
- "package-lock.json"
|
|
271
271
|
- "npm-shrinkwrap.json"
|
|
272
272
|
- "jsr.json"
|
|
273
|
+
- "jsr.jsonc"
|
|
273
274
|
- "deno.json"
|
|
275
|
+
- "deno.jsonc"
|
|
274
276
|
- "manifest.json"
|
|
275
277
|
- "bower.json"
|
|
276
278
|
|
|
@@ -372,6 +374,7 @@ Adds a suffix to the end of the release message, useful to add a `[skip ci]` mes
|
|
|
372
374
|
### Supported File Types
|
|
373
375
|
|
|
374
376
|
- [Json Package](#json-package)
|
|
377
|
+
- [Yaml Package](#yaml-package)
|
|
375
378
|
- [Plain Text](#plain-text)
|
|
376
379
|
- [MS Build](#ms-build)
|
|
377
380
|
|
|
@@ -387,6 +390,20 @@ A json package is a json file which contains a version property, such as a npm p
|
|
|
387
390
|
}
|
|
388
391
|
```
|
|
389
392
|
|
|
393
|
+
#### Yaml Package
|
|
394
|
+
|
|
395
|
+
A yaml package is a yaml file which contains a version property, such as a dart pubspec.yaml file.
|
|
396
|
+
|
|
397
|
+
```yaml
|
|
398
|
+
name: wordionary
|
|
399
|
+
description: "My project"
|
|
400
|
+
publish_to: 'none'
|
|
401
|
+
version: 1.2.3
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
> [!NOTE]
|
|
405
|
+
> If you're using Fork-Version for a flutter project, Fork-Version will split the version and the builder number on the "+" character, the version will be updated and the builder number will be left as is.
|
|
406
|
+
|
|
390
407
|
#### Plain Text
|
|
391
408
|
|
|
392
409
|
A plain text file will have just the version as the content.
|
|
@@ -7,9 +7,9 @@ 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';
|
|
12
|
+
import { parse as parse$2, parseDocument } from 'yaml';
|
|
13
13
|
import * as cheerio from 'cheerio/slim';
|
|
14
14
|
import semver3 from 'semver';
|
|
15
15
|
import conventionalRecommendedBump from 'conventional-recommended-bump';
|
|
@@ -88,7 +88,7 @@ var ForkConfigSchema = z.object({
|
|
|
88
88
|
* List of the files to be updated.
|
|
89
89
|
* @default
|
|
90
90
|
* ```js
|
|
91
|
-
* ["bower.json", "deno.json", "jsr.json", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]
|
|
91
|
+
* ["bower.json", "deno.json", "deno.jsonc", "jsr.json", "jsr.jsonc", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
94
|
files: z.array(z.string()).describe("List of the files to be updated."),
|
|
@@ -280,7 +280,9 @@ var DEFAULT_CONFIG = {
|
|
|
280
280
|
"package-lock.json",
|
|
281
281
|
"npm-shrinkwrap.json",
|
|
282
282
|
"jsr.json",
|
|
283
|
+
"jsr.jsonc",
|
|
283
284
|
"deno.json",
|
|
285
|
+
"deno.jsonc",
|
|
284
286
|
"manifest.json",
|
|
285
287
|
// Chrome extensions
|
|
286
288
|
"bower.json"
|
|
@@ -318,7 +320,7 @@ Commands:
|
|
|
318
320
|
--inspect-version If set, Fork-Version will print the current project version and exit.
|
|
319
321
|
|
|
320
322
|
Options:
|
|
321
|
-
--file, -F List of the files to be updated. [Default: ["bower.json", "deno.json", "jsr.json", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]]
|
|
323
|
+
--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"]]
|
|
322
324
|
--glob, -G Glob pattern to match files to be updated.
|
|
323
325
|
--path, -P The path Fork-Version will run from. [Default: process.cwd()]
|
|
324
326
|
--changelog Name of the changelog file. [Default: "CHANGELOG.md"]
|
|
@@ -638,18 +640,6 @@ var Logger = class {
|
|
|
638
640
|
}
|
|
639
641
|
}
|
|
640
642
|
};
|
|
641
|
-
|
|
642
|
-
// src/libs/stringify-package.ts
|
|
643
|
-
var DEFAULT_INDENT = 2;
|
|
644
|
-
var CRLF = "\r\n";
|
|
645
|
-
var LF = "\n";
|
|
646
|
-
function stringifyPackage(data, indent, newline) {
|
|
647
|
-
const stringified = JSON.stringify(data, null, indent ?? DEFAULT_INDENT);
|
|
648
|
-
if (newline === CRLF) {
|
|
649
|
-
return stringified.replace(new RegExp(LF, "g"), CRLF);
|
|
650
|
-
}
|
|
651
|
-
return stringified;
|
|
652
|
-
}
|
|
653
643
|
function fileExists(filePath) {
|
|
654
644
|
try {
|
|
655
645
|
return lstatSync(filePath).isFile();
|
|
@@ -659,6 +649,11 @@ function fileExists(filePath) {
|
|
|
659
649
|
}
|
|
660
650
|
|
|
661
651
|
// src/strategies/json-package.ts
|
|
652
|
+
var PARSE_OPTIONS = {
|
|
653
|
+
allowTrailingComma: true,
|
|
654
|
+
allowEmptyContent: false,
|
|
655
|
+
disallowComments: false
|
|
656
|
+
};
|
|
662
657
|
var JSONPackage = class {
|
|
663
658
|
constructor(config, logger) {
|
|
664
659
|
this.config = config;
|
|
@@ -668,8 +663,13 @@ var JSONPackage = class {
|
|
|
668
663
|
const filePath = resolve(this.config.path, fileName);
|
|
669
664
|
if (fileExists(filePath)) {
|
|
670
665
|
const fileContents = readFileSync(filePath, "utf8");
|
|
671
|
-
const
|
|
672
|
-
|
|
666
|
+
const parseErrors = [];
|
|
667
|
+
const parsedJson = parse$1(fileContents, parseErrors, PARSE_OPTIONS);
|
|
668
|
+
if (parseErrors.length) {
|
|
669
|
+
this.logger.warn(`[File Manager] Unable to parse JSON: ${fileName}`, parseErrors);
|
|
670
|
+
return void 0;
|
|
671
|
+
}
|
|
672
|
+
if (parsedJson?.version) {
|
|
673
673
|
return {
|
|
674
674
|
name: fileName,
|
|
675
675
|
path: filePath,
|
|
@@ -680,21 +680,79 @@ var JSONPackage = class {
|
|
|
680
680
|
this.logger.warn(`[File Manager] Unable to determine json package: ${fileName}`);
|
|
681
681
|
}
|
|
682
682
|
}
|
|
683
|
+
write(fileState, newVersion) {
|
|
684
|
+
let fileContents = readFileSync(fileState.path, "utf8");
|
|
685
|
+
const parseErrors = [];
|
|
686
|
+
const parsedJson = parse$1(fileContents, parseErrors, PARSE_OPTIONS);
|
|
687
|
+
if (parseErrors.length) {
|
|
688
|
+
this.logger.warn(`[File Manager] Unable to parse JSON: ${fileState.path}`, parseErrors);
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
fileContents = setStringInJsonc(fileContents, ["version"], newVersion);
|
|
692
|
+
if (parsedJson?.packages?.[""]) {
|
|
693
|
+
fileContents = setStringInJsonc(fileContents, ["packages", "", "version"], newVersion);
|
|
694
|
+
}
|
|
695
|
+
writeFileSync(fileState.path, fileContents, "utf8");
|
|
696
|
+
}
|
|
697
|
+
isSupportedFile(fileName) {
|
|
698
|
+
return fileName.endsWith(".json") || fileName.endsWith(".jsonc");
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
function setStringInJsonc(jsonc, jsonPath, newString) {
|
|
702
|
+
const edits = modify(jsonc, jsonPath, newString, {});
|
|
703
|
+
return applyEdits(jsonc, edits);
|
|
704
|
+
}
|
|
705
|
+
var YAMLPackage = class {
|
|
706
|
+
constructor(config, logger) {
|
|
707
|
+
this.config = config;
|
|
708
|
+
this.logger = logger;
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* If the version is returned with a "+" symbol in the value then the version might be from a
|
|
712
|
+
* flutter `pubspec.yaml` file, if so we want to retain the input builderNumber by splitting it
|
|
713
|
+
* and joining it again later.
|
|
714
|
+
*/
|
|
715
|
+
handleBuildNumber(fileVersion) {
|
|
716
|
+
const [version, builderNumber] = fileVersion.split("+");
|
|
717
|
+
if (/^\d+$/.test(builderNumber)) {
|
|
718
|
+
return {
|
|
719
|
+
version,
|
|
720
|
+
builderNumber
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
return {
|
|
724
|
+
version: fileVersion
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
read(fileName) {
|
|
728
|
+
const filePath = resolve(this.config.path, fileName);
|
|
729
|
+
if (fileExists(filePath)) {
|
|
730
|
+
const fileContents = readFileSync(filePath, "utf-8");
|
|
731
|
+
const fileVersion = parse$2(fileContents)?.version;
|
|
732
|
+
if (fileVersion) {
|
|
733
|
+
const parsedVersion = this.handleBuildNumber(fileVersion);
|
|
734
|
+
return {
|
|
735
|
+
name: fileName,
|
|
736
|
+
path: filePath,
|
|
737
|
+
version: parsedVersion.version || "",
|
|
738
|
+
builderNumber: parsedVersion.builderNumber ?? void 0
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
this.logger.warn(`[File Manager] Unable to determine PubSpec file: ${fileName}`);
|
|
743
|
+
}
|
|
683
744
|
write(fileState, newVersion) {
|
|
684
745
|
const fileContents = readFileSync(fileState.path, "utf8");
|
|
685
|
-
const
|
|
686
|
-
|
|
687
|
-
if (
|
|
688
|
-
|
|
746
|
+
const yamlDocument = parseDocument(fileContents);
|
|
747
|
+
let newFileVersion = newVersion;
|
|
748
|
+
if (fileState.builderNumber !== void 0) {
|
|
749
|
+
newFileVersion += `+${fileState.builderNumber}`;
|
|
689
750
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
stringifyPackage(parsedJson, detectIndent(fileContents).indent, detectNewline(fileContents)),
|
|
693
|
-
"utf8"
|
|
694
|
-
);
|
|
751
|
+
yamlDocument.set("version", newFileVersion);
|
|
752
|
+
writeFileSync(fileState.path, yamlDocument.toString(), "utf8");
|
|
695
753
|
}
|
|
696
754
|
isSupportedFile(fileName) {
|
|
697
|
-
return fileName.endsWith(".
|
|
755
|
+
return fileName.endsWith(".yaml") || fileName.endsWith(".yml");
|
|
698
756
|
}
|
|
699
757
|
};
|
|
700
758
|
var PlainText = class {
|
|
@@ -768,10 +826,12 @@ var FileManager = class {
|
|
|
768
826
|
this.config = config;
|
|
769
827
|
this.logger = logger;
|
|
770
828
|
this.JSONPackage = new JSONPackage(config, logger);
|
|
829
|
+
this.YAMLPackage = new YAMLPackage(config, logger);
|
|
771
830
|
this.PlainText = new PlainText(config, logger);
|
|
772
831
|
this.MSBuildProject = new MSBuildProject(config, logger);
|
|
773
832
|
}
|
|
774
833
|
JSONPackage;
|
|
834
|
+
YAMLPackage;
|
|
775
835
|
PlainText;
|
|
776
836
|
MSBuildProject;
|
|
777
837
|
/**
|
|
@@ -792,6 +852,9 @@ var FileManager = class {
|
|
|
792
852
|
if (this.JSONPackage.isSupportedFile(_fileName)) {
|
|
793
853
|
return this.JSONPackage.read(fileName);
|
|
794
854
|
}
|
|
855
|
+
if (this.YAMLPackage.isSupportedFile(_fileName)) {
|
|
856
|
+
return this.YAMLPackage.read(fileName);
|
|
857
|
+
}
|
|
795
858
|
if (this.PlainText.isSupportedFile(_fileName)) {
|
|
796
859
|
return this.PlainText.read(fileName);
|
|
797
860
|
}
|
|
@@ -819,6 +882,9 @@ var FileManager = class {
|
|
|
819
882
|
if (this.JSONPackage.isSupportedFile(_fileName)) {
|
|
820
883
|
return this.JSONPackage.write(fileState, newVersion);
|
|
821
884
|
}
|
|
885
|
+
if (this.YAMLPackage.isSupportedFile(_fileName)) {
|
|
886
|
+
return this.YAMLPackage.write(fileState, newVersion);
|
|
887
|
+
}
|
|
822
888
|
if (this.PlainText.isSupportedFile(_fileName)) {
|
|
823
889
|
return this.PlainText.write(fileState, newVersion);
|
|
824
890
|
}
|
|
@@ -1098,5 +1164,5 @@ async function tagChanges(config, logger, git, nextVersion) {
|
|
|
1098
1164
|
}
|
|
1099
1165
|
|
|
1100
1166
|
export { FileManager, ForkConfigSchema, Logger, commitChanges, defineConfig, getCurrentVersion, getNextVersion, getUserConfig, tagChanges, updateChangelog };
|
|
1101
|
-
//# sourceMappingURL=chunk-
|
|
1102
|
-
//# sourceMappingURL=chunk-
|
|
1167
|
+
//# sourceMappingURL=chunk-D7324DNL.js.map
|
|
1168
|
+
//# sourceMappingURL=chunk-D7324DNL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/config/schema.js","../src/config/defaults.ts","../src/config/cli-arguments.js","../src/config/changelog-preset-config.ts","../src/config/detect-git-host.ts","../src/config/user-config.ts","../src/utils/logger.ts","../src/utils/file-state.ts","../src/strategies/json-package.ts","../src/strategies/yaml-package.ts","../src/strategies/plain-text.ts","../src/strategies/ms-build-project.ts","../src/strategies/file-manager.ts","../src/utils/git-tag-version.ts","../src/utils/release-type.ts","../src/process/version.ts","../src/process/changelog.ts","../src/utils/format-commit-message.ts","../src/process/commit.ts","../src/process/tag.ts"],"names":["z","fileContent","parsed","resolve","readFileSync","parse","writeFileSync","semver"],"mappings":";;;;;;;;;;;;;;;;;;;AAEO,IAAM,+BAAA,GAAkC,EAAE,MAAO,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKvD,IAAM,EAAA,CAAA,CAAE,MAAO,EAAA,CAAE,SAAS,6DAA6D,CAAA;AAAA;AAAA;AAAA;AAAA,EAIvF,OAAO,CAAE,CAAA,MAAA,GAAS,QAAS,EAAA,CAAE,SAAS,kCAAkC,CAAA;AAAA;AAAA;AAAA;AAAA,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AAA,MAAM,GAAM,GAAA,CAAA,EAAG,MAAO,CAAA,SAAS,GAAG,WAAW,CAAA,CAAA,CAAA;AAE7C,EAAO,MAAA,CAAA,GAAA,CAAI,CAAiB,cAAA,EAAA,GAAG,CAAE,CAAA,CAAA,CAAA;AAEjC,EAAA,MAAM,GAAI,CAAA,GAAA;AAAA,IACT,MAAA,CAAO,OAAO,QAAW,GAAA,YAAA;AAAA,IACzB,GAAA;AAAA,IACA,WAAA;AAAA,IACA,mBAAoB,CAAA,MAAA,CAAO,qBAAuB,EAAA,0BAAA,EAA4B,WAAW,CAAA;AAAA,GAC1F,CAAA;AACD","file":"chunk-D7324DNL.js","sourcesContent":["import { z } from \"zod\";\n\nexport const ChangelogPresetConfigTypeSchema = z.object({\n\t/**\n\t * The type of commit message.\n\t * @example \"feat\", \"fix\", \"chore\", etc..\n\t */\n\ttype: z.string().describe('The type of commit message, such as \"feat\", \"fix\", \"chore\".'),\n\t/**\n\t * The scope of the commit message.\n\t */\n\tscope: z.string().optional().describe(\"The scope of the commit message.\"),\n\t/**\n\t * The section of the `CHANGELOG` the commit should show up in.\n\t */\n\tsection: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"The section of the `CHANGELOG` the commit should show up in.\"),\n\t/**\n\t * Should show in the generated changelog message?\n\t */\n\thidden: z.boolean().optional().describe(\"Should show in the generated changelog message?\"),\n});\n\nexport const ChangelogPresetConfigSchema = z.object({\n\t/**\n\t * List of explicitly supported commit message types.\n\t */\n\ttypes: z\n\t\t.array(ChangelogPresetConfigTypeSchema)\n\t\t.describe(\"List of explicitly supported commit message types.\"),\n\t/**\n\t * A URL representing a specific commit at a hash.\n\t * @default \"{{host}}/{{owner}}/{{repository}}/commit/{{hash}}\"\n\t */\n\tcommitUrlFormat: z.string().describe(\"A URL representing a specific commit at a hash.\"),\n\t/**\n\t * A URL representing the comparison between two git SHAs.\n\t * @default \"{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}\"\n\t */\n\tcompareUrlFormat: z.string().describe(\"A URL representing the comparison between two git SHAs.\"),\n\t/**\n\t * A URL representing the issue format (allowing a different URL format to be swapped in\n\t * for Gitlab, Bitbucket, etc).\n\t * @default \"{{host}}/{{owner}}/{{repository}}/issues/{{id}}\"\n\t */\n\tissueUrlFormat: z.string().describe(\"A URL representing the issue format.\"),\n\t/**\n\t * A URL representing a user's profile on GitHub, Gitlab, etc. This URL is used\n\t * for substituting @eglavin with https://github.com/eglavin in commit messages.\n\t * @default \"{{host}}/{{user}}\"\n\t */\n\tuserUrlFormat: z.string().describe(\"A URL representing a user's profile on GitHub, Gitlab, etc.\"),\n\t/**\n\t * A string to be used to format the auto-generated release commit message.\n\t * @default \"chore(release): {{currentTag}}\"\n\t */\n\treleaseCommitMessageFormat: z\n\t\t.string()\n\t\t.describe(\"A string to be used to format the auto-generated release commit message.\"),\n\t/**\n\t * List of prefixes used to detect references to issues.\n\t * @default [\"#\"]\n\t */\n\tissuePrefixes: z\n\t\t.array(z.string())\n\t\t.describe(\"List of prefixes used to detect references to issues.\"),\n});\n\nexport const ForkConfigSchema = z.object({\n\t// Commands\n\t//\n\n\t/**\n\t * If set, Fork-Version will print the current version and exit.\n\t * @default false\n\t */\n\tinspectVersion: z\n\t\t.boolean()\n\t\t.describe(\"If set, Fork-Version will print the current version and exit.\"),\n\n\t// Options\n\t//\n\n\t/**\n\t * List of the files to be updated.\n\t * @default\n\t * ```js\n\t * [\"bower.json\", \"deno.json\", \"deno.jsonc\", \"jsr.json\", \"jsr.jsonc\", \"manifest.json\", \"npm-shrinkwrap.json\", \"package-lock.json\", \"package.json\"]\n\t * ```\n\t */\n\tfiles: z.array(z.string()).describe(\"List of the files to be updated.\"),\n\t/**\n\t * Glob pattern to match files to be updated.\n\t *\n\t * Internally we're using [glob](https://github.com/isaacs/node-glob) to match files.\n\t *\n\t * Read more about the pattern syntax [here](https://github.com/isaacs/node-glob/tree/v10.3.12?tab=readme-ov-file#glob-primer).\n\t *\n\t * @default undefined\n\t * @example \"*.json\"\n\t */\n\tglob: z.string().optional().describe(\"Glob pattern to match files to be updated.\"),\n\t/**\n\t * The path Fork-Version will run from.\n\t * @default\n\t * ```js\n\t * process.cwd()\n\t * ```\n\t */\n\tpath: z.string().describe('The path Fork-Version will run from. Defaults to \"process.cwd()\".'),\n\t/**\n\t * Name of the changelog file.\n\t * @default \"CHANGELOG.md\"\n\t */\n\tchangelog: z.string().describe('Name of the changelog file. Defaults to \"CHANGELOG.md\".'),\n\t/**\n\t * The header text for the changelog.\n\t * @default\n\t * ```markdown\n\t * # Changelog\n\t *\n\t * All notable changes to this project will be documented in this file. See [fork-version](https://github.com/eglavin/fork-version) for commit guidelines.\n\t * ```\n\t */\n\theader: z.string().describe(\"The header text for the changelog.\"),\n\t/**\n\t * Specify a prefix for the created tag.\n\t *\n\t * For instance if your version tag is prefixed by \"version/\" instead of \"v\" you have to specify\n\t * `tagPrefix: \"version/\"`.\n\t *\n\t * `tagPrefix` can also be used for a monorepo environment where you might want to deploy\n\t * multiple package from the same repository. In this case you can specify a prefix for\n\t * each package:\n\t *\n\t * | Example Value | Tag Created |\n\t * |:-------------------------|:------------------------------|\n\t * | \"\" | `1.2.3` |\n\t * | \"version/\" | `version/1.2.3` |\n\t * | \"@eglavin/fork-version-\" | `@eglavin/fork-version-1.2.3` |\n\t *\n\t * @example \"\", \"version/\", \"@eglavin/fork-version-\"\n\t * @default \"v\"\n\t */\n\ttagPrefix: z.string().describe('Specify a prefix for the created tag. Defaults to \"v\".'),\n\t/**\n\t * Make a pre-release with optional label if given value is a string.\n\t *\n\t * | Example Value | Produced Version |\n\t * |:--------------|:-----------------|\n\t * | true | `1.2.3-0` |\n\t * | \"alpha\" | `1.2.3-alpha-0` |\n\t * | \"beta\" | `1.2.3-beta-0` |\n\t *\n\t * @example true, \"alpha\", \"beta\", \"rc\"\n\t * @default undefined\n\t */\n\tpreRelease: z\n\t\t.string()\n\t\t.or(z.boolean())\n\t\t.optional()\n\t\t.describe(\"Make a pre-release with optional label if given value is a string.\"),\n\t/**\n\t * If set, Fork-Version will use this version instead of trying to determine one.\n\t * @example \"1.0.0\"\n\t * @default undefined\n\t */\n\tcurrentVersion: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"If set, Fork-Version will use this version instead of trying to determine one.\"),\n\t/**\n\t * If set, Fork-Version will attempt to update to this version, instead of incrementing using \"conventional-commit\".\n\t * @example \"2.0.0\"\n\t * @default undefined\n\t */\n\tnextVersion: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\n\t\t\t'If set, Fork-Version will attempt to update to this version, instead of incrementing using \"conventional-commit\".',\n\t\t),\n\t/**\n\t * Release as increments the version by the specified level. Overrides the default behaviour of \"conventional-commit\".\n\t * @example \"major\", \"minor\", \"patch\"\n\t * @default undefined\n\t */\n\treleaseAs: z\n\t\t.union([z.literal(\"major\"), z.literal(\"minor\"), z.literal(\"patch\")])\n\t\t.optional()\n\t\t.describe(\n\t\t\t'Release as increments the version by the specified level. Overrides the default behaviour of \"conventional-commit\".',\n\t\t),\n\n\t// Flags\n\t//\n\n\t/**\n\t * Don't throw an error if multiple versions are found in the given files.\n\t * @default true\n\t */\n\tallowMultipleVersions: z\n\t\t.boolean()\n\t\t.describe(\"Don't throw an error if multiple versions are found in the given files.\"),\n\t/**\n\t * Commit all changes, not just files updated by Fork-Version.\n\t * @default false\n\t */\n\tcommitAll: z.boolean().describe(\"Commit all changes, not just files updated by Fork-Version.\"),\n\t/**\n\t * By default the conventional-changelog spec will only add commit types of `feat` and `fix` to the generated changelog.\n\t * 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)\n\t * will be added to the changelog.\n\t * @default false\n\t */\n\tchangelogAll: z\n\t\t.boolean()\n\t\t.describe(\n\t\t\t\"If this flag is set, all default commit types will be added to the changelog, not just `feat` and `fix`.\",\n\t\t),\n\t/**\n\t * Output debug information.\n\t * @default false\n\t */\n\tdebug: z.boolean().describe(\"Output debug information.\"),\n\t/**\n\t * No output will be written to disk or committed.\n\t * @default false\n\t */\n\tdryRun: z.boolean().describe(\"No output will be written to disk or committed.\"),\n\t/**\n\t * Run without logging to the terminal.\n\t * @default false\n\t */\n\tsilent: z.boolean().describe(\"Run without logging to the terminal.\"),\n\t/**\n\t * If unable to find a version in the given files, fallback and attempt to use the latest git tag.\n\t * @default true\n\t */\n\tgitTagFallback: z\n\t\t.boolean()\n\t\t.describe(\n\t\t\t\"If unable to find a version in the given files, fallback and attempt to use the latest git tag. Defaults to true.\",\n\t\t),\n\t/**\n\t * If true, git will sign the commit with the systems GPG key.\n\t * @see {@link https://git-scm.com/docs/git-commit#Documentation/git-commit.txt--Sltkeyidgt Git - GPG Sign Commits}\n\t * @default false\n\t */\n\tsign: z.boolean().describe(\"If true, git will sign the commit with the systems GPG key.\"),\n\t/**\n\t * If true, git will run user defined git hooks before committing.\n\t * @default false\n\t */\n\tverify: z.boolean().describe(\"If true, git will run user defined git hooks before committing.\"),\n\n\t// Skip Steps\n\t//\n\n\t/**\n\t * Skip the bump step.\n\t * @default false\n\t */\n\tskipBump: z.boolean().describe(\"Skip the bump step.\"),\n\t/**\n\t * Skip the changelog step.\n\t * @default false\n\t */\n\tskipChangelog: z.boolean().describe(\"Skip the changelog step.\"),\n\t/**\n\t * Skip the commit step.\n\t * @default false\n\t */\n\tskipCommit: z.boolean().describe(\"Skip the commit step.\"),\n\t/**\n\t * Skip the tag step.\n\t * @default false\n\t */\n\tskipTag: z.boolean().describe(\"Skip the tag step.\"),\n\n\t/**\n\t * Override the default \"conventional-changelog-conventionalcommits\" preset configuration.\n\t */\n\tchangelogPresetConfig: ChangelogPresetConfigSchema.partial().describe(\n\t\t'Override the default \"conventional-changelog-conventionalcommits\" preset configuration.',\n\t),\n\n\t/**\n\t * Add a suffix to the release commit message.\n\t * @example \"[skip ci]\"\n\t */\n\treleaseMessageSuffix: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Add a suffix to the release commit message.\"),\n});\n","import type { ForkConfig } from \"./types\";\n\nexport const DEFAULT_CONFIG: ForkConfig = {\n\t// Commands\n\tinspectVersion: false,\n\n\t// Options\n\tfiles: [\n\t\t\"package.json\",\n\t\t\"package-lock.json\",\n\t\t\"npm-shrinkwrap.json\",\n\t\t\"jsr.json\",\n\t\t\"jsr.jsonc\",\n\t\t\"deno.json\",\n\t\t\"deno.jsonc\",\n\t\t\"manifest.json\", // Chrome extensions\n\t\t\"bower.json\",\n\t],\n\tpath: process.cwd(),\n\tchangelog: \"CHANGELOG.md\",\n\theader: `# Changelog\n\nAll notable changes to this project will be documented in this file. See [fork-version](https://github.com/eglavin/fork-version) for commit guidelines.\n`,\n\ttagPrefix: \"v\",\n\n\t// Flags\n\tallowMultipleVersions: true,\n\tcommitAll: false,\n\tchangelogAll: false,\n\tdebug: false,\n\tdryRun: false,\n\tsilent: false,\n\tgitTagFallback: true,\n\tsign: false,\n\tverify: false,\n\n\t// Skip Steps\n\tskipBump: false,\n\tskipChangelog: false,\n\tskipCommit: false,\n\tskipTag: false,\n\n\tchangelogPresetConfig: {},\n};\n","import meow from \"meow\";\n//@ts-check\n\n// This file is javascript so the following helper text can be extracted to the readme\n// without the need for a build step, otherwise it would also be typescript...\n\nexport const helperText = `Usage:\n $ fork-version [options]\n\nCommands:\n --help Show this help message.\n --version Show the current version of Fork-Version.\n --inspect-version If set, Fork-Version will print the current project version and exit.\n\nOptions:\n --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\"]]\n --glob, -G Glob pattern to match files to be updated.\n --path, -P The path Fork-Version will run from. [Default: process.cwd()]\n --changelog Name of the changelog file. [Default: \"CHANGELOG.md\"]\n --header The header text for the changelog.\n --tag-prefix Specify a prefix for the created tag. [Default: \"v\"]\n --pre-release Mark this release as a pre-release.\n --pre-release-tag Mark this release with a tagged pre-release. [Example: \"alpha\", \"beta\", \"rc\"]\n --current-version If set, Fork-Version will use this version instead of trying to determine one.\n --next-version If set, Fork-Version will attempt to update to this version, instead of incrementing using \"conventional-commit\".\n --release-as Release as increments the version by the specified level. [Choices: \"major\", \"minor\", \"patch\"]\n\nFlags:\n --allow-multiple-versions Don't throw an error if multiple versions are found in the given files. [Default: true]\n --commit-all Commit all changes, not just files updated by Fork-Version.\n --changelog-all If this flag is set, all default commit types will be added to the changelog.\n --debug Output debug information.\n --dry-run No output will be written to disk or committed.\n --silent Run without logging to the terminal.\n --git-tag-fallback If unable to find a version in the given files, fallback and attempt to use the latest git tag. [Default: true]\n --sign If true, git will sign the commit with the systems GPG key.\n --verify If true, git will run user defined git hooks before committing.\n\n To negate a flag you can prefix it with \"no-\", for example \"--no-git-tag-fallback\" will not fallback to the latest git tag.\n\nSkip Steps:\n --skip-bump Skip the version bump step.\n --skip-changelog Skip updating the changelog.\n --skip-commit Skip committing the changes.\n --skip-tag Skip tagging the commit.\n\nConventional Changelog Overrides:\n --commit-url-format Override the default commit URL format.\n --compare-url-format Override the default compare URL format.\n --issue-url-format Override the default issue URL format.\n --user-url-format Override the default user URL format.\n --release-commit-message-format Override the default release commit message format.\n --release-message-suffix Add a suffix to the end of the release message.\n\nExamples:\n $ fork-version\n Run fork-version in the current directory with default options.\n\n $ fork-version --path ./packages/my-package\n Run fork-version in the \"./packages/my-package\" directory.\n\n $ fork-version --file package.json --file MyApi.csproj\n Run fork-version and update the \"package.json\" and \"MyApi.csproj\" files.\n\n $ fork-version --glob \"*/package.json\"\n Run fork-version and update all \"package.json\" files in subdirectories.`;\n\nexport function getCliArguments() {\n\treturn meow(helperText, {\n\t\timportMeta: import.meta,\n\t\tbooleanDefault: undefined,\n\t\thelpIndent: 0,\n\t\tflags: {\n\t\t\t// Commands\n\t\t\tinspectVersion: { type: \"boolean\" },\n\n\t\t\t// Options\n\t\t\tfiles: { type: \"string\", isMultiple: true, aliases: [\"file\"], shortFlag: \"F\" },\n\t\t\tglob: { type: \"string\", shortFlag: \"G\" },\n\t\t\tpath: { type: \"string\", shortFlag: \"P\" },\n\t\t\tchangelog: { type: \"string\" },\n\t\t\theader: { type: \"string\" },\n\t\t\ttagPrefix: { type: \"string\" },\n\t\t\tpreRelease: { type: \"boolean\" },\n\t\t\tpreReleaseTag: { type: \"string\" },\n\t\t\tcurrentVersion: { type: \"string\" },\n\t\t\tnextVersion: { type: \"string\" },\n\t\t\treleaseAs: { type: \"string\", choices: [\"major\", \"minor\", \"patch\"] },\n\n\t\t\t// Flags\n\t\t\tallowMultipleVersions: { type: \"boolean\" },\n\t\t\tcommitAll: { type: \"boolean\" },\n\t\t\tchangelogAll: { type: \"boolean\" },\n\t\t\tdebug: { type: \"boolean\" },\n\t\t\tdryRun: { type: \"boolean\" },\n\t\t\tsilent: { type: \"boolean\" },\n\t\t\tgitTagFallback: { type: \"boolean\" },\n\t\t\tsign: { type: \"boolean\" },\n\t\t\tverify: { type: \"boolean\" },\n\n\t\t\t// Skip Steps\n\t\t\tskipBump: { type: \"boolean\" },\n\t\t\tskipChangelog: { type: \"boolean\" },\n\t\t\tskipCommit: { type: \"boolean\" },\n\t\t\tskipTag: { type: \"boolean\" },\n\n\t\t\t// Changelog Overrides\n\t\t\tcommitUrlFormat: { type: \"string\" },\n\t\t\tcompareUrlFormat: { type: \"string\" },\n\t\t\tissueUrlFormat: { type: \"string\" },\n\t\t\tuserUrlFormat: { type: \"string\" },\n\t\t\treleaseCommitMessageFormat: { type: \"string\" },\n\t\t\treleaseMessageSuffix: { type: \"string\" },\n\t\t},\n\t});\n}\n","import { z } from \"zod\";\nimport conventionalChangelogConfigSpec from \"conventional-changelog-config-spec\";\n\nimport { ChangelogPresetConfigTypeSchema, ChangelogPresetConfigSchema } from \"./schema\";\nimport type { ForkConfig } from \"./types\";\nimport type { getCliArguments } from \"./cli-arguments\";\nimport type { DetectedGitHost } from \"./detect-git-host\";\n\nexport function getChangelogPresetConfig(\n\tmergedConfig: Partial<ForkConfig> | undefined,\n\tcliArgumentsFlags: ReturnType<typeof getCliArguments>[\"flags\"],\n\tdetectedGitHost: DetectedGitHost | null,\n) {\n\tconst preset: { name: string; [_: string]: unknown } = {\n\t\tname: \"conventionalcommits\",\n\t};\n\n\t// First take any default values from the conventional-changelog-config-spec\n\tif (typeof conventionalChangelogConfigSpec.properties === \"object\") {\n\t\tObject.entries(conventionalChangelogConfigSpec.properties).forEach(([key, value]) => {\n\t\t\tif (\"default\" in value && value.default !== undefined) {\n\t\t\t\t// If the user has requested to see all types, we need to remove the hidden flag from the default types.\n\t\t\t\tif (mergedConfig?.changelogAll && key === \"types\") {\n\t\t\t\t\tconst parsedTypes = z.array(ChangelogPresetConfigTypeSchema).safeParse(value.default);\n\n\t\t\t\t\tif (parsedTypes.success) {\n\t\t\t\t\t\tparsedTypes.data.forEach((type) => {\n\t\t\t\t\t\t\tif (!type.section) {\n\t\t\t\t\t\t\t\tdelete type.hidden;\n\t\t\t\t\t\t\t\ttype.section = \"Other Changes\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tpreset[key] = parsedTypes.data;\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tpreset[key] = value.default;\n\t\t\t}\n\t\t});\n\t}\n\n\t// If we've detected a git host, use the values from the detected host now so that they can\n\t// be overwritten by the users config later\n\tif (detectedGitHost) {\n\t\tObject.entries(detectedGitHost).forEach(([key, value]) => {\n\t\t\tif (value !== undefined) {\n\t\t\t\tpreset[key] = value;\n\t\t\t}\n\t\t});\n\t}\n\n\t// Then overwrite with any values from the users config\n\tif (\n\t\tmergedConfig?.changelogPresetConfig &&\n\t\ttypeof mergedConfig.changelogPresetConfig === \"object\"\n\t) {\n\t\tObject.entries(mergedConfig.changelogPresetConfig).forEach(([key, value]) => {\n\t\t\tif (value !== undefined) {\n\t\t\t\tpreset[key] = value;\n\t\t\t}\n\t\t});\n\t}\n\n\t// If the user has defined a releaseMessageSuffix, append it to the releaseCommitMessageFormat\n\tif (mergedConfig?.releaseMessageSuffix && !cliArgumentsFlags?.releaseMessageSuffix) {\n\t\tpreset.releaseCommitMessageFormat = `${preset.releaseCommitMessageFormat} ${mergedConfig.releaseMessageSuffix}`;\n\t}\n\n\t// Finally overwrite with any values from the CLI arguments\n\tif (cliArgumentsFlags?.commitUrlFormat) {\n\t\tpreset.commitUrlFormat = cliArgumentsFlags.commitUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.compareUrlFormat) {\n\t\tpreset.compareUrlFormat = cliArgumentsFlags.compareUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.issueUrlFormat) {\n\t\tpreset.issueUrlFormat = cliArgumentsFlags.issueUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.userUrlFormat) {\n\t\tpreset.userUrlFormat = cliArgumentsFlags.userUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.releaseCommitMessageFormat) {\n\t\tpreset.releaseCommitMessageFormat = cliArgumentsFlags.releaseCommitMessageFormat;\n\t}\n\tif (cliArgumentsFlags?.releaseMessageSuffix) {\n\t\tpreset.releaseCommitMessageFormat = `${preset.releaseCommitMessageFormat} ${cliArgumentsFlags.releaseMessageSuffix}`;\n\t}\n\n\treturn ChangelogPresetConfigSchema.passthrough().parse(preset);\n}\n","import { execFile } from \"node:child_process\";\n\nexport interface DetectedGitHost {\n\tdetectedGitHost: string;\n\tcommitUrlFormat: string;\n\tcompareUrlFormat: string;\n\tissueUrlFormat: string;\n}\n\n/**\n * Conventional-Changelog already supports the following git hosts:\n * - Github\n * - Gitlab\n * - Bitbucket\n *\n * We want to detect if the user is using another host such as Azure DevOps,\n * if so we need to create the correct URLs so the changelog is generated\n * correctly.\n */\nexport async function detectGitHost(cwd: string): Promise<DetectedGitHost | null> {\n\tconst remoteUrl = (await new Promise((onResolve) => {\n\t\texecFile(\"git\", [\"config\", \"--get\", \"remote.origin.url\"], { cwd }, (_error, stdout) => {\n\t\t\tonResolve(stdout ? stdout.trim() : \"\");\n\t\t});\n\t})) as string;\n\n\t// A checked out Azure DevOps remote URL looks like one of these:\n\t//\n\t// | Checkout Type | Remote URL |\n\t// | ------------- | --------------------------------------------------------------------------------------- |\n\t// | HTTPS | https://{{ORGANISATION}}@dev.azure.com/{{ORGANISATION}}/{{PROJECT}}/_git/{{REPOSITORY}} |\n\t// | SSH | git@ssh.dev.azure.com:v3/{{ORGANISATION}}/{{PROJECT}}/{{REPOSITORY}} |\n\t//\n\tif (remoteUrl.startsWith(\"https://\") && remoteUrl.includes(\"@dev.azure.com/\")) {\n\t\t/**\n\t\t * [Regex101.com](https://regex101.com/r/fF7HUc/1)\n\t\t */\n\t\tconst match =\n\t\t\t/^https:\\/\\/(?<atorganisation>.*?)@dev.azure.com\\/(?<organisation>.*?)\\/(?<project>.*?)\\/_git\\/(?<repository>.*?)(?:\\.git)?$/.exec(\n\t\t\t\tremoteUrl,\n\t\t\t);\n\n\t\tif (match?.groups) {\n\t\t\tconst { organisation = \"\", project = \"\", repository = \"\" } = match.groups;\n\n\t\t\treturn {\n\t\t\t\tdetectedGitHost: \"Azure\",\n\t\t\t\tcommitUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/commit/{{hash}}`,\n\t\t\t\tcompareUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}`,\n\t\t\t\tissueUrlFormat: `{{host}}/${organisation}/${project}/_workitems/edit/{{id}}`,\n\t\t\t};\n\t\t}\n\t} else if (remoteUrl.startsWith(\"git@ssh.dev.azure.com:\")) {\n\t\t/**\n\t\t * [Regex101.com](https://regex101.com/r/VhNxWr/1)\n\t\t */\n\t\tconst match =\n\t\t\t/^git@ssh.dev.azure.com:v\\d\\/(?<organisation>.*?)\\/(?<project>.*?)\\/(?<repository>.*?)(?:\\.git)?$/.exec(\n\t\t\t\tremoteUrl,\n\t\t\t);\n\n\t\tif (match?.groups) {\n\t\t\tconst { organisation = \"\", project = \"\", repository = \"\" } = match.groups;\n\n\t\t\treturn {\n\t\t\t\tdetectedGitHost: \"Azure\",\n\t\t\t\tcommitUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/commit/{{hash}}`,\n\t\t\t\tcompareUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}`,\n\t\t\t\tissueUrlFormat: `{{host}}/${organisation}/${project}/_workitems/edit/{{id}}`,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn null;\n}\n","import { readFileSync } from \"node:fs\";\nimport { parse, resolve } from \"node:path\";\nimport JoyCon from \"joycon\";\nimport { bundleRequire } from \"bundle-require\";\nimport { glob } from \"glob\";\n\nimport { ForkConfigSchema } from \"./schema\";\nimport { DEFAULT_CONFIG } from \"./defaults\";\nimport { getCliArguments } from \"./cli-arguments\";\nimport { getChangelogPresetConfig } from \"./changelog-preset-config\";\nimport { detectGitHost } from \"./detect-git-host\";\nimport type { Config, ForkConfig } from \"./types\";\n\n/**\n * Name of the key in the package.json file that contains the users configuration.\n */\nconst PACKAGE_JSON_CONFIG_KEY = \"fork-version\";\n\nexport async function getUserConfig(): Promise<ForkConfig> {\n\tconst cliArguments = getCliArguments();\n\n\tconst cwd = cliArguments.flags.path ? resolve(cliArguments.flags.path) : process.cwd();\n\tconst joycon = new JoyCon({\n\t\tcwd,\n\t\tpackageKey: PACKAGE_JSON_CONFIG_KEY,\n\t\tstopDir: parse(cwd).root,\n\t});\n\tconst configFilePath = await joycon.resolve([\n\t\t\"fork.config.ts\",\n\t\t\"fork.config.js\",\n\t\t\"fork.config.cjs\",\n\t\t\"fork.config.mjs\",\n\t\t\"fork.config.json\",\n\t\t\"package.json\",\n\t]);\n\n\tconst configFile = await loadConfigFile(configFilePath);\n\n\tconst mergedConfig = {\n\t\t...DEFAULT_CONFIG,\n\t\t...configFile,\n\t\t...cliArguments.flags,\n\t} as ForkConfig;\n\n\t// If the user has defined a glob pattern, use it to find the requested files.\n\tlet globResults: string[] = [];\n\tif (mergedConfig.glob) {\n\t\tglobResults = await glob(mergedConfig.glob, {\n\t\t\tcwd: cwd,\n\t\t\tignore: [\"node_modules/**\"],\n\t\t\tnodir: true,\n\t\t});\n\t}\n\n\tconst detectedGitHost = await detectGitHost(cwd);\n\n\treturn {\n\t\t...mergedConfig,\n\n\t\tfiles: getFilesList(configFile?.files, cliArguments.flags?.files, globResults),\n\t\tpath: cwd,\n\t\tpreRelease:\n\t\t\t// Meow doesn't support multiple flags with the same name, so we need to check both.\n\t\t\tcliArguments.flags.preReleaseTag ?? cliArguments.flags.preRelease ?? configFile.preRelease,\n\t\tchangelogPresetConfig: getChangelogPresetConfig(\n\t\t\tmergedConfig,\n\t\t\tcliArguments.flags,\n\t\t\tdetectedGitHost,\n\t\t),\n\t};\n}\n\nasync function loadConfigFile(configFilePath: string | null) {\n\tif (!configFilePath) {\n\t\treturn {};\n\t}\n\n\t// Handle json config file.\n\tif (configFilePath.endsWith(\"json\")) {\n\t\tconst fileContent = JSON.parse(readFileSync(configFilePath).toString());\n\n\t\t// Handle package.json config file.\n\t\tif (configFilePath.endsWith(\"package.json\")) {\n\t\t\tif (\n\t\t\t\tfileContent[PACKAGE_JSON_CONFIG_KEY] &&\n\t\t\t\ttypeof fileContent[PACKAGE_JSON_CONFIG_KEY] === \"object\"\n\t\t\t) {\n\t\t\t\tconst parsed = ForkConfigSchema.partial().safeParse(fileContent[PACKAGE_JSON_CONFIG_KEY]);\n\t\t\t\tif (!parsed.success) {\n\t\t\t\t\tthrow parsed.error;\n\t\t\t\t}\n\t\t\t\treturn parsed.data;\n\t\t\t}\n\n\t\t\treturn {};\n\t\t}\n\n\t\tconst parsed = ForkConfigSchema.partial().safeParse(fileContent);\n\t\tif (!parsed.success) {\n\t\t\tthrow parsed.error;\n\t\t}\n\t\treturn parsed.data;\n\t}\n\n\t// Otherwise expect config file to use js or ts.\n\tconst fileContent = await bundleRequire({ filepath: configFilePath });\n\n\tconst parsed = ForkConfigSchema.partial().safeParse(fileContent.mod.default || fileContent.mod);\n\tif (!parsed.success) {\n\t\tthrow parsed.error;\n\t}\n\treturn parsed.data;\n}\n\nfunction getFilesList(\n\tconfigFiles: string[] | undefined,\n\tcliFiles: string[] | undefined,\n\tglobResults: string[],\n): string[] {\n\tconst listOfFiles = new Set<string>();\n\n\t// Add files from the users config file\n\tif (Array.isArray(configFiles)) {\n\t\tconfigFiles.forEach((file) => listOfFiles.add(file));\n\t}\n\n\t// Add files from the cli arguments\n\tif (Array.isArray(cliFiles)) {\n\t\tcliFiles.forEach((file) => listOfFiles.add(file));\n\t}\n\n\t// Add files from glob results\n\tglobResults.forEach((file) => listOfFiles.add(file));\n\n\t// If the user has defined files use them, otherwise use the default list of files.\n\tif (listOfFiles.size) {\n\t\treturn Array.from(listOfFiles);\n\t}\n\n\treturn DEFAULT_CONFIG.files;\n}\n\nexport function defineConfig(config: Config): Config {\n\treturn config;\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { ForkConfig } from \"../config/types\";\n\nexport class Logger {\n\tdisableLogs = false;\n\n\tconstructor(private config: Pick<ForkConfig, \"silent\" | \"debug\" | \"inspectVersion\">) {\n\t\tthis.log = this.log.bind(this);\n\t\tthis.warn = this.warn.bind(this);\n\t\tthis.error = this.error.bind(this);\n\t\tthis.debug = this.debug.bind(this);\n\n\t\t// Disable logs if silent or inspectVersion is set\n\t\tthis.disableLogs = this.config.silent || this.config.inspectVersion;\n\t}\n\n\tpublic log(...messages: any[]) {\n\t\tif (!this.disableLogs) {\n\t\t\tconsole.log(...messages);\n\t\t}\n\t}\n\n\tpublic warn(...messages: any[]) {\n\t\tif (!this.disableLogs) {\n\t\t\tconsole.warn(...messages);\n\t\t}\n\t}\n\n\tpublic error(...messages: any[]) {\n\t\tif (!this.disableLogs) {\n\t\t\tconsole.error(...messages);\n\t\t}\n\t}\n\n\tpublic debug(...messages: any[]) {\n\t\tif (this.config.debug && !this.disableLogs) {\n\t\t\tconsole.debug(...messages);\n\t\t}\n\t}\n}\n","import { lstatSync } from \"fs\";\n\n/**\n * Determine if a file exists.\n * @example\n * ```ts\n * fileExists(\"~/.bashrc\"); // true\n * fileExists(\"~/missing-file.txt\"); // false\n * ```\n */\nexport function fileExists(filePath: string): boolean {\n\ttry {\n\t\treturn lstatSync(filePath).isFile();\n\t} catch (_error) {\n\t\treturn false;\n\t}\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport {\n\tapplyEdits,\n\ttype EditResult,\n\ttype JSONPath,\n\tmodify,\n\tparse,\n\ttype ParseError,\n} from \"jsonc-parser\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/types\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/** The things we are interested in, in package.json-like files. */\ninterface PackageJsonish {\n\tversion?: string;\n\tprivate?: unknown;\n\tpackages?: {\n\t\t\"\"?: {\n\t\t\tversion?: string;\n\t\t};\n\t};\n}\n\n/** Options for parsing JSON and JSONC files. */\nconst PARSE_OPTIONS = {\n\tallowTrailingComma: true,\n\tallowEmptyContent: false,\n\tdisallowComments: false,\n};\n\n/**\n * A json package file should have a version property, like what can be seen\n * in the package.json file in the root of this project.\n *\n * @example\n * ```json\n * {\n * \"name\": \"fork-version\",\n * \"version\": \"1.2.3\",\n * \"private\": true,\n * }\n * ```\n */\nexport class JSONPackage implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf8\");\n\t\t\tconst parseErrors: ParseError[] = [];\n\t\t\tconst parsedJson: PackageJsonish = parse(fileContents, parseErrors, PARSE_OPTIONS);\n\t\t\tif (parseErrors.length) {\n\t\t\t\tthis.logger.warn(`[File Manager] Unable to parse JSON: ${fileName}`, parseErrors);\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tif (parsedJson?.version) {\n\t\t\t\treturn {\n\t\t\t\t\tname: fileName,\n\t\t\t\t\tpath: filePath,\n\t\t\t\t\tversion: parsedJson.version,\n\n\t\t\t\t\tisPrivate: typeof parsedJson?.private === \"boolean\" ? parsedJson.private : true,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis.logger.warn(`[File Manager] Unable to determine json package: ${fileName}`);\n\t\t}\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string) {\n\t\tlet fileContents = readFileSync(fileState.path, \"utf8\");\n\n\t\tconst parseErrors: ParseError[] = [];\n\t\tconst parsedJson: PackageJsonish = parse(fileContents, parseErrors, PARSE_OPTIONS);\n\t\tif (parseErrors.length) {\n\t\t\tthis.logger.warn(`[File Manager] Unable to parse JSON: ${fileState.path}`, parseErrors);\n\t\t\treturn;\n\t\t}\n\n\t\tfileContents = setStringInJsonc(fileContents, [\"version\"], newVersion);\n\t\tif (parsedJson?.packages?.[\"\"]) {\n\t\t\t// package-lock v2 stores version here too.\n\t\t\tfileContents = setStringInJsonc(fileContents, [\"packages\", \"\", \"version\"], newVersion);\n\t\t}\n\n\t\twriteFileSync(fileState.path, fileContents, \"utf8\");\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\treturn fileName.endsWith(\".json\") || fileName.endsWith(\".jsonc\");\n\t}\n}\n\n/**\n * Sets a new string value at the given path in a JSON or JSONC string.\n * @param jsonc the JSON or JSONC string (the contents of a file)\n * @param jsonPath path to the value to set, as an array of segments\n * @param newString string to set the value to\n * @returns the JSON or JSONC string with the value set\n */\nfunction setStringInJsonc(jsonc: string, jsonPath: JSONPath, newString: string): string {\n\tconst edits: EditResult = modify(jsonc, jsonPath, newString, {});\n\treturn applyEdits(jsonc, edits);\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport { parse, parseDocument } from \"yaml\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/types\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/**\n * A yaml package file should have a version property on the top level, like what can be seen\n * in [this example project](https://github.com/eglavin/wordionary/blob/01ae9b9d604cecdf9d320ed6028a727be5e5349e/pubspec.yaml#L19C1-L19C17).\n *\n * @example\n * ```yaml\n * name: wordionary\n * description: \"A Flutter project.\"\n * publish_to: 'none'\n * version: 1.2.3\n * ```\n */\nexport class YAMLPackage implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\t/**\n\t * If the version is returned with a \"+\" symbol in the value then the version might be from a\n\t * flutter `pubspec.yaml` file, if so we want to retain the input builderNumber by splitting it\n\t * and joining it again later.\n\t */\n\tprivate handleBuildNumber(fileVersion: string): {\n\t\tversion: string;\n\t\tbuilderNumber?: string;\n\t} {\n\t\tconst [version, builderNumber] = fileVersion.split(\"+\");\n\n\t\t// If the builderNumber is an integer then we'll return the split value.\n\t\tif (/^\\d+$/.test(builderNumber)) {\n\t\t\treturn {\n\t\t\t\tversion,\n\t\t\t\tbuilderNumber,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tversion: fileVersion,\n\t\t};\n\t}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf-8\");\n\n\t\t\tconst fileVersion = parse(fileContents)?.version;\n\t\t\tif (fileVersion) {\n\t\t\t\tconst parsedVersion = this.handleBuildNumber(fileVersion);\n\n\t\t\t\treturn {\n\t\t\t\t\tname: fileName,\n\t\t\t\t\tpath: filePath,\n\t\t\t\t\tversion: parsedVersion.version || \"\",\n\t\t\t\t\tbuilderNumber: parsedVersion.builderNumber ?? undefined,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tthis.logger.warn(`[File Manager] Unable to determine PubSpec file: ${fileName}`);\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string): void {\n\t\tconst fileContents = readFileSync(fileState.path, \"utf8\");\n\t\tconst yamlDocument = parseDocument(fileContents);\n\n\t\tlet newFileVersion = newVersion;\n\t\tif (fileState.builderNumber !== undefined) {\n\t\t\tnewFileVersion += `+${fileState.builderNumber}`; // Reattach builderNumber if previously set.\n\t\t}\n\n\t\tyamlDocument.set(\"version\", newFileVersion);\n\n\t\twriteFileSync(fileState.path, yamlDocument.toString(), \"utf8\");\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\treturn fileName.endsWith(\".yaml\") || fileName.endsWith(\".yml\");\n\t}\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/types\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/**\n * A plain text file will have just the version as the content.\n *\n * @example\n * ```txt\n * 1.2.3\n * ```\n */\nexport class PlainText implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf8\");\n\n\t\t\treturn {\n\t\t\t\tname: fileName,\n\t\t\t\tpath: filePath,\n\t\t\t\tversion: fileContents || \"\",\n\t\t\t};\n\t\t}\n\n\t\tthis.logger.warn(`[File Manager] Unable to determine plain text: ${fileName}`);\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string) {\n\t\twriteFileSync(fileState.path, newVersion, \"utf8\");\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\treturn fileName.endsWith(\"version.txt\");\n\t}\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport * as cheerio from \"cheerio/slim\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/types\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/**\n * A ms-build file is an xml file with a version property under the Project > PropertyGroup node.\n *\n * [Microsoft Learn - MSBuild Reference](https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild?view=vs-2022)\n *\n * @example\n * ```xml\n * <Project Sdk=\"Microsoft.NET.Sdk\">\n * <PropertyGroup>\n * <Version>1.2.3</Version>\n * </PropertyGroup>\n * </Project>\n * ```\n */\nexport class MSBuildProject implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf8\");\n\t\t\tconst $ = cheerio.load(fileContents, {\n\t\t\t\txmlMode: true,\n\t\t\t\txml: { decodeEntities: false },\n\t\t\t});\n\n\t\t\tconst version = $(\"Project > PropertyGroup > Version\").text();\n\t\t\tif (version) {\n\t\t\t\treturn {\n\t\t\t\t\tname: fileName,\n\t\t\t\t\tpath: filePath,\n\t\t\t\t\tversion: version,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis.logger.warn(`[File Manager] Unable to determine ms-build package: ${fileName}`);\n\t\t}\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string) {\n\t\tconst fileContents = readFileSync(fileState.path, \"utf8\");\n\t\tconst $ = cheerio.load(fileContents, {\n\t\t\txmlMode: true,\n\t\t\txml: { decodeEntities: false },\n\t\t});\n\n\t\t$(\"Project > PropertyGroup > Version\").text(newVersion);\n\n\t\t// Cheerio doesn't handle self-closing tags well,\n\t\t// so we're manually adding a space before the closing tag.\n\t\tconst updatedContent = $.xml().replaceAll('\"/>', '\" />');\n\n\t\twriteFileSync(fileState.path, updatedContent, \"utf8\");\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\t// List of known ms-build project file extensions.\n\t\t// https://stackoverflow.com/questions/2007689/is-there-a-standard-file-extension-for-msbuild-files\n\t\treturn (\n\t\t\t[\".csproj\", \".dbproj\", \".esproj\", \".fsproj\", \".props\", \".vbproj\", \".vcxproj\"].findIndex(\n\t\t\t\t(ext) => fileName.endsWith(ext),\n\t\t\t) !== -1\n\t\t);\n\t}\n}\n","import { JSONPackage } from \"./json-package\";\nimport { YAMLPackage } from \"./yaml-package\";\nimport { PlainText } from \"./plain-text\";\nimport { MSBuildProject } from \"./ms-build-project\";\n\nimport type { ForkConfig } from \"../config/types\";\nimport type { Logger } from \"../utils/logger\";\n\nexport interface FileState {\n\tname: string;\n\tpath: string;\n\tversion: string;\n\n\t[other: string]: unknown;\n}\n\nexport interface IFileManager {\n\tread(fileName: string): FileState | undefined;\n\twrite(fileState: FileState, newVersion: string): void;\n\tisSupportedFile(fileName: string): boolean;\n}\n\nexport class FileManager {\n\tprivate JSONPackage: JSONPackage;\n\tprivate YAMLPackage: YAMLPackage;\n\tprivate PlainText: PlainText;\n\tprivate MSBuildProject: MSBuildProject;\n\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {\n\t\tthis.JSONPackage = new JSONPackage(config, logger);\n\t\tthis.YAMLPackage = new YAMLPackage(config, logger);\n\t\tthis.PlainText = new PlainText(config, logger);\n\t\tthis.MSBuildProject = new MSBuildProject(config, logger);\n\t}\n\n\t/**\n\t * Get the state from the given file name.\n\t *\n\t * @example\n\t * ```ts\n\t * fileManager.read(\"package.json\");\n\t * ```\n\t *\n\t * @returns\n\t * ```json\n\t * { \"name\": \"package.json\", \"path\": \"/path/to/package.json\", \"version\": \"1.2.3\", \"isPrivate\": true }\n\t * ```\n\t */\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst _fileName = fileName.toLowerCase();\n\n\t\tif (this.JSONPackage.isSupportedFile(_fileName)) {\n\t\t\treturn this.JSONPackage.read(fileName);\n\t\t}\n\n\t\tif (this.YAMLPackage.isSupportedFile(_fileName)) {\n\t\t\treturn this.YAMLPackage.read(fileName);\n\t\t}\n\n\t\tif (this.PlainText.isSupportedFile(_fileName)) {\n\t\t\treturn this.PlainText.read(fileName);\n\t\t}\n\n\t\tif (this.MSBuildProject.isSupportedFile(_fileName)) {\n\t\t\treturn this.MSBuildProject.read(fileName);\n\t\t}\n\n\t\tthis.logger.error(`[File Manager] Unsupported file: ${fileName}`);\n\t}\n\n\t/**\n\t * Write the new version to the given file.\n\t *\n\t * @example\n\t * ```ts\n\t * fileManager.write(\n\t * { name: \"package.json\", path: \"/path/to/package.json\", version: \"1.2.2\" },\n\t * \"1.2.3\"\n\t * );\n\t * ```\n\t */\n\tpublic write(fileState: FileState, newVersion: string): void {\n\t\tif (this.config.dryRun) {\n\t\t\treturn;\n\t\t}\n\t\tconst _fileName = fileState.name.toLowerCase();\n\n\t\tif (this.JSONPackage.isSupportedFile(_fileName)) {\n\t\t\treturn this.JSONPackage.write(fileState, newVersion);\n\t\t}\n\n\t\tif (this.YAMLPackage.isSupportedFile(_fileName)) {\n\t\t\treturn this.YAMLPackage.write(fileState, newVersion);\n\t\t}\n\n\t\tif (this.PlainText.isSupportedFile(_fileName)) {\n\t\t\treturn this.PlainText.write(fileState, newVersion);\n\t\t}\n\n\t\tif (this.MSBuildProject.isSupportedFile(_fileName)) {\n\t\t\treturn this.MSBuildProject.write(fileState, newVersion);\n\t\t}\n\n\t\tthis.logger.error(`[File Manager] Unsupported file: ${fileState.path}`);\n\t}\n}\n","import gitSemverTags from \"git-semver-tags\";\nimport semver from \"semver\";\n\n/**\n * Get the latest git tag version.\n *\n * @example\n * ```ts\n * const tagPrefix = \"v\";\n * await getLatestGitTagVersion(tagPrefix); // 1.2.3\n * ```\n */\nexport async function getLatestGitTagVersion(tagPrefix: string | undefined): Promise<string> {\n\tconst gitTags = await gitSemverTags({ tagPrefix });\n\tif (!gitTags.length) {\n\t\treturn \"\";\n\t}\n\n\tconst cleanedTags = [];\n\n\tfor (const tag of gitTags) {\n\t\tconst cleanedTag = semver.clean(tag.replace(new RegExp(`^${tagPrefix}`), \"\"));\n\n\t\tif (cleanedTag) {\n\t\t\tcleanedTags.push(cleanedTag);\n\t\t}\n\t}\n\n\treturn cleanedTags.sort(semver.rcompare)[0];\n}\n","import semver, { type ReleaseType } from \"semver\";\n\n/**\n * Get the priority of given type.\n * @example\n * - \"patch\" => 0\n * - \"minor\" => 1\n * - \"major\" => 2\n */\nfunction getPriority(type?: string): number {\n\treturn [\"patch\", \"minor\", \"major\"].indexOf(type ?? \"\");\n}\n\n/**\n * Get the given versions highest state.\n * @example\n * - \"patch\"\n * - \"minor\"\n * - \"major\"\n */\nfunction getVersionType(version: string): \"patch\" | \"minor\" | \"major\" | undefined {\n\tconst parseVersion = semver.parse(version);\n\n\tif (parseVersion?.major) {\n\t\treturn \"major\";\n\t} else if (parseVersion?.minor) {\n\t\treturn \"minor\";\n\t} else if (parseVersion?.patch) {\n\t\treturn \"patch\";\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Get the recommended release type for the given version depending on if\n * the user asks for a prerelease with or without a tag.\n * ```js\n * getReleaseType(\"patch\", \"1.0.0\", false) => \"patch\"\n * getReleaseType(\"major\", \"0.0.0-beta\", \"beta\") => \"premajor\"\n * ```\n */\nexport function getReleaseType(\n\treleaseType: \"major\" | \"minor\" | \"patch\",\n\tcurrentVersion: string,\n\tpreReleaseTag?: string | boolean,\n): ReleaseType {\n\tif (!preReleaseTag) {\n\t\treturn releaseType;\n\t}\n\n\tconst currentVersionsIsPreRelease = Array.isArray(semver.prerelease(currentVersion));\n\tif (currentVersionsIsPreRelease) {\n\t\tconst currentReleaseType = getVersionType(currentVersion);\n\n\t\tif (\n\t\t\tcurrentReleaseType === releaseType ||\n\t\t\tgetPriority(currentReleaseType) > getPriority(releaseType)\n\t\t) {\n\t\t\treturn \"prerelease\";\n\t\t}\n\t}\n\n\treturn `pre${releaseType}`;\n}\n","import semver, { type ReleaseType } from \"semver\";\nimport conventionalRecommendedBump from \"conventional-recommended-bump\";\n\nimport { getLatestGitTagVersion } from \"../utils/git-tag-version\";\nimport { getReleaseType } from \"../utils/release-type\";\nimport type { ForkConfig } from \"../config/types\";\nimport type { FileManager, FileState } from \"../strategies/file-manager\";\nimport type { Logger } from \"../utils/logger\";\n\nexport interface CurrentVersion {\n\tversion: string;\n\tfiles: FileState[];\n}\n\nexport async function getCurrentVersion(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tfileManager: FileManager,\n\tfilesToUpdate: string[],\n): Promise<CurrentVersion> {\n\tconst files: FileState[] = [];\n\tconst versions = new Set<string>();\n\n\tfor (const file of filesToUpdate) {\n\t\tconst fileState = fileManager.read(file);\n\n\t\tif (fileState) {\n\t\t\tfiles.push(fileState);\n\n\t\t\tif (config.currentVersion) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tversions.add(fileState.version);\n\t\t}\n\t}\n\n\tif (config.currentVersion) {\n\t\tversions.add(config.currentVersion);\n\t}\n\n\t// If we still don't have a version, try to get the latest git tag\n\tif (versions.size === 0 && config.gitTagFallback) {\n\t\tconst version = await getLatestGitTagVersion(config.tagPrefix);\n\t\tif (version) {\n\t\t\tlogger.log(`[Version] Using git tag fallback.`);\n\t\t\tversions.add(version);\n\t\t}\n\t}\n\n\tif (versions.size === 0) {\n\t\tthrow new Error(\"Unable to find current version\");\n\t} else if (versions.size > 1) {\n\t\tif (!config.allowMultipleVersions) {\n\t\t\tthrow new Error(\"Found multiple versions\");\n\t\t}\n\t\tlogger.warn(\"[WARNING] Found multiple versions, using the first one.\");\n\t\tlogger.log(`Versions: ${Array.from(versions).join(\", \")}`);\n\t}\n\n\tconst currentVersion = semver.rsort(Array.from(versions))[0];\n\n\t// If we're just inspecting the version, output the version and exit\n\tif (config.inspectVersion) {\n\t\tconsole.log(currentVersion);\n\t\tprocess.exit(0);\n\t}\n\n\tlogger.log(`Current version: ${currentVersion}`);\n\treturn {\n\t\tfiles,\n\t\tversion: currentVersion,\n\t};\n}\n\nexport interface NextVersion {\n\tversion: string;\n\tlevel?: number;\n\tpreMajor?: boolean;\n\treason?: string;\n\treleaseType?: ReleaseType;\n}\n\nexport async function getNextVersion(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tcurrentVersion: string,\n): Promise<NextVersion> {\n\tif (config.skipBump) {\n\t\tlogger.log(\"Skip bump, using current version as next version\");\n\t\treturn {\n\t\t\tversion: currentVersion,\n\t\t};\n\t}\n\n\tif (config.nextVersion && semver.valid(config.nextVersion)) {\n\t\tlogger.log(`Next version: ${config.nextVersion}`);\n\t\treturn {\n\t\t\tversion: config.nextVersion,\n\t\t};\n\t}\n\n\tconst isPreMajor = semver.lt(currentVersion, \"1.0.0\");\n\n\tlet recommendedBump: Awaited<ReturnType<typeof conventionalRecommendedBump>>;\n\ttry {\n\t\tif (config.releaseAs) {\n\t\t\trecommendedBump = {\n\t\t\t\treleaseType: config.releaseAs,\n\t\t\t\tlevel: -1,\n\t\t\t\treason: \"User defined\",\n\t\t\t};\n\t\t} else {\n\t\t\trecommendedBump = await conventionalRecommendedBump({\n\t\t\t\tpreset: {\n\t\t\t\t\tname: \"conventionalcommits\",\n\t\t\t\t\t...config.changelogPresetConfig,\n\t\t\t\t\tpreMajor: isPreMajor,\n\t\t\t\t},\n\t\t\t\tpath: config.path,\n\t\t\t\ttagPrefix: config.tagPrefix,\n\t\t\t\tcwd: config.path,\n\t\t\t});\n\t\t}\n\t} catch (_error) {\n\t\tthrow new Error(`[conventional-recommended-bump] Unable to determine next version`);\n\t}\n\n\tif (recommendedBump.releaseType) {\n\t\tconst releaseType = getReleaseType(\n\t\t\trecommendedBump.releaseType,\n\t\t\tcurrentVersion,\n\t\t\tconfig.preRelease,\n\t\t);\n\n\t\tconst state: NextVersion = {\n\t\t\t...recommendedBump,\n\t\t\tpreMajor: isPreMajor,\n\t\t\treleaseType,\n\t\t\tversion:\n\t\t\t\tsemver.inc(\n\t\t\t\t\tcurrentVersion,\n\t\t\t\t\treleaseType,\n\t\t\t\t\ttypeof config.preRelease === \"string\" ? config.preRelease : undefined,\n\t\t\t\t) ?? \"\",\n\t\t};\n\n\t\tlogger.log(`Next version: ${state.version} (${state.releaseType})`);\n\t\treturn state;\n\t}\n\n\tthrow new Error(\"Unable to find next version\");\n}\n","import { resolve } from \"node:path\";\nimport { writeFileSync, readFileSync } from \"node:fs\";\nimport conventionalChangelog from \"conventional-changelog\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/types\";\nimport type { Logger } from \"../utils/logger\";\n\n/**\n * Matches the following changelog header formats:\n * - `## [1.2.3]`\n * - `<a name=\"1.2.3\"></a>`\n */\nconst RELEASE_PATTERN = /(^#+ \\[?[0-9]+\\.[0-9]+\\.[0-9]+|<a name=)/m;\n\n/**\n * Get the existing changelog content from the latest release onwards.\n * @see {@link RELEASE_PATTERN}\n */\nfunction getOldReleaseContent(filePath: string, exists: boolean): string {\n\tif (exists) {\n\t\tconst fileContents = readFileSync(filePath, \"utf-8\");\n\t\tconst oldContentStart = fileContents.search(RELEASE_PATTERN);\n\n\t\tif (oldContentStart !== -1) {\n\t\t\treturn fileContents.substring(oldContentStart);\n\t\t}\n\t}\n\n\treturn \"\";\n}\n\n/**\n * Generate the new changelog content for this release.\n */\nfunction getNewReleaseContent(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tnextVersion: string,\n): Promise<string> {\n\treturn new Promise<string>((onResolve) => {\n\t\tlet newContent = \"\";\n\n\t\tconventionalChangelog(\n\t\t\t{\n\t\t\t\tpreset: {\n\t\t\t\t\tname: \"conventionalcommits\",\n\t\t\t\t\t...config.changelogPresetConfig,\n\t\t\t\t},\n\t\t\t\ttagPrefix: config.tagPrefix,\n\t\t\t\twarn: (...message: string[]) => logger.debug(\"[conventional-changelog] \", ...message),\n\t\t\t\tcwd: config.path,\n\t\t\t},\n\t\t\t{\n\t\t\t\tversion: nextVersion,\n\t\t\t},\n\t\t\t{\n\t\t\t\tmerges: null,\n\t\t\t\tpath: config.path,\n\t\t\t},\n\t\t)\n\t\t\t.on(\"error\", (error) => {\n\t\t\t\tlogger.error(\"[conventional-changelog] Unable to parse changes\");\n\t\t\t\tthrow error;\n\t\t\t})\n\t\t\t.on(\"data\", (chunk) => {\n\t\t\t\tnewContent += chunk.toString();\n\t\t\t})\n\t\t\t.on(\"end\", () => {\n\t\t\t\tonResolve(newContent);\n\t\t\t});\n\t});\n}\n\nexport async function updateChangelog(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tnextVersion: string,\n): Promise<void> {\n\tif (config.skipChangelog) {\n\t\tlogger.log(\"Skip changelog update\");\n\t\treturn;\n\t}\n\n\tif (config.header.search(RELEASE_PATTERN) !== -1) {\n\t\t// Need to ensure the header doesn't contain the release pattern\n\t\tthrow new Error(\"Header cannot contain release pattern\");\n\t}\n\n\t// Create the changelog file if it doesn't exist\n\tconst changelogPath = resolve(config.path, config.changelog);\n\tif (!config.dryRun && !fileExists(changelogPath)) {\n\t\tlogger.log(`Creating Changelog file: ${changelogPath}`);\n\t\twriteFileSync(changelogPath, \"\\n\", \"utf8\");\n\t}\n\n\tconst oldContent = getOldReleaseContent(changelogPath, fileExists(changelogPath));\n\tconst newContent = await getNewReleaseContent(config, logger, nextVersion);\n\n\tlogger.log(`Updating Changelog: ${changelogPath}`);\n\tif (!config.dryRun && newContent) {\n\t\twriteFileSync(\n\t\t\tchangelogPath,\n\t\t\t`${config.header}\n${newContent}\n${oldContent}\n`.trim(),\n\t\t\t\"utf8\",\n\t\t);\n\t}\n}\n","/**\n * Formats the commit message by replacing the `{{currentTag}}` placeholder\n * globally with the new version.\n *\n * Falls back to `chore(release): {{currentTag}}` if message is argument is falsy.\n */\nexport function formatCommitMessage(message: string | undefined, version: string): string {\n\tif (!message) {\n\t\tmessage = \"chore(release): {{currentTag}}\";\n\t}\n\n\treturn message.replace(new RegExp(\"{{currentTag}}\", \"g\"), version);\n}\n","import { resolve } from \"node:path\";\nimport { formatCommitMessage } from \"../utils/format-commit-message\";\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/types\";\nimport type { FileState } from \"../strategies/file-manager\";\nimport type { Logger } from \"../utils/logger\";\nimport type { Git } from \"../utils/git\";\n\nexport async function commitChanges(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tgit: Git,\n\tfiles: FileState[],\n\tnextVersion: string,\n): Promise<void> {\n\tif (config.skipCommit) {\n\t\tlogger.log(\"Skip commit\");\n\t\treturn;\n\t}\n\n\tlogger.log(\"Committing changes\");\n\n\tconst filesToCommit: string[] = [];\n\tif (fileExists(resolve(config.path, config.changelog))) {\n\t\tfilesToCommit.push(resolve(config.path, config.changelog));\n\t}\n\tfor (const file of files) {\n\t\tfilesToCommit.push(file.path);\n\t}\n\n\t// If there are no files to commit don't continue.\n\tif (filesToCommit.length === 0) {\n\t\treturn;\n\t}\n\n\tif (config.commitAll) {\n\t\tawait git.add(\"--all\");\n\t} else {\n\t\tawait git.add(...filesToCommit);\n\t}\n\n\tconst shouldVerify = config.verify ? undefined : \"--no-verify\";\n\tconst shouldSign = config.sign ? \"--gpg-sign\" : undefined;\n\n\tawait git.commit(\n\t\tshouldVerify,\n\t\tshouldSign,\n\t\t\"--message\",\n\t\tformatCommitMessage(config.changelogPresetConfig?.releaseCommitMessageFormat, nextVersion),\n\t);\n}\n","import { formatCommitMessage } from \"../utils/format-commit-message\";\nimport type { ForkConfig } from \"../config/types\";\nimport type { Logger } from \"../utils/logger\";\nimport type { Git } from \"../utils/git\";\n\nexport async function tagChanges(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tgit: Git,\n\tnextVersion: string,\n): Promise<void> {\n\tif (config.skipTag) {\n\t\tlogger.log(\"Skip tag creation\");\n\t\treturn;\n\t}\n\n\t/** @example \"v1.2.3\" or \"version/1.2.3\" */\n\tconst tag = `${config.tagPrefix}${nextVersion}`;\n\n\tlogger.log(`Creating Tag: ${tag}`);\n\n\tawait git.tag(\n\t\tconfig.sign ? \"--sign\" : \"--annotate\",\n\t\ttag,\n\t\t\"--message\",\n\t\tformatCommitMessage(config.changelogPresetConfig?.releaseCommitMessageFormat, nextVersion),\n\t);\n}\n"]}
|