fork-version 1.7.0 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +28 -3
- package/dist/{chunk-U3KD6MC3.cjs → chunk-PKSCXRF2.cjs} +55 -44
- package/dist/chunk-PKSCXRF2.cjs.map +1 -0
- package/dist/{chunk-D7324DNL.js → chunk-XSSJMFKD.js} +55 -45
- package/dist/chunk-XSSJMFKD.js.map +1 -0
- package/dist/cli.cjs +49 -39
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +42 -32
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +11 -11
- package/dist/index.d.cts +12 -13
- package/dist/index.d.ts +12 -13
- package/dist/index.js +1 -1
- package/package.json +13 -12
- package/dist/chunk-D7324DNL.js.map +0 -1
- package/dist/chunk-U3KD6MC3.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { readFileSync, writeFileSync, lstatSync } from 'node:fs';
|
|
3
3
|
import { resolve, parse } from 'node:path';
|
|
4
4
|
import JoyCon from 'joycon';
|
|
5
5
|
import { bundleRequire } from 'bundle-require';
|
|
@@ -8,7 +8,6 @@ import meow from 'meow';
|
|
|
8
8
|
import conventionalChangelogConfigSpec from 'conventional-changelog-config-spec';
|
|
9
9
|
import { execFile } from 'node:child_process';
|
|
10
10
|
import { parse as parse$1, modify, applyEdits } from 'jsonc-parser';
|
|
11
|
-
import { lstatSync } from 'fs';
|
|
12
11
|
import { parse as parse$2, parseDocument } from 'yaml';
|
|
13
12
|
import * as cheerio from 'cheerio/slim';
|
|
14
13
|
import semver3 from 'semver';
|
|
@@ -359,6 +358,11 @@ Conventional Changelog Overrides:
|
|
|
359
358
|
--release-commit-message-format Override the default release commit message format.
|
|
360
359
|
--release-message-suffix Add a suffix to the end of the release message.
|
|
361
360
|
|
|
361
|
+
Exit Codes:
|
|
362
|
+
0: Success
|
|
363
|
+
1: General Error
|
|
364
|
+
3: Config File Validation Error
|
|
365
|
+
|
|
362
366
|
Examples:
|
|
363
367
|
$ fork-version
|
|
364
368
|
Run fork-version in the current directory with default options.
|
|
@@ -571,7 +575,7 @@ async function loadConfigFile(configFilePath) {
|
|
|
571
575
|
if (fileContent2[PACKAGE_JSON_CONFIG_KEY] && typeof fileContent2[PACKAGE_JSON_CONFIG_KEY] === "object") {
|
|
572
576
|
const parsed3 = ForkConfigSchema.partial().safeParse(fileContent2[PACKAGE_JSON_CONFIG_KEY]);
|
|
573
577
|
if (!parsed3.success) {
|
|
574
|
-
throw parsed3.error;
|
|
578
|
+
throw new Error(`Validation error in: ${configFilePath}`, { cause: parsed3.error });
|
|
575
579
|
}
|
|
576
580
|
return parsed3.data;
|
|
577
581
|
}
|
|
@@ -579,14 +583,14 @@ async function loadConfigFile(configFilePath) {
|
|
|
579
583
|
}
|
|
580
584
|
const parsed2 = ForkConfigSchema.partial().safeParse(fileContent2);
|
|
581
585
|
if (!parsed2.success) {
|
|
582
|
-
throw parsed2.error;
|
|
586
|
+
throw new Error(`Validation error in: ${configFilePath}`, { cause: parsed2.error });
|
|
583
587
|
}
|
|
584
588
|
return parsed2.data;
|
|
585
589
|
}
|
|
586
590
|
const fileContent = await bundleRequire({ filepath: configFilePath });
|
|
587
591
|
const parsed = ForkConfigSchema.partial().safeParse(fileContent.mod.default || fileContent.mod);
|
|
588
592
|
if (!parsed.success) {
|
|
589
|
-
throw parsed.error;
|
|
593
|
+
throw new Error(`Validation error in: ${configFilePath}`, { cause: parsed.error });
|
|
590
594
|
}
|
|
591
595
|
return parsed.data;
|
|
592
596
|
}
|
|
@@ -677,7 +681,7 @@ var JSONPackage = class {
|
|
|
677
681
|
isPrivate: typeof parsedJson?.private === "boolean" ? parsedJson.private : true
|
|
678
682
|
};
|
|
679
683
|
}
|
|
680
|
-
this.logger.warn(`[File Manager] Unable to determine json
|
|
684
|
+
this.logger.warn(`[File Manager] Unable to determine json version: ${fileName}`);
|
|
681
685
|
}
|
|
682
686
|
}
|
|
683
687
|
write(fileState, newVersion) {
|
|
@@ -739,7 +743,7 @@ var YAMLPackage = class {
|
|
|
739
743
|
};
|
|
740
744
|
}
|
|
741
745
|
}
|
|
742
|
-
this.logger.warn(`[File Manager] Unable to determine
|
|
746
|
+
this.logger.warn(`[File Manager] Unable to determine yaml version: ${fileName}`);
|
|
743
747
|
}
|
|
744
748
|
write(fileState, newVersion) {
|
|
745
749
|
const fileContents = readFileSync(fileState.path, "utf8");
|
|
@@ -770,7 +774,7 @@ var PlainText = class {
|
|
|
770
774
|
version: fileContents || ""
|
|
771
775
|
};
|
|
772
776
|
}
|
|
773
|
-
this.logger.warn(`[File Manager] Unable to determine plain text: ${fileName}`);
|
|
777
|
+
this.logger.warn(`[File Manager] Unable to determine plain text version: ${fileName}`);
|
|
774
778
|
}
|
|
775
779
|
write(fileState, newVersion) {
|
|
776
780
|
writeFileSync(fileState.path, newVersion, "utf8");
|
|
@@ -800,7 +804,7 @@ var MSBuildProject = class {
|
|
|
800
804
|
version
|
|
801
805
|
};
|
|
802
806
|
}
|
|
803
|
-
this.logger.warn(`[File Manager] Unable to determine ms-build
|
|
807
|
+
this.logger.warn(`[File Manager] Unable to determine ms-build version: ${fileName}`);
|
|
804
808
|
}
|
|
805
809
|
}
|
|
806
810
|
write(fileState, newVersion) {
|
|
@@ -937,17 +941,20 @@ function getReleaseType(releaseType, currentVersion, preReleaseTag) {
|
|
|
937
941
|
}
|
|
938
942
|
|
|
939
943
|
// src/process/version.ts
|
|
940
|
-
async function getCurrentVersion(config, logger, fileManager, filesToUpdate) {
|
|
944
|
+
async function getCurrentVersion(config, logger, git, fileManager, filesToUpdate) {
|
|
941
945
|
const files = [];
|
|
942
946
|
const versions = /* @__PURE__ */ new Set();
|
|
943
947
|
for (const file of filesToUpdate) {
|
|
948
|
+
if (await git.shouldIgnore(file)) {
|
|
949
|
+
logger.debug(`[Git Ignored] ${file}`);
|
|
950
|
+
continue;
|
|
951
|
+
}
|
|
944
952
|
const fileState = fileManager.read(file);
|
|
945
953
|
if (fileState) {
|
|
946
954
|
files.push(fileState);
|
|
947
|
-
if (config.currentVersion) {
|
|
948
|
-
|
|
955
|
+
if (!config.currentVersion) {
|
|
956
|
+
versions.add(fileState.version);
|
|
949
957
|
}
|
|
950
|
-
versions.add(fileState.version);
|
|
951
958
|
}
|
|
952
959
|
}
|
|
953
960
|
if (config.currentVersion) {
|
|
@@ -956,7 +963,7 @@ async function getCurrentVersion(config, logger, fileManager, filesToUpdate) {
|
|
|
956
963
|
if (versions.size === 0 && config.gitTagFallback) {
|
|
957
964
|
const version = await getLatestGitTagVersion(config.tagPrefix);
|
|
958
965
|
if (version) {
|
|
959
|
-
logger.
|
|
966
|
+
logger.warn(`Using latest git tag fallback`);
|
|
960
967
|
versions.add(version);
|
|
961
968
|
}
|
|
962
969
|
}
|
|
@@ -966,8 +973,9 @@ async function getCurrentVersion(config, logger, fileManager, filesToUpdate) {
|
|
|
966
973
|
if (!config.allowMultipleVersions) {
|
|
967
974
|
throw new Error("Found multiple versions");
|
|
968
975
|
}
|
|
969
|
-
logger.warn(
|
|
970
|
-
|
|
976
|
+
logger.warn(
|
|
977
|
+
`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
981
|
if (config.inspectVersion) {
|
|
@@ -982,7 +990,7 @@ async function getCurrentVersion(config, logger, fileManager, filesToUpdate) {
|
|
|
982
990
|
}
|
|
983
991
|
async function getNextVersion(config, logger, currentVersion) {
|
|
984
992
|
if (config.skipBump) {
|
|
985
|
-
logger.
|
|
993
|
+
logger.warn(`Skip bump, using ${currentVersion} as the next version`);
|
|
986
994
|
return {
|
|
987
995
|
version: currentVersion
|
|
988
996
|
};
|
|
@@ -995,14 +1003,14 @@ async function getNextVersion(config, logger, currentVersion) {
|
|
|
995
1003
|
}
|
|
996
1004
|
const isPreMajor = semver3.lt(currentVersion, "1.0.0");
|
|
997
1005
|
let recommendedBump;
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
+
if (config.releaseAs) {
|
|
1007
|
+
recommendedBump = {
|
|
1008
|
+
releaseType: config.releaseAs,
|
|
1009
|
+
level: -1,
|
|
1010
|
+
reason: "User defined"
|
|
1011
|
+
};
|
|
1012
|
+
} else {
|
|
1013
|
+
try {
|
|
1006
1014
|
recommendedBump = await conventionalRecommendedBump({
|
|
1007
1015
|
preset: {
|
|
1008
1016
|
name: "conventionalcommits",
|
|
@@ -1013,9 +1021,11 @@ async function getNextVersion(config, logger, currentVersion) {
|
|
|
1013
1021
|
tagPrefix: config.tagPrefix,
|
|
1014
1022
|
cwd: config.path
|
|
1015
1023
|
});
|
|
1024
|
+
} catch (cause) {
|
|
1025
|
+
throw new Error(`[conventional-recommended-bump] Unable to determine next version`, {
|
|
1026
|
+
cause
|
|
1027
|
+
});
|
|
1016
1028
|
}
|
|
1017
|
-
} catch (_error) {
|
|
1018
|
-
throw new Error(`[conventional-recommended-bump] Unable to determine next version`);
|
|
1019
1029
|
}
|
|
1020
1030
|
if (recommendedBump.releaseType) {
|
|
1021
1031
|
const releaseType = getReleaseType(
|
|
@@ -1023,18 +1033,18 @@ async function getNextVersion(config, logger, currentVersion) {
|
|
|
1023
1033
|
currentVersion,
|
|
1024
1034
|
config.preRelease
|
|
1025
1035
|
);
|
|
1026
|
-
const
|
|
1036
|
+
const nextVersion = semver3.inc(
|
|
1037
|
+
currentVersion,
|
|
1038
|
+
releaseType,
|
|
1039
|
+
typeof config.preRelease === "string" ? config.preRelease : void 0
|
|
1040
|
+
) ?? "";
|
|
1041
|
+
logger.log(`Next version: ${nextVersion} (${releaseType})`);
|
|
1042
|
+
return {
|
|
1027
1043
|
...recommendedBump,
|
|
1028
1044
|
preMajor: isPreMajor,
|
|
1029
1045
|
releaseType,
|
|
1030
|
-
version:
|
|
1031
|
-
currentVersion,
|
|
1032
|
-
releaseType,
|
|
1033
|
-
typeof config.preRelease === "string" ? config.preRelease : void 0
|
|
1034
|
-
) ?? ""
|
|
1046
|
+
version: nextVersion
|
|
1035
1047
|
};
|
|
1036
|
-
logger.log(`Next version: ${state.version} (${state.releaseType})`);
|
|
1037
|
-
return state;
|
|
1038
1048
|
}
|
|
1039
1049
|
throw new Error("Unable to find next version");
|
|
1040
1050
|
}
|
|
@@ -1069,9 +1079,8 @@ function getNewReleaseContent(config, logger, nextVersion) {
|
|
|
1069
1079
|
merges: null,
|
|
1070
1080
|
path: config.path
|
|
1071
1081
|
}
|
|
1072
|
-
).on("error", (
|
|
1073
|
-
|
|
1074
|
-
throw error;
|
|
1082
|
+
).on("error", (cause) => {
|
|
1083
|
+
throw new Error("[conventional-changelog] Unable to parse changes", { cause });
|
|
1075
1084
|
}).on("data", (chunk) => {
|
|
1076
1085
|
newContent += chunk.toString();
|
|
1077
1086
|
}).on("end", () => {
|
|
@@ -1081,7 +1090,7 @@ function getNewReleaseContent(config, logger, nextVersion) {
|
|
|
1081
1090
|
}
|
|
1082
1091
|
async function updateChangelog(config, logger, nextVersion) {
|
|
1083
1092
|
if (config.skipChangelog) {
|
|
1084
|
-
logger.
|
|
1093
|
+
logger.warn("Skip changelog update");
|
|
1085
1094
|
return;
|
|
1086
1095
|
}
|
|
1087
1096
|
if (config.header.search(RELEASE_PATTERN) !== -1) {
|
|
@@ -1089,12 +1098,13 @@ async function updateChangelog(config, logger, nextVersion) {
|
|
|
1089
1098
|
}
|
|
1090
1099
|
const changelogPath = resolve(config.path, config.changelog);
|
|
1091
1100
|
if (!config.dryRun && !fileExists(changelogPath)) {
|
|
1092
|
-
logger.log(`Creating Changelog
|
|
1101
|
+
logger.log(`Creating Changelog: ${changelogPath}`);
|
|
1093
1102
|
writeFileSync(changelogPath, "\n", "utf8");
|
|
1103
|
+
} else {
|
|
1104
|
+
logger.log(`Updating Changelog: ${changelogPath}`);
|
|
1094
1105
|
}
|
|
1095
1106
|
const oldContent = getOldReleaseContent(changelogPath, fileExists(changelogPath));
|
|
1096
1107
|
const newContent = await getNewReleaseContent(config, logger, nextVersion);
|
|
1097
|
-
logger.log(`Updating Changelog: ${changelogPath}`);
|
|
1098
1108
|
if (!config.dryRun && newContent) {
|
|
1099
1109
|
writeFileSync(
|
|
1100
1110
|
changelogPath,
|
|
@@ -1118,7 +1128,7 @@ function formatCommitMessage(message, version) {
|
|
|
1118
1128
|
// src/process/commit.ts
|
|
1119
1129
|
async function commitChanges(config, logger, git, files, nextVersion) {
|
|
1120
1130
|
if (config.skipCommit) {
|
|
1121
|
-
logger.
|
|
1131
|
+
logger.warn("Skip commit");
|
|
1122
1132
|
return;
|
|
1123
1133
|
}
|
|
1124
1134
|
logger.log("Committing changes");
|
|
@@ -1150,7 +1160,7 @@ async function commitChanges(config, logger, git, files, nextVersion) {
|
|
|
1150
1160
|
// src/process/tag.ts
|
|
1151
1161
|
async function tagChanges(config, logger, git, nextVersion) {
|
|
1152
1162
|
if (config.skipTag) {
|
|
1153
|
-
logger.
|
|
1163
|
+
logger.warn("Skip tag creation");
|
|
1154
1164
|
return;
|
|
1155
1165
|
}
|
|
1156
1166
|
const tag = `${config.tagPrefix}${nextVersion}`;
|
|
@@ -1164,5 +1174,5 @@ async function tagChanges(config, logger, git, nextVersion) {
|
|
|
1164
1174
|
}
|
|
1165
1175
|
|
|
1166
1176
|
export { FileManager, ForkConfigSchema, Logger, commitChanges, defineConfig, getCurrentVersion, getNextVersion, getUserConfig, tagChanges, updateChangelog };
|
|
1167
|
-
//# sourceMappingURL=chunk-
|
|
1168
|
-
//# sourceMappingURL=chunk-
|
|
1177
|
+
//# sourceMappingURL=chunk-XSSJMFKD.js.map
|
|
1178
|
+
//# sourceMappingURL=chunk-XSSJMFKD.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,EAIxE,SAAS,CACP,CAAA,MAAA,GACA,QAAS,EAAA,CACT,SAAS,8DAA8D,CAAA;AAAA;AAAA;AAAA;AAAA,EAIzE,QAAQ,CAAE,CAAA,OAAA,GAAU,QAAS,EAAA,CAAE,SAAS,iDAAiD;AAC1F,CAAC,CAAA;AAEM,IAAM,2BAAA,GAA8B,EAAE,MAAO,CAAA;AAAA;AAAA;AAAA;AAAA,EAInD,OAAO,CACL,CAAA,KAAA,CAAM,+BAA+B,CAAA,CACrC,SAAS,oDAAoD,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAK/D,eAAiB,EAAA,CAAA,CAAE,MAAO,EAAA,CAAE,SAAS,iDAAiD,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtF,gBAAkB,EAAA,CAAA,CAAE,MAAO,EAAA,CAAE,SAAS,yDAAyD,CAAA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B,CAAA,MAAA,CAAO,qBAAuB,EAAA,0BAAA,EAA4B,WAAW;AAAA,GAC1F;AACD","file":"chunk-XSSJMFKD.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\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 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 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, 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 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 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\";\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.shouldIgnore(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 getLatestGitTagVersion(config.tagPrefix);\n\t\tif (version) {\n\t\t\tlogger.warn(`Using latest 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(\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 \"../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.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"]}
|
package/dist/cli.cjs
CHANGED
|
@@ -1,53 +1,51 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkPKSCXRF2_cjs = require('./chunk-PKSCXRF2.cjs');
|
|
5
5
|
var fs = require('fs');
|
|
6
6
|
var path = require('path');
|
|
7
|
+
var zod = require('zod');
|
|
7
8
|
var child_process = require('child_process');
|
|
8
9
|
|
|
9
10
|
var Git = class {
|
|
10
|
-
constructor(config
|
|
11
|
+
constructor(config) {
|
|
11
12
|
this.config = config;
|
|
12
|
-
this.logger = logger;
|
|
13
13
|
this.add = this.add.bind(this);
|
|
14
14
|
this.commit = this.commit.bind(this);
|
|
15
15
|
this.tag = this.tag.bind(this);
|
|
16
|
+
this.shouldIgnore = this.shouldIgnore.bind(this);
|
|
16
17
|
this.currentBranch = this.currentBranch.bind(this);
|
|
17
18
|
}
|
|
18
|
-
add(...args) {
|
|
19
|
+
async add(...args) {
|
|
19
20
|
if (this.config.dryRun) {
|
|
20
|
-
return
|
|
21
|
+
return "";
|
|
21
22
|
}
|
|
22
23
|
return this.execGit("add", args.filter(Boolean));
|
|
23
24
|
}
|
|
24
|
-
commit(...args) {
|
|
25
|
+
async commit(...args) {
|
|
25
26
|
if (this.config.dryRun) {
|
|
26
|
-
return
|
|
27
|
+
return "";
|
|
27
28
|
}
|
|
28
29
|
return this.execGit("commit", args.filter(Boolean));
|
|
29
30
|
}
|
|
30
|
-
tag(...args) {
|
|
31
|
+
async tag(...args) {
|
|
31
32
|
if (this.config.dryRun) {
|
|
32
|
-
return
|
|
33
|
+
return "";
|
|
33
34
|
}
|
|
34
35
|
return this.execGit("tag", args.filter(Boolean));
|
|
35
36
|
}
|
|
36
|
-
shouldIgnore(file) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
});
|
|
44
|
-
});
|
|
37
|
+
async shouldIgnore(file) {
|
|
38
|
+
try {
|
|
39
|
+
await this.execGit("check-ignore", ["--no-index", file]);
|
|
40
|
+
return true;
|
|
41
|
+
} catch (_error) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
45
44
|
}
|
|
46
45
|
async currentBranch() {
|
|
47
46
|
return (await this.execGit("rev-parse", ["--abbrev-ref", "HEAD"])).trim();
|
|
48
47
|
}
|
|
49
|
-
execGit(command, args) {
|
|
50
|
-
this.logger.debug(`[git ${command}] ${args.join(" ")}`);
|
|
48
|
+
async execGit(command, args) {
|
|
51
49
|
return new Promise((onResolve, onReject) => {
|
|
52
50
|
child_process.execFile(
|
|
53
51
|
"git",
|
|
@@ -57,10 +55,10 @@ var Git = class {
|
|
|
57
55
|
},
|
|
58
56
|
(error, stdout, stderr) => {
|
|
59
57
|
if (error) {
|
|
60
|
-
this.logger.error(`[git ${command}] `);
|
|
61
58
|
onReject(error);
|
|
59
|
+
} else {
|
|
60
|
+
onResolve(stdout ? stdout : stderr);
|
|
62
61
|
}
|
|
63
|
-
onResolve(stdout ? stdout : stderr);
|
|
64
62
|
}
|
|
65
63
|
);
|
|
66
64
|
});
|
|
@@ -70,28 +68,22 @@ var Git = class {
|
|
|
70
68
|
// src/cli.ts
|
|
71
69
|
async function runFork() {
|
|
72
70
|
const startTime = Date.now();
|
|
73
|
-
const config = await
|
|
74
|
-
const logger = new
|
|
75
|
-
const fileManager = new
|
|
76
|
-
const git = new Git(config
|
|
71
|
+
const config = await chunkPKSCXRF2_cjs.getUserConfig();
|
|
72
|
+
const logger = new chunkPKSCXRF2_cjs.Logger(config);
|
|
73
|
+
const fileManager = new chunkPKSCXRF2_cjs.FileManager(config, logger);
|
|
74
|
+
const git = new Git(config);
|
|
77
75
|
logger.log(`Running fork-version - ${(/* @__PURE__ */ new Date()).toUTCString()}`);
|
|
78
|
-
logger.
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
if (!await git.shouldIgnore(file)) {
|
|
82
|
-
filesToUpdate.push(file);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
const current = await chunkU3KD6MC3_cjs.getCurrentVersion(config, logger, fileManager, filesToUpdate);
|
|
86
|
-
const next = await chunkU3KD6MC3_cjs.getNextVersion(config, logger, current.version);
|
|
76
|
+
logger.warn(config.dryRun ? "[Dry Run] No changes will be written to disk.\n" : "");
|
|
77
|
+
const current = await chunkPKSCXRF2_cjs.getCurrentVersion(config, logger, git, fileManager, config.files);
|
|
78
|
+
const next = await chunkPKSCXRF2_cjs.getNextVersion(config, logger, current.version);
|
|
87
79
|
logger.log("Updating Files: ");
|
|
88
80
|
for (const outFile of current.files) {
|
|
89
81
|
logger.log(` - ${outFile.path}`);
|
|
90
82
|
fileManager.write(outFile, next.version);
|
|
91
83
|
}
|
|
92
|
-
await
|
|
93
|
-
await
|
|
94
|
-
await
|
|
84
|
+
await chunkPKSCXRF2_cjs.updateChangelog(config, logger, next.version);
|
|
85
|
+
await chunkPKSCXRF2_cjs.commitChanges(config, logger, git, current.files, next.version);
|
|
86
|
+
await chunkPKSCXRF2_cjs.tagChanges(config, logger, git, next.version);
|
|
95
87
|
const branchName = await git.currentBranch();
|
|
96
88
|
logger.log(
|
|
97
89
|
`
|
|
@@ -117,6 +109,24 @@ Run \`git push --follow-tags origin ${branchName}\` to push the changes and the
|
|
|
117
109
|
}
|
|
118
110
|
return result;
|
|
119
111
|
}
|
|
120
|
-
runFork()
|
|
112
|
+
runFork().catch((error) => {
|
|
113
|
+
if (error instanceof Error) {
|
|
114
|
+
if (error.cause instanceof zod.ZodError) {
|
|
115
|
+
console.error(error.message);
|
|
116
|
+
for (const err of error.cause.errors) {
|
|
117
|
+
console.log(`${err.path} => ${err.message}`);
|
|
118
|
+
}
|
|
119
|
+
process.exit(3);
|
|
120
|
+
}
|
|
121
|
+
if (error.stack) {
|
|
122
|
+
console.error(error.stack);
|
|
123
|
+
} else {
|
|
124
|
+
console.error(error.message);
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
console.error(error);
|
|
128
|
+
}
|
|
129
|
+
process.exit(1);
|
|
130
|
+
});
|
|
121
131
|
//# sourceMappingURL=cli.cjs.map
|
|
122
132
|
//# sourceMappingURL=cli.cjs.map
|