fork-version 1.7.3 → 1.7.6

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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # Fork Version
2
2
 
3
+ ## 1.7.6 (2024-11-09)
4
+
5
+
6
+ ### Refactor
7
+
8
+ * remove git-semver-tags library in favour of vendoring it ([#80](https://github.com/eglavin/fork-version/issues/80)) ([5e1b9cb](https://github.com/eglavin/fork-version/commit/5e1b9cbe7c7d77479235fcdc6f1dbc182c10ecd3))
9
+
10
+
11
+ ## 1.7.5 (2024-11-09)
12
+
13
+
14
+ ### Refactor
15
+
16
+ * rename strategies folder to files ([#79](https://github.com/eglavin/fork-version/issues/79)) ([9a06f63](https://github.com/eglavin/fork-version/commit/9a06f63c95d760fa0d729a839d2dc576c9c059e9))
17
+
18
+
19
+ ## 1.7.4 (2024-11-08)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * match casing of logs between steps ([df88a60](https://github.com/eglavin/fork-version/commit/df88a60429b508dcbaa55aff34ff816e745b26f5))
25
+
26
+
3
27
  ## 1.7.3 (2024-11-03)
4
28
 
5
29
 
package/README.md CHANGED
@@ -14,7 +14,7 @@ Fork-Version automates version control tasks such as determining, updating, and
14
14
  </p>
15
15
 
16
16
  <details>
17
- <summary>This project is essentially a complete re-write of standard-version following on from its deprecation in May 2022.</summary>
17
+ <summary>This project is essentially a complete re-write of <a href=https://github.com/conventional-changelog/standard-version>standard-version</a> following on from its deprecation in May 2022.</summary>
18
18
  Although there are many alternatives such as <a href=https://github.com/googleapis/release-please>release-please</a>. This project aims to continue focusing on just the versioning and changelog generation aspect of the process for use in other Git hosts outside of Github.
19
19
  </details>
20
20
 
@@ -23,7 +23,7 @@ Although there are many alternatives such as <a href=https://github.com/googleap
23
23
  By following the [conventional commit](https://www.conventionalcommits.org) standard Fork-Version can automate the following tasks for you:
24
24
 
25
25
  1. Determine the current and next version
26
- 1. Update the version in the selected files
26
+ 1. Update the version in the selected files [(View the supported files)](#supported-file-types)
27
27
  1. Update your changelog
28
28
  1. Commit the changed files
29
29
  1. Create a tag for the new version
@@ -77,6 +77,7 @@ To install the package locally to your project you can use one of the following
77
77
  You can then add the following entry to your package.json scripts section and use it like any other script you already use in your project.
78
78
 
79
79
  ```json
80
+ // package.json
80
81
  {
81
82
  "scripts": {
82
83
  "release": "fork-version"
@@ -98,6 +99,8 @@ When ran as a cli tool Fork-Version will exit with one of the following exit cod
98
99
 
99
100
  ### Command Line Options
100
101
 
102
+ The following help text can be viewed by running the following command: `npx fork-version --help`
103
+
101
104
  <!-- START COMMAND LINE OPTIONS -->
102
105
 
103
106
  ```text
@@ -188,6 +191,7 @@ You can configure Fork-Version using one of the following files:
188
191
  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.
189
192
 
190
193
  ```js
194
+ // fork.config.ts
191
195
  import { defineConfig } from 'fork-version';
192
196
 
193
197
  export default defineConfig({
@@ -199,6 +203,7 @@ export default defineConfig({
199
203
  Alternatively you can use typescript type annotations in a typescript file:
200
204
 
201
205
  ```ts
206
+ // fork.config.ts
202
207
  import type { Config } from 'fork-version';
203
208
 
204
209
  const config: Config = {
@@ -212,6 +217,7 @@ export default config;
212
217
  Or jsdocs in a javascript file:
213
218
 
214
219
  ```js
220
+ // fork.config.js
215
221
  /** @type {import("fork-version").Config} */
216
222
  export default {
217
223
  header: `# My Changelog`,
@@ -228,6 +234,7 @@ Another way you can configure Fork-Version is by using a json file called `fork.
228
234
  If you still want intellisense information you can use the following schema in your json file, otherwise `$schema` is an optional key.
229
235
 
230
236
  ```json
237
+ // fork.config.json
231
238
  {
232
239
  "$schema": "https://raw.githubusercontent.com/eglavin/fork-version/main/schema/latest.json",
233
240
  "header": "# My Changelog",
@@ -243,6 +250,7 @@ Internally we're using [zod-to-json-schema](https://github.com/StefanTerdell/zod
243
250
  Alternatively you can define your config using a key in your `package.json` file called `fork-version`:
244
251
 
245
252
  ```json
253
+ // package.json
246
254
  {
247
255
  "name": "my-js-project",
248
256
  "version": "1.2.3",
@@ -343,14 +351,14 @@ Marking a release as a pre-release allows you to define a change as a patch to a
343
351
  | Example Value | Version Created |
344
352
  |:--------------|:----------------|
345
353
  | `true` | `1.2.3-0` |
346
- | `alpha` | `1.2.3-alpha-0` |
354
+ | `alpha` | `1.2.3-alpha.0` |
347
355
 
348
356
  Fork-Version uses [meow](https://github.com/sindresorhus/meow) to parse cli arguments which is unable to take a single argument and parse it as either a string and or a boolean. So to do the above through the cli interface you'll need to use two different arguments:
349
357
 
350
358
  | Example CLI Usage | Version Created |
351
359
  |:---------------------------------------|:----------------|
352
360
  | `fork-version --pre-release` | `1.2.3-0` |
353
- | `fork-version --pre-release-tag alpha` | `1.2.3-alpha-0` |
361
+ | `fork-version --pre-release-tag alpha` | `1.2.3-alpha.0` |
354
362
 
355
363
  ##### config.releaseAs
356
364
 
@@ -389,7 +397,7 @@ Checkout the `fork.config.js` file [here](./fork.config.js) to see an example of
389
397
  | section | string | The name of the section in the `CHANGELOG` the commit should show up in. |
390
398
  | hidden | boolean | Should show in the generated changelog message? |
391
399
 
392
- ###### config.releaseMessageSuffix
400
+ ##### config.releaseMessageSuffix
393
401
 
394
402
  Adds a suffix to the end of the release message, useful to add a `[skip ci]` message to the end of the created commit.
395
403
 
@@ -431,7 +439,7 @@ version: 1.2.3
431
439
 
432
440
  #### Plain Text
433
441
 
434
- A plain text file will have just the version as the content.
442
+ A plain text file is a file which contains just the version as the content. Files that end with `version.txt` will be treated as a plain text version file.
435
443
 
436
444
  ```text
437
445
  1.2.3
@@ -7,12 +7,11 @@ 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 { parse as parse$1, modify, applyEdits } from 'jsonc-parser';
10
+ import { modify, applyEdits, parse as parse$1 } from 'jsonc-parser';
11
11
  import { parse as parse$2, parseDocument } from 'yaml';
12
12
  import * as cheerio from 'cheerio/slim';
13
- import semver3 from 'semver';
13
+ import semver2 from 'semver';
14
14
  import conventionalRecommendedBump from 'conventional-recommended-bump';
15
- import gitSemverTags from 'git-semver-tags';
16
15
  import conventionalChangelog from 'conventional-changelog';
17
16
 
18
17
  // src/config/schema.js
@@ -652,23 +651,35 @@ function fileExists(filePath) {
652
651
  }
653
652
  }
654
653
 
655
- // src/strategies/json-package.ts
656
- var PARSE_OPTIONS = {
657
- allowTrailingComma: true,
658
- allowEmptyContent: false,
659
- disallowComments: false
660
- };
654
+ // src/files/json-package.ts
661
655
  var JSONPackage = class {
662
656
  constructor(config, logger) {
663
657
  this.config = config;
664
658
  this.logger = logger;
665
659
  }
660
+ /** Options for parsing JSON and JSONC files. */
661
+ PARSE_OPTIONS = {
662
+ allowEmptyContent: false,
663
+ allowTrailingComma: true,
664
+ disallowComments: false
665
+ };
666
+ /**
667
+ * Sets a new string value at the given path in a JSON or JSONC string.
668
+ * @param jsonc the JSON or JSONC string (the contents of a file)
669
+ * @param jsonPath path to the value to set, as an array of segments
670
+ * @param newString string to set the value to
671
+ * @returns the JSON or JSONC string with the value set
672
+ */
673
+ setStringInJsonc(jsonc, jsonPath, newString) {
674
+ const edits = modify(jsonc, jsonPath, newString, {});
675
+ return applyEdits(jsonc, edits);
676
+ }
666
677
  read(fileName) {
667
678
  const filePath = resolve(this.config.path, fileName);
668
679
  if (fileExists(filePath)) {
669
680
  const fileContents = readFileSync(filePath, "utf8");
670
681
  const parseErrors = [];
671
- const parsedJson = parse$1(fileContents, parseErrors, PARSE_OPTIONS);
682
+ const parsedJson = parse$1(fileContents, parseErrors, this.PARSE_OPTIONS);
672
683
  if (parseErrors.length) {
673
684
  this.logger.warn(`[File Manager] Unable to parse JSON: ${fileName}`, parseErrors);
674
685
  return void 0;
@@ -687,14 +698,14 @@ var JSONPackage = class {
687
698
  write(fileState, newVersion) {
688
699
  let fileContents = readFileSync(fileState.path, "utf8");
689
700
  const parseErrors = [];
690
- const parsedJson = parse$1(fileContents, parseErrors, PARSE_OPTIONS);
701
+ const parsedJson = parse$1(fileContents, parseErrors, this.PARSE_OPTIONS);
691
702
  if (parseErrors.length) {
692
703
  this.logger.warn(`[File Manager] Unable to parse JSON: ${fileState.path}`, parseErrors);
693
704
  return;
694
705
  }
695
- fileContents = setStringInJsonc(fileContents, ["version"], newVersion);
706
+ fileContents = this.setStringInJsonc(fileContents, ["version"], newVersion);
696
707
  if (parsedJson?.packages?.[""]) {
697
- fileContents = setStringInJsonc(fileContents, ["packages", "", "version"], newVersion);
708
+ fileContents = this.setStringInJsonc(fileContents, ["packages", "", "version"], newVersion);
698
709
  }
699
710
  writeFileSync(fileState.path, fileContents, "utf8");
700
711
  }
@@ -702,10 +713,6 @@ var JSONPackage = class {
702
713
  return fileName.endsWith(".json") || fileName.endsWith(".jsonc");
703
714
  }
704
715
  };
705
- function setStringInJsonc(jsonc, jsonPath, newString) {
706
- const edits = modify(jsonc, jsonPath, newString, {});
707
- return applyEdits(jsonc, edits);
708
- }
709
716
  var YAMLPackage = class {
710
717
  constructor(config, logger) {
711
718
  this.config = config;
@@ -824,7 +831,7 @@ var MSBuildProject = class {
824
831
  }
825
832
  };
826
833
 
827
- // src/strategies/file-manager.ts
834
+ // src/files/file-manager.ts
828
835
  var FileManager = class {
829
836
  constructor(config, logger) {
830
837
  this.config = config;
@@ -898,25 +905,11 @@ var FileManager = class {
898
905
  this.logger.error(`[File Manager] Unsupported file: ${fileState.path}`);
899
906
  }
900
907
  };
901
- async function getLatestGitTagVersion(tagPrefix) {
902
- const gitTags = await gitSemverTags({ tagPrefix });
903
- if (!gitTags.length) {
904
- return "";
905
- }
906
- const cleanedTags = [];
907
- for (const tag of gitTags) {
908
- const cleanedTag = semver3.clean(tag.replace(new RegExp(`^${tagPrefix}`), ""));
909
- if (cleanedTag) {
910
- cleanedTags.push(cleanedTag);
911
- }
912
- }
913
- return cleanedTags.sort(semver3.rcompare)[0];
914
- }
915
908
  function getPriority(type) {
916
909
  return ["patch", "minor", "major"].indexOf(type ?? "");
917
910
  }
918
911
  function getVersionType(version) {
919
- const parseVersion = semver3.parse(version);
912
+ const parseVersion = semver2.parse(version);
920
913
  if (parseVersion?.major) {
921
914
  return "major";
922
915
  } else if (parseVersion?.minor) {
@@ -930,7 +923,7 @@ function getReleaseType(releaseType, currentVersion, preReleaseTag) {
930
923
  if (!preReleaseTag) {
931
924
  return releaseType;
932
925
  }
933
- const currentVersionsIsPreRelease = Array.isArray(semver3.prerelease(currentVersion));
926
+ const currentVersionsIsPreRelease = Array.isArray(semver2.prerelease(currentVersion));
934
927
  if (currentVersionsIsPreRelease) {
935
928
  const currentReleaseType = getVersionType(currentVersion);
936
929
  if (currentReleaseType === releaseType || getPriority(currentReleaseType) > getPriority(releaseType)) {
@@ -945,7 +938,7 @@ async function getCurrentVersion(config, logger, git, fileManager, filesToUpdate
945
938
  const files = [];
946
939
  const versions = /* @__PURE__ */ new Set();
947
940
  for (const file of filesToUpdate) {
948
- if (await git.shouldIgnore(file)) {
941
+ if (await git.isIgnored(file)) {
949
942
  logger.debug(`[Git Ignored] ${file}`);
950
943
  continue;
951
944
  }
@@ -961,9 +954,9 @@ async function getCurrentVersion(config, logger, git, fileManager, filesToUpdate
961
954
  versions.add(config.currentVersion);
962
955
  }
963
956
  if (versions.size === 0 && config.gitTagFallback) {
964
- const version = await getLatestGitTagVersion(config.tagPrefix);
957
+ const version = await git.getLatestTag(config.tagPrefix);
965
958
  if (version) {
966
- logger.warn(`Using latest git tag fallback`);
959
+ logger.warn(`Using latest git tag as fallback`);
967
960
  versions.add(version);
968
961
  }
969
962
  }
@@ -977,7 +970,7 @@ async function getCurrentVersion(config, logger, git, fileManager, filesToUpdate
977
970
  `Found multiple versions (${Array.from(versions).join(", ")}), using the higher semver version`
978
971
  );
979
972
  }
980
- const currentVersion = semver3.rsort(Array.from(versions))[0];
973
+ const currentVersion = semver2.rsort(Array.from(versions))[0];
981
974
  if (config.inspectVersion) {
982
975
  console.log(currentVersion);
983
976
  process.exit(0);
@@ -995,13 +988,13 @@ async function getNextVersion(config, logger, currentVersion) {
995
988
  version: currentVersion
996
989
  };
997
990
  }
998
- if (config.nextVersion && semver3.valid(config.nextVersion)) {
991
+ if (config.nextVersion && semver2.valid(config.nextVersion)) {
999
992
  logger.log(`Next version: ${config.nextVersion}`);
1000
993
  return {
1001
994
  version: config.nextVersion
1002
995
  };
1003
996
  }
1004
- const isPreMajor = semver3.lt(currentVersion, "1.0.0");
997
+ const isPreMajor = semver2.lt(currentVersion, "1.0.0");
1005
998
  let recommendedBump;
1006
999
  if (config.releaseAs) {
1007
1000
  recommendedBump = {
@@ -1033,7 +1026,7 @@ async function getNextVersion(config, logger, currentVersion) {
1033
1026
  currentVersion,
1034
1027
  config.preRelease
1035
1028
  );
1036
- const nextVersion = semver3.inc(
1029
+ const nextVersion = semver2.inc(
1037
1030
  currentVersion,
1038
1031
  releaseType,
1039
1032
  typeof config.preRelease === "string" ? config.preRelease : void 0
@@ -1098,10 +1091,10 @@ async function updateChangelog(config, logger, nextVersion) {
1098
1091
  }
1099
1092
  const changelogPath = resolve(config.path, config.changelog);
1100
1093
  if (!config.dryRun && !fileExists(changelogPath)) {
1101
- logger.log(`Creating Changelog: ${changelogPath}`);
1094
+ logger.log(`Creating changelog: ${changelogPath}`);
1102
1095
  writeFileSync(changelogPath, "\n", "utf8");
1103
1096
  } else {
1104
- logger.log(`Updating Changelog: ${changelogPath}`);
1097
+ logger.log(`Updating changelog: ${changelogPath}`);
1105
1098
  }
1106
1099
  const oldContent = getOldReleaseContent(changelogPath, fileExists(changelogPath));
1107
1100
  const newContent = await getNewReleaseContent(config, logger, nextVersion);
@@ -1164,7 +1157,7 @@ async function tagChanges(config, logger, git, nextVersion) {
1164
1157
  return;
1165
1158
  }
1166
1159
  const tag = `${config.tagPrefix}${nextVersion}`;
1167
- logger.log(`Creating Tag: ${tag}`);
1160
+ logger.log(`Creating tag: ${tag}`);
1168
1161
  await git.tag(
1169
1162
  config.sign ? "--sign" : "--annotate",
1170
1163
  tag,
@@ -1174,5 +1167,5 @@ async function tagChanges(config, logger, git, nextVersion) {
1174
1167
  }
1175
1168
 
1176
1169
  export { FileManager, ForkConfigSchema, Logger, commitChanges, defineConfig, getCurrentVersion, getNextVersion, getUserConfig, tagChanges, updateChangelog };
1177
- //# sourceMappingURL=chunk-XSSJMFKD.js.map
1178
- //# sourceMappingURL=chunk-XSSJMFKD.js.map
1170
+ //# sourceMappingURL=chunk-4M7BP5DG.js.map
1171
+ //# sourceMappingURL=chunk-4M7BP5DG.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/files/json-package.ts","../src/files/yaml-package.ts","../src/files/plain-text.ts","../src/files/ms-build-project.ts","../src/files/file-manager.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,EAIxE,SAAS,CACP,CAAA,MAAA,GACA,QAAS,EAAA,CACT,SAAS,8DAA8D,CAAA;AAAA;AAAA;AAAA;AAAA,EAIzE,QAAQ,CAAE,CAAA,OAAA,GAAU,QAAS,EA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";\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\nExit Codes:\n 0: Success\n 1: General Error\n 3: Config File Validation Error\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 new Error(`Validation error in: ${configFilePath}`, { cause: 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 new Error(`Validation error in: ${configFilePath}`, { cause: 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 new Error(`Validation error in: ${configFilePath}`, { cause: 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 \"node: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 JSONPath,\n\tmodify,\n\tparse,\n\ttype ParseError,\n\ttype ParseOptions,\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/**\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\t/** Options for parsing JSON and JSONC files. */\n\tprivate PARSE_OPTIONS: ParseOptions = {\n\t\tallowEmptyContent: false,\n\t\tallowTrailingComma: true,\n\t\tdisallowComments: false,\n\t};\n\n\t/**\n\t * Sets a new string value at the given path in a JSON or JSONC string.\n\t * @param jsonc the JSON or JSONC string (the contents of a file)\n\t * @param jsonPath path to the value to set, as an array of segments\n\t * @param newString string to set the value to\n\t * @returns the JSON or JSONC string with the value set\n\t */\n\tprivate setStringInJsonc(jsonc: string, jsonPath: JSONPath, newString: string): string {\n\t\tconst edits = modify(jsonc, jsonPath, newString, {});\n\t\treturn applyEdits(jsonc, edits);\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\tconst parseErrors: ParseError[] = [];\n\t\t\tconst parsedJson: PackageJsonish = parse(fileContents, parseErrors, this.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 version: ${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, this.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 = this.setStringInJsonc(fileContents, [\"version\"], newVersion);\n\t\tif (parsedJson?.packages?.[\"\"]) {\n\t\t\t// package-lock v2 stores version here too.\n\t\t\tfileContents = this.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","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 yaml version: ${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 version: ${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 version: ${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 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 { getReleaseType } from \"../utils/release-type\";\nimport type { ForkConfig } from \"../config/types\";\nimport type { FileManager, FileState } from \"../files/file-manager\";\nimport type { Logger } from \"../utils/logger\";\nimport type { Git } from \"../utils/git\";\n\nexport interface CurrentVersion {\n\tversion: string;\n\tfiles: FileState[];\n}\n\nexport async function getCurrentVersion(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tgit: Git,\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\tif (await git.isIgnored(file)) {\n\t\t\tlogger.debug(`[Git Ignored] ${file}`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst fileState = fileManager.read(file);\n\t\tif (fileState) {\n\t\t\tfiles.push(fileState);\n\n\t\t\tif (!config.currentVersion) {\n\t\t\t\tversions.add(fileState.version);\n\t\t\t}\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 git.getLatestTag(config.tagPrefix);\n\t\tif (version) {\n\t\t\tlogger.warn(`Using latest git tag as 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(\n\t\t\t`Found multiple versions (${Array.from(versions).join(\", \")}), using the higher semver version`,\n\t\t);\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.warn(`Skip bump, using ${currentVersion} as the 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\tif (config.releaseAs) {\n\t\trecommendedBump = {\n\t\t\treleaseType: config.releaseAs,\n\t\t\tlevel: -1,\n\t\t\treason: \"User defined\",\n\t\t};\n\t} else {\n\t\ttry {\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} catch (cause) {\n\t\t\tthrow new Error(`[conventional-recommended-bump] Unable to determine next version`, {\n\t\t\t\tcause,\n\t\t\t});\n\t\t}\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\t\tconst nextVersion =\n\t\t\tsemver.inc(\n\t\t\t\tcurrentVersion,\n\t\t\t\treleaseType,\n\t\t\t\ttypeof config.preRelease === \"string\" ? config.preRelease : undefined,\n\t\t\t) ?? \"\";\n\n\t\tlogger.log(`Next version: ${nextVersion} (${releaseType})`);\n\t\treturn {\n\t\t\t...recommendedBump,\n\t\t\tpreMajor: isPreMajor,\n\t\t\treleaseType,\n\t\t\tversion: nextVersion,\n\t\t};\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\", (cause) => {\n\t\t\t\tthrow new Error(\"[conventional-changelog] Unable to parse changes\", { cause });\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.warn(\"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\n\tif (!config.dryRun && !fileExists(changelogPath)) {\n\t\tlogger.log(`Creating changelog: ${changelogPath}`);\n\t\twriteFileSync(changelogPath, \"\\n\", \"utf8\");\n\t} else {\n\t\tlogger.log(`Updating changelog: ${changelogPath}`);\n\t}\n\n\tconst oldContent = getOldReleaseContent(changelogPath, fileExists(changelogPath));\n\tconst newContent = await getNewReleaseContent(config, logger, nextVersion);\n\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 \"../files/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.warn(\"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.warn(\"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"]}