fork-version 4.1.0 → 4.1.4
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 +37 -0
- package/dist/{chunk-DB3R2W4M.cjs → chunk-CISRFIID.cjs} +195 -219
- package/dist/chunk-CISRFIID.cjs.map +1 -0
- package/dist/{chunk-YMZ6L6ML.js → chunk-I76EAKJC.js} +196 -220
- package/dist/chunk-I76EAKJC.js.map +1 -0
- package/dist/cli.cjs +10 -10
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +19 -19
- package/dist/index.d.cts +9 -13
- package/dist/index.d.ts +9 -13
- package/dist/index.js +1 -1
- package/package.json +1 -2
- package/dist/chunk-DB3R2W4M.cjs.map +0 -1
- package/dist/chunk-YMZ6L6ML.js.map +0 -1
|
@@ -4,11 +4,12 @@ var zod = require('zod');
|
|
|
4
4
|
var child_process = require('child_process');
|
|
5
5
|
var semver = require('semver');
|
|
6
6
|
var path = require('path');
|
|
7
|
-
var
|
|
7
|
+
var promises = require('fs/promises');
|
|
8
8
|
var conventionalChangelogConfigSpec = require('conventional-changelog-config-spec');
|
|
9
9
|
var fs = require('fs');
|
|
10
10
|
var JoyCon = require('joycon');
|
|
11
11
|
var bundleRequire = require('bundle-require');
|
|
12
|
+
var util = require('util');
|
|
12
13
|
var jsoncParser = require('jsonc-parser');
|
|
13
14
|
var yaml = require('yaml');
|
|
14
15
|
var cheerio = require('cheerio/slim');
|
|
@@ -825,13 +826,19 @@ async function getUserConfig(cliArguments) {
|
|
|
825
826
|
...configFile,
|
|
826
827
|
...cliArguments.flags
|
|
827
828
|
};
|
|
828
|
-
|
|
829
|
+
const globResults = [];
|
|
829
830
|
if (mergedConfig.glob) {
|
|
830
|
-
|
|
831
|
+
const IGNORE_LIST = /* @__PURE__ */ new Set(["node_modules", ".git"]);
|
|
832
|
+
const entries = promises.glob(mergedConfig.glob, {
|
|
831
833
|
cwd,
|
|
832
|
-
|
|
833
|
-
|
|
834
|
+
withFileTypes: true,
|
|
835
|
+
exclude: (entry) => IGNORE_LIST.has(entry.name)
|
|
834
836
|
});
|
|
837
|
+
for await (const entry of entries) {
|
|
838
|
+
if (entry.isFile()) {
|
|
839
|
+
globResults.push(path.join(entry.parentPath, entry.name));
|
|
840
|
+
}
|
|
841
|
+
}
|
|
835
842
|
}
|
|
836
843
|
const files = mergeFiles(configFile?.files, cliArguments.flags.files, globResults);
|
|
837
844
|
const detectedGitHost = await detectGitHost(cwd);
|
|
@@ -863,8 +870,6 @@ async function getUserConfig(cliArguments) {
|
|
|
863
870
|
changelogPresetConfig
|
|
864
871
|
};
|
|
865
872
|
}
|
|
866
|
-
|
|
867
|
-
// src/services/logger.ts
|
|
868
873
|
var Logger = class {
|
|
869
874
|
constructor(config) {
|
|
870
875
|
this.config = config;
|
|
@@ -872,27 +877,36 @@ var Logger = class {
|
|
|
872
877
|
this.warn = this.warn.bind(this);
|
|
873
878
|
this.error = this.error.bind(this);
|
|
874
879
|
this.debug = this.debug.bind(this);
|
|
880
|
+
this.skipping = this.skipping.bind(this);
|
|
875
881
|
this.disableLogs = this.config.silent;
|
|
876
882
|
}
|
|
877
883
|
disableLogs = false;
|
|
878
|
-
log(
|
|
884
|
+
log(message) {
|
|
879
885
|
if (!this.disableLogs) {
|
|
880
|
-
console.log(
|
|
886
|
+
console.log(message);
|
|
881
887
|
}
|
|
882
888
|
}
|
|
883
|
-
warn(
|
|
889
|
+
warn(message) {
|
|
884
890
|
if (!this.disableLogs) {
|
|
885
|
-
console.warn(
|
|
891
|
+
console.warn(util.styleText("yellowBright", message));
|
|
886
892
|
}
|
|
887
893
|
}
|
|
888
|
-
error(
|
|
894
|
+
error(message) {
|
|
889
895
|
if (!this.disableLogs) {
|
|
890
|
-
console.error(
|
|
896
|
+
console.error(util.styleText("redBright", message));
|
|
891
897
|
}
|
|
892
898
|
}
|
|
893
|
-
debug(...
|
|
899
|
+
debug(message, ...optionalParams) {
|
|
894
900
|
if (this.config.debug && !this.disableLogs) {
|
|
895
|
-
console.debug(
|
|
901
|
+
console.debug(util.styleText("cyanBright", message));
|
|
902
|
+
if (optionalParams.length > 0) {
|
|
903
|
+
console.debug(...optionalParams);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
skipping(message) {
|
|
908
|
+
if (!this.disableLogs) {
|
|
909
|
+
console.log(util.styleText("magenta", message));
|
|
896
910
|
}
|
|
897
911
|
}
|
|
898
912
|
};
|
|
@@ -903,15 +917,13 @@ function fileExists(filePath) {
|
|
|
903
917
|
return false;
|
|
904
918
|
}
|
|
905
919
|
}
|
|
906
|
-
|
|
907
|
-
// src/files/json-package.ts
|
|
908
920
|
var JSONPackage = class {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
this
|
|
921
|
+
#logger;
|
|
922
|
+
constructor(logger) {
|
|
923
|
+
this.#logger = logger;
|
|
912
924
|
}
|
|
913
925
|
/** Options for parsing JSON and JSONC files. */
|
|
914
|
-
|
|
926
|
+
#jsoncOptions = {
|
|
915
927
|
allowEmptyContent: false,
|
|
916
928
|
allowTrailingComma: true,
|
|
917
929
|
disallowComments: false
|
|
@@ -923,42 +935,32 @@ var JSONPackage = class {
|
|
|
923
935
|
* @param newString string to set the value to
|
|
924
936
|
* @returns the JSON or JSONC string with the value set
|
|
925
937
|
*/
|
|
926
|
-
setStringInJsonc(jsonc, jsonPath, newString) {
|
|
938
|
+
#setStringInJsonc(jsonc, jsonPath, newString) {
|
|
927
939
|
const edits = jsoncParser.modify(jsonc, jsonPath, newString, {});
|
|
928
940
|
return jsoncParser.applyEdits(jsonc, edits);
|
|
929
941
|
}
|
|
930
|
-
read(
|
|
931
|
-
const
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
name: fileName,
|
|
943
|
-
path: filePath,
|
|
944
|
-
version: parsedJson.version,
|
|
945
|
-
isPrivate: typeof parsedJson?.private === "boolean" ? parsedJson.private : true
|
|
946
|
-
};
|
|
947
|
-
}
|
|
948
|
-
this.logger.warn(`[File Manager] Unable to determine json version: ${fileName}`);
|
|
942
|
+
read(filePath) {
|
|
943
|
+
const fileName = path.basename(filePath);
|
|
944
|
+
const fileContents = fs.readFileSync(filePath, "utf8");
|
|
945
|
+
const parseErrors = [];
|
|
946
|
+
const parsedJson = jsoncParser.parse(fileContents, parseErrors, this.#jsoncOptions);
|
|
947
|
+
if (parsedJson?.version && parseErrors.length === 0) {
|
|
948
|
+
return {
|
|
949
|
+
name: fileName,
|
|
950
|
+
path: filePath,
|
|
951
|
+
version: parsedJson.version,
|
|
952
|
+
isPrivate: typeof parsedJson?.private === "boolean" ? parsedJson.private : true
|
|
953
|
+
};
|
|
949
954
|
}
|
|
955
|
+
this.#logger.warn(`[File Manager] Unable to determine json version: ${fileName}`);
|
|
950
956
|
}
|
|
951
957
|
write(fileState, newVersion) {
|
|
952
958
|
let fileContents = fs.readFileSync(fileState.path, "utf8");
|
|
953
959
|
const parseErrors = [];
|
|
954
|
-
const parsedJson = jsoncParser.parse(fileContents, parseErrors, this
|
|
955
|
-
|
|
956
|
-
this.logger.warn(`[File Manager] Unable to parse JSON: ${fileState.path}`, parseErrors);
|
|
957
|
-
return;
|
|
958
|
-
}
|
|
959
|
-
fileContents = this.setStringInJsonc(fileContents, ["version"], newVersion);
|
|
960
|
+
const parsedJson = jsoncParser.parse(fileContents, parseErrors, this.#jsoncOptions);
|
|
961
|
+
fileContents = this.#setStringInJsonc(fileContents, ["version"], newVersion);
|
|
960
962
|
if (parsedJson?.packages?.[""]) {
|
|
961
|
-
fileContents = this
|
|
963
|
+
fileContents = this.#setStringInJsonc(fileContents, ["packages", "", "version"], newVersion);
|
|
962
964
|
}
|
|
963
965
|
fs.writeFileSync(fileState.path, fileContents, "utf8");
|
|
964
966
|
}
|
|
@@ -967,16 +969,16 @@ var JSONPackage = class {
|
|
|
967
969
|
}
|
|
968
970
|
};
|
|
969
971
|
var YAMLPackage = class {
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
this
|
|
972
|
+
#logger;
|
|
973
|
+
constructor(logger) {
|
|
974
|
+
this.#logger = logger;
|
|
973
975
|
}
|
|
974
976
|
/**
|
|
975
977
|
* If the version is returned with a "+" symbol in the value then the version might be from a
|
|
976
978
|
* flutter `pubspec.yaml` file, if so we want to retain the input builderNumber by splitting it
|
|
977
979
|
* and joining it again later.
|
|
978
980
|
*/
|
|
979
|
-
handleBuildNumber(fileVersion) {
|
|
981
|
+
#handleBuildNumber(fileVersion) {
|
|
980
982
|
const [version, builderNumber] = fileVersion.split("+");
|
|
981
983
|
if (/^\d+$/.test(builderNumber)) {
|
|
982
984
|
return {
|
|
@@ -988,22 +990,20 @@ var YAMLPackage = class {
|
|
|
988
990
|
version: fileVersion
|
|
989
991
|
};
|
|
990
992
|
}
|
|
991
|
-
read(
|
|
992
|
-
const
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
};
|
|
1004
|
-
}
|
|
993
|
+
read(filePath) {
|
|
994
|
+
const fileName = path.basename(filePath);
|
|
995
|
+
const fileContents = fs.readFileSync(filePath, "utf-8");
|
|
996
|
+
const fileVersion = yaml.parse(fileContents)?.version;
|
|
997
|
+
if (fileVersion) {
|
|
998
|
+
const parsedVersion = this.#handleBuildNumber(fileVersion);
|
|
999
|
+
return {
|
|
1000
|
+
name: fileName,
|
|
1001
|
+
path: filePath,
|
|
1002
|
+
version: parsedVersion.version || "",
|
|
1003
|
+
builderNumber: parsedVersion.builderNumber ?? void 0
|
|
1004
|
+
};
|
|
1005
1005
|
}
|
|
1006
|
-
this
|
|
1006
|
+
this.#logger.warn(`[File Manager] Unable to determine yaml version: ${fileName}`);
|
|
1007
1007
|
}
|
|
1008
1008
|
write(fileState, newVersion) {
|
|
1009
1009
|
const fileContents = fs.readFileSync(fileState.path, "utf8");
|
|
@@ -1020,21 +1020,21 @@ var YAMLPackage = class {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
};
|
|
1022
1022
|
var PlainText = class {
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
this
|
|
1023
|
+
#logger;
|
|
1024
|
+
constructor(logger) {
|
|
1025
|
+
this.#logger = logger;
|
|
1026
1026
|
}
|
|
1027
|
-
read(
|
|
1028
|
-
const
|
|
1029
|
-
|
|
1030
|
-
|
|
1027
|
+
read(filePath) {
|
|
1028
|
+
const fileName = path.basename(filePath);
|
|
1029
|
+
const fileContents = fs.readFileSync(filePath, "utf8").trim();
|
|
1030
|
+
if (fileContents) {
|
|
1031
1031
|
return {
|
|
1032
1032
|
name: fileName,
|
|
1033
1033
|
path: filePath,
|
|
1034
|
-
version: fileContents
|
|
1034
|
+
version: fileContents
|
|
1035
1035
|
};
|
|
1036
1036
|
}
|
|
1037
|
-
this
|
|
1037
|
+
this.#logger.warn(`[File Manager] Unable to determine plain text version: ${fileName}`);
|
|
1038
1038
|
}
|
|
1039
1039
|
write(fileState, newVersion) {
|
|
1040
1040
|
fs.writeFileSync(fileState.path, newVersion, "utf8");
|
|
@@ -1044,35 +1044,31 @@ var PlainText = class {
|
|
|
1044
1044
|
}
|
|
1045
1045
|
};
|
|
1046
1046
|
var MSBuildProject = class {
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
this
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
}
|
|
1067
|
-
this.logger.warn(`[File Manager] Unable to determine ms-build version: ${fileName}`);
|
|
1047
|
+
#logger;
|
|
1048
|
+
constructor(logger) {
|
|
1049
|
+
this.#logger = logger;
|
|
1050
|
+
}
|
|
1051
|
+
#cheerioOptions = {
|
|
1052
|
+
xmlMode: true,
|
|
1053
|
+
xml: { decodeEntities: false }
|
|
1054
|
+
};
|
|
1055
|
+
read(filePath) {
|
|
1056
|
+
const fileName = path.basename(filePath);
|
|
1057
|
+
const fileContents = fs.readFileSync(filePath, "utf8");
|
|
1058
|
+
const $ = cheerio__namespace.load(fileContents, this.#cheerioOptions);
|
|
1059
|
+
const version = $("Project > PropertyGroup > Version").text();
|
|
1060
|
+
if (version) {
|
|
1061
|
+
return {
|
|
1062
|
+
name: fileName,
|
|
1063
|
+
path: filePath,
|
|
1064
|
+
version
|
|
1065
|
+
};
|
|
1068
1066
|
}
|
|
1067
|
+
this.#logger.warn(`[File Manager] Unable to determine ms-build version: ${fileName}`);
|
|
1069
1068
|
}
|
|
1070
1069
|
write(fileState, newVersion) {
|
|
1071
1070
|
const fileContents = fs.readFileSync(fileState.path, "utf8");
|
|
1072
|
-
const $ = cheerio__namespace.load(fileContents,
|
|
1073
|
-
xmlMode: true,
|
|
1074
|
-
xml: { decodeEntities: false }
|
|
1075
|
-
});
|
|
1071
|
+
const $ = cheerio__namespace.load(fileContents, this.#cheerioOptions);
|
|
1076
1072
|
$("Project > PropertyGroup > Version").text(newVersion);
|
|
1077
1073
|
const updatedContent = $.xml().replaceAll('"/>', '" />');
|
|
1078
1074
|
fs.writeFileSync(fileState.path, updatedContent, "utf8");
|
|
@@ -1084,40 +1080,38 @@ var MSBuildProject = class {
|
|
|
1084
1080
|
}
|
|
1085
1081
|
};
|
|
1086
1082
|
var ARMBicep = class {
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
this
|
|
1083
|
+
#logger;
|
|
1084
|
+
constructor(logger) {
|
|
1085
|
+
this.#logger = logger;
|
|
1090
1086
|
}
|
|
1091
1087
|
/** https://regex101.com/r/Lriphb/2 */
|
|
1092
|
-
metadataRegex = /(metadata contentVersion *= *['"])(?<version>[^'"]+)(['"])/;
|
|
1088
|
+
#metadataRegex = /(metadata contentVersion *= *['"])(?<version>[^'"]+)(['"])/;
|
|
1093
1089
|
/** https://regex101.com/r/iKCTF9/1 */
|
|
1094
|
-
varRegex = /(var contentVersion(?: string)? *= *['"])(?<version>[^'"]+)(['"])/;
|
|
1095
|
-
read(
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
this.logger.warn(`[File Manager] Missing 'var contentVersion' in bicep file: ${fileName}`);
|
|
1115
|
-
}
|
|
1090
|
+
#varRegex = /(var contentVersion(?: string)? *= *['"])(?<version>[^'"]+)(['"])/;
|
|
1091
|
+
read(filePath) {
|
|
1092
|
+
const fileName = path.basename(filePath);
|
|
1093
|
+
const fileContents = fs.readFileSync(filePath, "utf8");
|
|
1094
|
+
const metadataMatch = this.#metadataRegex.exec(fileContents);
|
|
1095
|
+
const varMatch = this.#varRegex.exec(fileContents);
|
|
1096
|
+
if (metadataMatch?.groups?.version && varMatch?.groups?.version) {
|
|
1097
|
+
return {
|
|
1098
|
+
name: fileName,
|
|
1099
|
+
path: filePath,
|
|
1100
|
+
version: metadataMatch.groups.version
|
|
1101
|
+
};
|
|
1102
|
+
}
|
|
1103
|
+
if (!metadataMatch) {
|
|
1104
|
+
this.#logger.warn(
|
|
1105
|
+
`[File Manager] Missing 'metadata contentVersion' in bicep file: ${fileName}`
|
|
1106
|
+
);
|
|
1107
|
+
}
|
|
1108
|
+
if (!varMatch) {
|
|
1109
|
+
this.#logger.warn(`[File Manager] Missing 'var contentVersion' in bicep file: ${fileName}`);
|
|
1116
1110
|
}
|
|
1117
1111
|
}
|
|
1118
1112
|
write(fileState, newVersion) {
|
|
1119
1113
|
const fileContents = fs.readFileSync(fileState.path, "utf8");
|
|
1120
|
-
const updatedContent = fileContents.replace(this
|
|
1114
|
+
const updatedContent = fileContents.replace(this.#metadataRegex, `$1${newVersion}$3`).replace(this.#varRegex, `$1${newVersion}$3`);
|
|
1121
1115
|
fs.writeFileSync(fileState.path, updatedContent, "utf8");
|
|
1122
1116
|
}
|
|
1123
1117
|
isSupportedFile(fileName) {
|
|
@@ -1125,35 +1119,31 @@ var ARMBicep = class {
|
|
|
1125
1119
|
}
|
|
1126
1120
|
};
|
|
1127
1121
|
var InstallShieldISM = class {
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
this
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
}
|
|
1148
|
-
this.logger.warn(`[File Manager] Unable to determine InstallShield ISM version: ${fileName}`);
|
|
1122
|
+
#logger;
|
|
1123
|
+
constructor(logger) {
|
|
1124
|
+
this.#logger = logger;
|
|
1125
|
+
}
|
|
1126
|
+
#cheerioOptions = {
|
|
1127
|
+
xmlMode: true,
|
|
1128
|
+
xml: { decodeEntities: false }
|
|
1129
|
+
};
|
|
1130
|
+
read(filePath) {
|
|
1131
|
+
const fileName = path.basename(filePath);
|
|
1132
|
+
const fileContents = fs.readFileSync(filePath, "utf8");
|
|
1133
|
+
const $ = cheerio__namespace.load(fileContents, this.#cheerioOptions);
|
|
1134
|
+
const version = $('msi > table[name="Property"] > row > td:contains("ProductVersion")').next().text().trim();
|
|
1135
|
+
if (version) {
|
|
1136
|
+
return {
|
|
1137
|
+
name: fileName,
|
|
1138
|
+
path: filePath,
|
|
1139
|
+
version
|
|
1140
|
+
};
|
|
1149
1141
|
}
|
|
1142
|
+
this.#logger.warn(`[File Manager] Unable to determine InstallShield ISM version: ${fileName}`);
|
|
1150
1143
|
}
|
|
1151
1144
|
write(fileState, newVersion) {
|
|
1152
1145
|
const fileContents = fs.readFileSync(fileState.path, "utf8");
|
|
1153
|
-
const $ = cheerio__namespace.load(fileContents,
|
|
1154
|
-
xmlMode: true,
|
|
1155
|
-
xml: { decodeEntities: false }
|
|
1156
|
-
});
|
|
1146
|
+
const $ = cheerio__namespace.load(fileContents, this.#cheerioOptions);
|
|
1157
1147
|
const versionCell = $(
|
|
1158
1148
|
'msi > table[name="Property"] > row > td:contains("ProductVersion")'
|
|
1159
1149
|
).next();
|
|
@@ -1170,22 +1160,21 @@ var InstallShieldISM = class {
|
|
|
1170
1160
|
|
|
1171
1161
|
// src/files/file-manager.ts
|
|
1172
1162
|
var FileManager = class {
|
|
1163
|
+
#config;
|
|
1164
|
+
#logger;
|
|
1165
|
+
#fileManagers = [];
|
|
1173
1166
|
constructor(config, logger) {
|
|
1174
|
-
this
|
|
1175
|
-
this
|
|
1176
|
-
this
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
PlainText;
|
|
1186
|
-
MSBuildProject;
|
|
1187
|
-
ARMBicep;
|
|
1188
|
-
InstallShieldISM;
|
|
1167
|
+
this.#config = config;
|
|
1168
|
+
this.#logger = logger;
|
|
1169
|
+
this.#fileManagers = [
|
|
1170
|
+
new JSONPackage(logger),
|
|
1171
|
+
new YAMLPackage(logger),
|
|
1172
|
+
new PlainText(logger),
|
|
1173
|
+
new MSBuildProject(logger),
|
|
1174
|
+
new ARMBicep(logger),
|
|
1175
|
+
new InstallShieldISM(logger)
|
|
1176
|
+
];
|
|
1177
|
+
}
|
|
1189
1178
|
/**
|
|
1190
1179
|
* Get the state from the given file name.
|
|
1191
1180
|
*
|
|
@@ -1199,27 +1188,16 @@ var FileManager = class {
|
|
|
1199
1188
|
* { "name": "package.json", "path": "/path/to/package.json", "version": "1.2.3", "isPrivate": true }
|
|
1200
1189
|
* ```
|
|
1201
1190
|
*/
|
|
1202
|
-
read(
|
|
1203
|
-
const _fileName =
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
if (this.PlainText.isSupportedFile(_fileName)) {
|
|
1211
|
-
return this.PlainText.read(fileName);
|
|
1212
|
-
}
|
|
1213
|
-
if (this.MSBuildProject.isSupportedFile(_fileName)) {
|
|
1214
|
-
return this.MSBuildProject.read(fileName);
|
|
1215
|
-
}
|
|
1216
|
-
if (this.ARMBicep.isSupportedFile(_fileName)) {
|
|
1217
|
-
return this.ARMBicep.read(fileName);
|
|
1218
|
-
}
|
|
1219
|
-
if (this.InstallShieldISM.isSupportedFile(_fileName)) {
|
|
1220
|
-
return this.InstallShieldISM.read(fileName);
|
|
1191
|
+
read(pathOrName) {
|
|
1192
|
+
const _fileName = pathOrName.toLowerCase();
|
|
1193
|
+
const filePath = path.isAbsolute(pathOrName) ? pathOrName : path.resolve(this.#config.path, pathOrName);
|
|
1194
|
+
if (!fileExists(filePath)) return;
|
|
1195
|
+
for (const fileManager of this.#fileManagers) {
|
|
1196
|
+
if (fileManager.isSupportedFile(_fileName)) {
|
|
1197
|
+
return fileManager.read(filePath);
|
|
1198
|
+
}
|
|
1221
1199
|
}
|
|
1222
|
-
this
|
|
1200
|
+
this.#logger.error(`[File Manager] Unsupported file: ${pathOrName}`);
|
|
1223
1201
|
}
|
|
1224
1202
|
/**
|
|
1225
1203
|
* Write the new version to the given file.
|
|
@@ -1233,29 +1211,16 @@ var FileManager = class {
|
|
|
1233
1211
|
* ```
|
|
1234
1212
|
*/
|
|
1235
1213
|
write(fileState, newVersion) {
|
|
1236
|
-
if (this
|
|
1214
|
+
if (this.#config.dryRun) {
|
|
1237
1215
|
return;
|
|
1238
1216
|
}
|
|
1239
1217
|
const _fileName = fileState.name.toLowerCase();
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
return this.YAMLPackage.write(fileState, newVersion);
|
|
1245
|
-
}
|
|
1246
|
-
if (this.PlainText.isSupportedFile(_fileName)) {
|
|
1247
|
-
return this.PlainText.write(fileState, newVersion);
|
|
1248
|
-
}
|
|
1249
|
-
if (this.MSBuildProject.isSupportedFile(_fileName)) {
|
|
1250
|
-
return this.MSBuildProject.write(fileState, newVersion);
|
|
1251
|
-
}
|
|
1252
|
-
if (this.ARMBicep.isSupportedFile(_fileName)) {
|
|
1253
|
-
return this.ARMBicep.write(fileState, newVersion);
|
|
1254
|
-
}
|
|
1255
|
-
if (this.InstallShieldISM.isSupportedFile(_fileName)) {
|
|
1256
|
-
return this.InstallShieldISM.write(fileState, newVersion);
|
|
1218
|
+
for (const fileManager of this.#fileManagers) {
|
|
1219
|
+
if (fileManager.isSupportedFile(_fileName)) {
|
|
1220
|
+
return fileManager.write(fileState, newVersion);
|
|
1221
|
+
}
|
|
1257
1222
|
}
|
|
1258
|
-
this
|
|
1223
|
+
this.#logger.error(`[File Manager] Unsupported file: ${fileState.path}`);
|
|
1259
1224
|
}
|
|
1260
1225
|
};
|
|
1261
1226
|
|
|
@@ -1801,7 +1766,6 @@ async function getCommitsSinceTag(config, logger, git) {
|
|
|
1801
1766
|
logger.warn("No previous tag found, using all commits");
|
|
1802
1767
|
}
|
|
1803
1768
|
const foundCommits = await git.getCommits(latestTag, "HEAD");
|
|
1804
|
-
logger.debug(`Found ${foundCommits.length} commits since last tag (${latestTag ?? "none"})`);
|
|
1805
1769
|
const commits = foundCommits.reduce((acc, commit) => {
|
|
1806
1770
|
const parsed = commitParser.parse(commit);
|
|
1807
1771
|
if (parsed) {
|
|
@@ -1809,9 +1773,10 @@ async function getCommitsSinceTag(config, logger, git) {
|
|
|
1809
1773
|
}
|
|
1810
1774
|
return acc;
|
|
1811
1775
|
}, []);
|
|
1812
|
-
logger.debug(`Parsed ${commits.length} commits after applying commit parser`);
|
|
1813
1776
|
const filteredCommits = filterRevertedCommits(commits);
|
|
1814
|
-
logger.debug(
|
|
1777
|
+
logger.debug(
|
|
1778
|
+
`Found ${foundCommits.length} commits since tag: ${latestTag ?? "none"} (${commits.length} parsed, ${filteredCommits.length} after filtering reverts)`
|
|
1779
|
+
);
|
|
1815
1780
|
return {
|
|
1816
1781
|
latestTag,
|
|
1817
1782
|
commits: filteredCommits
|
|
@@ -1848,7 +1813,7 @@ function getReleaseType(releaseType, currentVersion, preReleaseTag) {
|
|
|
1848
1813
|
// src/process/get-next-version.ts
|
|
1849
1814
|
async function getNextVersion(config, logger, commits, currentVersion) {
|
|
1850
1815
|
if (config.skipBump) {
|
|
1851
|
-
logger.
|
|
1816
|
+
logger.skipping(`Skipping bump, using ${currentVersion} as the next version`);
|
|
1852
1817
|
return {
|
|
1853
1818
|
version: currentVersion
|
|
1854
1819
|
};
|
|
@@ -1864,14 +1829,25 @@ async function getNextVersion(config, logger, commits, currentVersion) {
|
|
|
1864
1829
|
}
|
|
1865
1830
|
const isPreMajor = semver__default.default.lt(currentVersion, "1.0.0");
|
|
1866
1831
|
let releaseType = "patch";
|
|
1867
|
-
const changes = {
|
|
1832
|
+
const changes = {
|
|
1833
|
+
major: 0,
|
|
1834
|
+
minor: 0,
|
|
1835
|
+
patch: 0,
|
|
1836
|
+
merges: 0,
|
|
1837
|
+
reverts: 0
|
|
1838
|
+
};
|
|
1868
1839
|
if (config.releaseAs) {
|
|
1869
1840
|
releaseType = config.releaseAs;
|
|
1870
1841
|
} else {
|
|
1871
1842
|
let level = 2;
|
|
1872
1843
|
const MINOR_TYPES = ["feat", "feature"];
|
|
1873
1844
|
for (const commit of commits) {
|
|
1874
|
-
if (commit.merge
|
|
1845
|
+
if (commit.merge) {
|
|
1846
|
+
changes.merges += 1;
|
|
1847
|
+
continue;
|
|
1848
|
+
}
|
|
1849
|
+
if (commit.revert) {
|
|
1850
|
+
changes.reverts += 1;
|
|
1875
1851
|
continue;
|
|
1876
1852
|
}
|
|
1877
1853
|
if (commit.notes.length > 0 || commit.breakingChange) {
|
|
@@ -1909,7 +1885,7 @@ async function getNextVersion(config, logger, commits, currentVersion) {
|
|
|
1909
1885
|
logger.log(`Next version: ${nextVersion} (${releaseTypeOrPreRelease})`);
|
|
1910
1886
|
if (commits.length > 0) {
|
|
1911
1887
|
logger.log(
|
|
1912
|
-
` - Commits: ${commits.length}` + (changes.major > 0 ? `,
|
|
1888
|
+
` - Commits: ${commits.length}` + (changes.major > 0 ? `, Majors: ${changes.major}` : "") + (changes.minor > 0 ? `, Minors: ${changes.minor}` : "") + (changes.patch > 0 ? `, Patches: ${changes.patch}` : "") + (changes.reverts > 0 ? `, Reverts: ${changes.reverts}` : "") + (changes.merges > 0 ? `, Merges: ${changes.merges}` : "")
|
|
1913
1889
|
);
|
|
1914
1890
|
} else {
|
|
1915
1891
|
logger.log(" - No commits found.");
|
|
@@ -1963,7 +1939,7 @@ function getNewReleaseContent(config, logger, nextVersion) {
|
|
|
1963
1939
|
}
|
|
1964
1940
|
async function updateChangelog(config, logger, nextVersion) {
|
|
1965
1941
|
if (config.skipChangelog) {
|
|
1966
|
-
logger.
|
|
1942
|
+
logger.skipping("Skipping changelog update");
|
|
1967
1943
|
return;
|
|
1968
1944
|
}
|
|
1969
1945
|
if (config.header.search(RELEASE_PATTERN) !== -1) {
|
|
@@ -2001,7 +1977,7 @@ function formatCommitMessage(message, version) {
|
|
|
2001
1977
|
// src/process/commit.ts
|
|
2002
1978
|
async function commitChanges(config, logger, git, files, nextVersion) {
|
|
2003
1979
|
if (config.skipCommit) {
|
|
2004
|
-
logger.
|
|
1980
|
+
logger.skipping("Skipping commit");
|
|
2005
1981
|
return;
|
|
2006
1982
|
}
|
|
2007
1983
|
logger.log("Committing changes");
|
|
@@ -2033,7 +2009,7 @@ async function commitChanges(config, logger, git, files, nextVersion) {
|
|
|
2033
2009
|
// src/process/tag.ts
|
|
2034
2010
|
async function tagChanges(config, logger, git, nextVersion) {
|
|
2035
2011
|
if (config.skipTag) {
|
|
2036
|
-
logger.
|
|
2012
|
+
logger.skipping("Skipping tag creation");
|
|
2037
2013
|
return;
|
|
2038
2014
|
}
|
|
2039
2015
|
const tag = `${config.tagPrefix}${nextVersion}`;
|
|
@@ -2089,5 +2065,5 @@ exports.main = main;
|
|
|
2089
2065
|
exports.tagChanges = tagChanges;
|
|
2090
2066
|
exports.updateChangelog = updateChangelog;
|
|
2091
2067
|
exports.validateConfig = validateConfig;
|
|
2092
|
-
//# sourceMappingURL=chunk-
|
|
2093
|
-
//# sourceMappingURL=chunk-
|
|
2068
|
+
//# sourceMappingURL=chunk-CISRFIID.cjs.map
|
|
2069
|
+
//# sourceMappingURL=chunk-CISRFIID.cjs.map
|