@releasekit/version 0.2.0 → 0.3.0-next.1
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/dist/{chunk-GH75HGCN.js → chunk-ZEXPJ53Z.js} +29 -258
- package/dist/cli.cjs +46 -276
- package/dist/cli.js +1 -1
- package/dist/index.cjs +25 -253
- package/dist/index.d.cts +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -108,8 +108,7 @@ function toVersionConfig(config, gitConfig) {
|
|
|
108
108
|
packages: [],
|
|
109
109
|
updateInternalDependencies: "minor",
|
|
110
110
|
versionPrefix: "",
|
|
111
|
-
baseBranch: gitConfig?.branch
|
|
112
|
-
skipHooks: gitConfig?.skipHooks
|
|
111
|
+
baseBranch: gitConfig?.branch
|
|
113
112
|
};
|
|
114
113
|
}
|
|
115
114
|
return {
|
|
@@ -128,7 +127,6 @@ function toVersionConfig(config, gitConfig) {
|
|
|
128
127
|
releaseType: bp.releaseType
|
|
129
128
|
})),
|
|
130
129
|
defaultReleaseType: config.defaultReleaseType,
|
|
131
|
-
skipHooks: gitConfig?.skipHooks,
|
|
132
130
|
mismatchStrategy: config.mismatchStrategy,
|
|
133
131
|
versionPrefix: config.versionPrefix ?? "",
|
|
134
132
|
prereleaseIdentifier: config.prereleaseIdentifier,
|
|
@@ -144,41 +142,13 @@ function loadConfig(options) {
|
|
|
144
142
|
}
|
|
145
143
|
|
|
146
144
|
// src/core/versionEngine.ts
|
|
147
|
-
var
|
|
145
|
+
var import_node_process2 = require("process");
|
|
148
146
|
var import_get_packages = require("@manypkg/get-packages");
|
|
149
147
|
|
|
150
148
|
// src/errors/gitError.ts
|
|
151
149
|
init_baseError();
|
|
152
150
|
var GitError = class extends BaseVersionError {
|
|
153
151
|
};
|
|
154
|
-
function createGitError(code, details) {
|
|
155
|
-
const messages = {
|
|
156
|
-
["NOT_GIT_REPO" /* NOT_GIT_REPO */]: "Not a git repository",
|
|
157
|
-
["GIT_PROCESS_ERROR" /* GIT_PROCESS_ERROR */]: "Failed to create new version",
|
|
158
|
-
["NO_FILES" /* NO_FILES */]: "No files specified for commit",
|
|
159
|
-
["NO_COMMIT_MESSAGE" /* NO_COMMIT_MESSAGE */]: "Commit message is required",
|
|
160
|
-
["GIT_ERROR" /* GIT_ERROR */]: "Git operation failed",
|
|
161
|
-
["TAG_ALREADY_EXISTS" /* TAG_ALREADY_EXISTS */]: "Git tag already exists"
|
|
162
|
-
};
|
|
163
|
-
const suggestions = {
|
|
164
|
-
["NOT_GIT_REPO" /* NOT_GIT_REPO */]: [
|
|
165
|
-
"Initialize git repository with: git init",
|
|
166
|
-
"Ensure you are in the correct directory"
|
|
167
|
-
],
|
|
168
|
-
["TAG_ALREADY_EXISTS" /* TAG_ALREADY_EXISTS */]: [
|
|
169
|
-
"Delete the existing tag: git tag -d <tag-name>",
|
|
170
|
-
"Use a different version by incrementing manually",
|
|
171
|
-
"Check if this version was already released"
|
|
172
|
-
],
|
|
173
|
-
["GIT_PROCESS_ERROR" /* GIT_PROCESS_ERROR */]: void 0,
|
|
174
|
-
["NO_FILES" /* NO_FILES */]: void 0,
|
|
175
|
-
["NO_COMMIT_MESSAGE" /* NO_COMMIT_MESSAGE */]: void 0,
|
|
176
|
-
["GIT_ERROR" /* GIT_ERROR */]: void 0
|
|
177
|
-
};
|
|
178
|
-
const baseMessage = messages[code];
|
|
179
|
-
const fullMessage = details ? `${baseMessage}: ${details}` : baseMessage;
|
|
180
|
-
return new GitError(fullMessage, code, suggestions[code]);
|
|
181
|
-
}
|
|
182
152
|
|
|
183
153
|
// src/errors/versionError.ts
|
|
184
154
|
init_baseError();
|
|
@@ -301,14 +271,11 @@ function log(message, level = "info") {
|
|
|
301
271
|
default:
|
|
302
272
|
chalkFn = import_chalk.default.blue;
|
|
303
273
|
}
|
|
274
|
+
const formattedMessage = level === "debug" ? `[DEBUG] ${message}` : message;
|
|
304
275
|
if (isJsonOutputMode()) {
|
|
305
|
-
|
|
306
|
-
chalkFn(message);
|
|
307
|
-
console.error(message);
|
|
308
|
-
}
|
|
276
|
+
console.error(chalkFn(formattedMessage));
|
|
309
277
|
return;
|
|
310
278
|
}
|
|
311
|
-
const formattedMessage = level === "debug" ? `[DEBUG] ${message}` : message;
|
|
312
279
|
if (level === "error") {
|
|
313
280
|
console.error(chalkFn(formattedMessage));
|
|
314
281
|
} else {
|
|
@@ -576,162 +543,6 @@ function extractIssueIds(body) {
|
|
|
576
543
|
init_baseError();
|
|
577
544
|
init_commandExecutor();
|
|
578
545
|
|
|
579
|
-
// src/git/commands.ts
|
|
580
|
-
var import_node_process = require("process");
|
|
581
|
-
init_commandExecutor();
|
|
582
|
-
|
|
583
|
-
// src/git/repository.ts
|
|
584
|
-
var import_node_fs = require("fs");
|
|
585
|
-
var import_node_path2 = require("path");
|
|
586
|
-
init_commandExecutor();
|
|
587
|
-
function isGitRepository(directory) {
|
|
588
|
-
const gitDir = (0, import_node_path2.join)(directory, ".git");
|
|
589
|
-
if (!(0, import_node_fs.existsSync)(gitDir)) {
|
|
590
|
-
return false;
|
|
591
|
-
}
|
|
592
|
-
const stats = (0, import_node_fs.statSync)(gitDir);
|
|
593
|
-
if (!stats.isDirectory()) {
|
|
594
|
-
return false;
|
|
595
|
-
}
|
|
596
|
-
try {
|
|
597
|
-
execSync("git", ["rev-parse", "--is-inside-work-tree"], { cwd: directory });
|
|
598
|
-
return true;
|
|
599
|
-
} catch (_error) {
|
|
600
|
-
return false;
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
function getCurrentBranch() {
|
|
604
|
-
const result = execSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
605
|
-
return result.toString().trim();
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
// src/git/commands.ts
|
|
609
|
-
async function gitAdd(files) {
|
|
610
|
-
return execAsync("git", ["add", ...files]);
|
|
611
|
-
}
|
|
612
|
-
async function gitCommit(options) {
|
|
613
|
-
const args = ["commit"];
|
|
614
|
-
if (options.amend) {
|
|
615
|
-
args.push("--amend");
|
|
616
|
-
}
|
|
617
|
-
if (options.author) {
|
|
618
|
-
args.push("--author", options.author);
|
|
619
|
-
}
|
|
620
|
-
if (options.date) {
|
|
621
|
-
args.push("--date", options.date);
|
|
622
|
-
}
|
|
623
|
-
if (options.skipHooks) {
|
|
624
|
-
args.push("--no-verify");
|
|
625
|
-
}
|
|
626
|
-
args.push("-m", options.message);
|
|
627
|
-
return execAsync("git", args);
|
|
628
|
-
}
|
|
629
|
-
async function createGitTag(options) {
|
|
630
|
-
const { tag, message = "" } = options;
|
|
631
|
-
const args = ["tag", "-a", "-m", message, tag];
|
|
632
|
-
try {
|
|
633
|
-
return await execAsync("git", args);
|
|
634
|
-
} catch (error) {
|
|
635
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
636
|
-
if (errorMessage.includes("already exists")) {
|
|
637
|
-
throw createGitError(
|
|
638
|
-
"TAG_ALREADY_EXISTS" /* TAG_ALREADY_EXISTS */,
|
|
639
|
-
`Tag '${tag}' already exists in the repository. Please use a different version or delete the existing tag first.`
|
|
640
|
-
);
|
|
641
|
-
}
|
|
642
|
-
throw createGitError("GIT_ERROR" /* GIT_ERROR */, errorMessage);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
async function gitProcess(options) {
|
|
646
|
-
const { files, nextTag, commitMessage, skipHooks, dryRun } = options;
|
|
647
|
-
if (!isGitRepository((0, import_node_process.cwd)())) {
|
|
648
|
-
throw createGitError("NOT_GIT_REPO" /* NOT_GIT_REPO */);
|
|
649
|
-
}
|
|
650
|
-
try {
|
|
651
|
-
if (!dryRun) {
|
|
652
|
-
await gitAdd(files);
|
|
653
|
-
await gitCommit({
|
|
654
|
-
message: commitMessage,
|
|
655
|
-
skipHooks
|
|
656
|
-
});
|
|
657
|
-
if (nextTag) {
|
|
658
|
-
const tagMessage = `New Version ${nextTag} generated at ${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
659
|
-
await createGitTag({
|
|
660
|
-
tag: nextTag,
|
|
661
|
-
message: tagMessage
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
} else {
|
|
665
|
-
log("[DRY RUN] Would add files:", "info");
|
|
666
|
-
for (const file of files) {
|
|
667
|
-
log(` - ${file}`, "info");
|
|
668
|
-
}
|
|
669
|
-
log(`[DRY RUN] Would commit with message: "${commitMessage}"`, "info");
|
|
670
|
-
if (nextTag) {
|
|
671
|
-
log(`[DRY RUN] Would create tag: ${nextTag}`, "info");
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
} catch (err) {
|
|
675
|
-
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
676
|
-
if (errorMessage.includes("already exists") && nextTag) {
|
|
677
|
-
log(`Tag '${nextTag}' already exists in the repository.`, "error");
|
|
678
|
-
throw createGitError(
|
|
679
|
-
"TAG_ALREADY_EXISTS" /* TAG_ALREADY_EXISTS */,
|
|
680
|
-
`Tag '${nextTag}' already exists in the repository. Please use a different version or delete the existing tag first.`
|
|
681
|
-
);
|
|
682
|
-
}
|
|
683
|
-
log(`Git process error: ${errorMessage}`, "error");
|
|
684
|
-
if (err instanceof Error && err.stack) {
|
|
685
|
-
console.error("Git process stack trace:");
|
|
686
|
-
console.error(err.stack);
|
|
687
|
-
}
|
|
688
|
-
throw createGitError("GIT_PROCESS_ERROR" /* GIT_PROCESS_ERROR */, errorMessage);
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
async function createGitCommitAndTag(files, nextTag, commitMessage, skipHooks, dryRun) {
|
|
692
|
-
try {
|
|
693
|
-
if (!files || files.length === 0) {
|
|
694
|
-
throw createGitError("NO_FILES" /* NO_FILES */);
|
|
695
|
-
}
|
|
696
|
-
if (!commitMessage) {
|
|
697
|
-
throw createGitError("NO_COMMIT_MESSAGE" /* NO_COMMIT_MESSAGE */);
|
|
698
|
-
}
|
|
699
|
-
setCommitMessage(commitMessage);
|
|
700
|
-
if (nextTag) {
|
|
701
|
-
addTag(nextTag);
|
|
702
|
-
}
|
|
703
|
-
await gitProcess({
|
|
704
|
-
files,
|
|
705
|
-
nextTag,
|
|
706
|
-
commitMessage,
|
|
707
|
-
skipHooks,
|
|
708
|
-
dryRun
|
|
709
|
-
});
|
|
710
|
-
if (!dryRun) {
|
|
711
|
-
log(`Created tag: ${nextTag}`, "success");
|
|
712
|
-
}
|
|
713
|
-
} catch (error) {
|
|
714
|
-
if (error instanceof GitError) {
|
|
715
|
-
throw error;
|
|
716
|
-
}
|
|
717
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
718
|
-
log(`Failed to create git commit and tag: ${errorMessage}`, "error");
|
|
719
|
-
if (error instanceof Error) {
|
|
720
|
-
console.error("Git operation error details:");
|
|
721
|
-
console.error(error.stack || error.message);
|
|
722
|
-
if (errorMessage.includes("Command failed:")) {
|
|
723
|
-
const cmdOutput = errorMessage.split("Command failed:")[1];
|
|
724
|
-
if (cmdOutput) {
|
|
725
|
-
console.error("Git command output:", cmdOutput.trim());
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
} else {
|
|
729
|
-
console.error("Unknown git error:", error);
|
|
730
|
-
}
|
|
731
|
-
throw new GitError(`Git operation failed: ${errorMessage}`, "GIT_ERROR" /* GIT_ERROR */);
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
|
|
735
546
|
// src/git/tagsAndBranches.ts
|
|
736
547
|
var import_git_semver_tags = require("git-semver-tags");
|
|
737
548
|
var import_semver = __toESM(require("semver"), 1);
|
|
@@ -980,16 +791,16 @@ async function getLatestTagForPackage(packageName, versionPrefix, options) {
|
|
|
980
791
|
}
|
|
981
792
|
|
|
982
793
|
// src/package/packageManagement.ts
|
|
983
|
-
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
984
|
-
var import_node_path4 = __toESM(require("path"), 1);
|
|
985
|
-
|
|
986
|
-
// src/cargo/cargoHandler.ts
|
|
987
794
|
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
988
795
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
796
|
+
|
|
797
|
+
// src/cargo/cargoHandler.ts
|
|
798
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
799
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
989
800
|
var import_config2 = require("@releasekit/config");
|
|
990
801
|
var TOML = __toESM(require("smol-toml"), 1);
|
|
991
802
|
function getCargoInfo(cargoPath) {
|
|
992
|
-
if (!
|
|
803
|
+
if (!import_node_fs.default.existsSync(cargoPath)) {
|
|
993
804
|
log(`Cargo.toml file not found at: ${cargoPath}`, "error");
|
|
994
805
|
throw new Error(`Cargo.toml file not found at: ${cargoPath}`);
|
|
995
806
|
}
|
|
@@ -1003,7 +814,7 @@ function getCargoInfo(cargoPath) {
|
|
|
1003
814
|
name: cargo.package.name,
|
|
1004
815
|
version: cargo.package.version || "0.0.0",
|
|
1005
816
|
path: cargoPath,
|
|
1006
|
-
dir:
|
|
817
|
+
dir: import_node_path2.default.dirname(cargoPath),
|
|
1007
818
|
content: cargo
|
|
1008
819
|
};
|
|
1009
820
|
} catch (error) {
|
|
@@ -1029,7 +840,7 @@ function updateCargoVersion(cargoPath, version, dryRun = false) {
|
|
|
1029
840
|
cargo.package.version = version;
|
|
1030
841
|
}
|
|
1031
842
|
const updatedContent = TOML.stringify(cargo);
|
|
1032
|
-
|
|
843
|
+
import_node_fs.default.writeFileSync(cargoPath, updatedContent);
|
|
1033
844
|
}
|
|
1034
845
|
addPackageUpdate(packageName, version, cargoPath);
|
|
1035
846
|
log(`${dryRun ? "[DRY RUN] Would update" : "Updated"} Cargo.toml at ${cargoPath} to version ${version}`, "success");
|
|
@@ -1049,12 +860,12 @@ function updatePackageVersion(packagePath, version, dryRun = false) {
|
|
|
1049
860
|
return;
|
|
1050
861
|
}
|
|
1051
862
|
try {
|
|
1052
|
-
const packageContent =
|
|
863
|
+
const packageContent = import_node_fs2.default.readFileSync(packagePath, "utf8");
|
|
1053
864
|
const packageJson = JSON.parse(packageContent);
|
|
1054
865
|
const packageName = packageJson.name;
|
|
1055
866
|
if (!dryRun) {
|
|
1056
867
|
packageJson.version = version;
|
|
1057
|
-
|
|
868
|
+
import_node_fs2.default.writeFileSync(packagePath, `${JSON.stringify(packageJson, null, 2)}
|
|
1058
869
|
`);
|
|
1059
870
|
}
|
|
1060
871
|
addPackageUpdate(packageName, version, packagePath);
|
|
@@ -1074,13 +885,21 @@ function updatePackageVersion(packagePath, version, dryRun = false) {
|
|
|
1074
885
|
// src/package/packageProcessor.ts
|
|
1075
886
|
var fs5 = __toESM(require("fs"), 1);
|
|
1076
887
|
var import_node_path6 = __toESM(require("path"), 1);
|
|
1077
|
-
var import_node_process3 = require("process");
|
|
1078
888
|
|
|
1079
889
|
// src/core/versionCalculator.ts
|
|
1080
|
-
var
|
|
890
|
+
var import_node_process = require("process");
|
|
1081
891
|
var import_conventional_recommended_bump = require("conventional-recommended-bump");
|
|
1082
892
|
var import_semver3 = __toESM(require("semver"), 1);
|
|
1083
893
|
|
|
894
|
+
// src/git/repository.ts
|
|
895
|
+
var import_node_fs3 = require("fs");
|
|
896
|
+
var import_node_path4 = require("path");
|
|
897
|
+
init_commandExecutor();
|
|
898
|
+
function getCurrentBranch() {
|
|
899
|
+
const result = execSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
900
|
+
return result.toString().trim();
|
|
901
|
+
}
|
|
902
|
+
|
|
1084
903
|
// src/utils/manifestHelpers.ts
|
|
1085
904
|
var import_node_fs4 = __toESM(require("fs"), 1);
|
|
1086
905
|
var import_node_path5 = __toESM(require("path"), 1);
|
|
@@ -1138,13 +957,13 @@ var import_semver2 = __toESM(require("semver"), 1);
|
|
|
1138
957
|
|
|
1139
958
|
// src/git/tagVerification.ts
|
|
1140
959
|
init_commandExecutor();
|
|
1141
|
-
function verifyTag(tagName,
|
|
960
|
+
function verifyTag(tagName, cwd3) {
|
|
1142
961
|
if (!tagName || tagName.trim() === "") {
|
|
1143
962
|
return { exists: false, reachable: false, error: "Empty tag name" };
|
|
1144
963
|
}
|
|
1145
964
|
try {
|
|
1146
965
|
execSync("git", ["rev-parse", "--verify", tagName], {
|
|
1147
|
-
cwd:
|
|
966
|
+
cwd: cwd3,
|
|
1148
967
|
stdio: "ignore"
|
|
1149
968
|
});
|
|
1150
969
|
return { exists: true, reachable: true };
|
|
@@ -1241,11 +1060,11 @@ var VersionMismatchError = class extends Error {
|
|
|
1241
1060
|
this.name = "VersionMismatchError";
|
|
1242
1061
|
}
|
|
1243
1062
|
};
|
|
1244
|
-
async function getBestVersionSource(tagName, packageVersion,
|
|
1063
|
+
async function getBestVersionSource(tagName, packageVersion, cwd3, mismatchStrategy = "error", strictReachable = false) {
|
|
1245
1064
|
if (!tagName?.trim()) {
|
|
1246
1065
|
return packageVersion ? { source: "package", version: packageVersion, reason: "No git tag provided" } : { source: "initial", version: "0.1.0", reason: "No git tag or package version available" };
|
|
1247
1066
|
}
|
|
1248
|
-
const verification = verifyTag(tagName,
|
|
1067
|
+
const verification = verifyTag(tagName, cwd3);
|
|
1249
1068
|
if (!verification.exists || !verification.reachable) {
|
|
1250
1069
|
if (strictReachable) {
|
|
1251
1070
|
throw new Error(
|
|
@@ -1400,7 +1219,7 @@ async function calculateVersion(config, options) {
|
|
|
1400
1219
|
const escapedTagPattern = escapeRegExp3(tagSearchPattern);
|
|
1401
1220
|
let versionSource;
|
|
1402
1221
|
if (pkgPath) {
|
|
1403
|
-
const packageDir = pkgPath || (0,
|
|
1222
|
+
const packageDir = pkgPath || (0, import_node_process.cwd)();
|
|
1404
1223
|
const manifestResult = getVersionFromManifests(packageDir);
|
|
1405
1224
|
const packageVersion = manifestResult.manifestFound && manifestResult.version ? manifestResult.version : void 0;
|
|
1406
1225
|
versionSource = await getBestVersionSource(
|
|
@@ -1463,7 +1282,7 @@ async function calculateVersion(config, options) {
|
|
|
1463
1282
|
const releaseTypeFromCommits = recommendedBump && "releaseType" in recommendedBump ? recommendedBump.releaseType : void 0;
|
|
1464
1283
|
const currentVersion = getCurrentVersionFromSource2();
|
|
1465
1284
|
if (versionSource && versionSource.source === "git") {
|
|
1466
|
-
const checkPath = pkgPath || (0,
|
|
1285
|
+
const checkPath = pkgPath || (0, import_node_process.cwd)();
|
|
1467
1286
|
const commitsLength = getCommitsLength(checkPath, versionSource.version);
|
|
1468
1287
|
if (commitsLength === 0) {
|
|
1469
1288
|
log(
|
|
@@ -1549,7 +1368,6 @@ var PackageProcessor = class {
|
|
|
1549
1368
|
tagTemplate;
|
|
1550
1369
|
commitMessageTemplate;
|
|
1551
1370
|
dryRun;
|
|
1552
|
-
skipHooks;
|
|
1553
1371
|
getLatestTag;
|
|
1554
1372
|
config;
|
|
1555
1373
|
// Config for version calculation
|
|
@@ -1560,7 +1378,6 @@ var PackageProcessor = class {
|
|
|
1560
1378
|
this.tagTemplate = options.tagTemplate;
|
|
1561
1379
|
this.commitMessageTemplate = options.commitMessageTemplate || "";
|
|
1562
1380
|
this.dryRun = options.dryRun || false;
|
|
1563
|
-
this.skipHooks = options.skipHooks || false;
|
|
1564
1381
|
this.getLatestTag = options.getLatestTag;
|
|
1565
1382
|
this.config = options.config;
|
|
1566
1383
|
this.fullConfig = options.fullConfig;
|
|
@@ -1763,19 +1580,12 @@ var PackageProcessor = class {
|
|
|
1763
1580
|
this.tagTemplate,
|
|
1764
1581
|
this.fullConfig.packageSpecificTags
|
|
1765
1582
|
);
|
|
1766
|
-
const tagMessage = `chore(release): ${name} ${nextVersion}`;
|
|
1767
1583
|
addTag(packageTag);
|
|
1768
1584
|
tags.push(packageTag);
|
|
1769
|
-
if (
|
|
1770
|
-
try {
|
|
1771
|
-
await createGitTag({ tag: packageTag, message: tagMessage });
|
|
1772
|
-
log(`Created tag: ${packageTag}`, "success");
|
|
1773
|
-
} catch (tagError) {
|
|
1774
|
-
log(`Failed to create tag ${packageTag} for ${name}: ${tagError.message}`, "error");
|
|
1775
|
-
log(tagError.stack || "No stack trace available", "error");
|
|
1776
|
-
}
|
|
1777
|
-
} else {
|
|
1585
|
+
if (this.dryRun) {
|
|
1778
1586
|
log(`[DRY RUN] Would create tag: ${packageTag}`, "info");
|
|
1587
|
+
} else {
|
|
1588
|
+
log(`Version ${nextVersion} prepared (tag: ${packageTag})`, "success");
|
|
1779
1589
|
}
|
|
1780
1590
|
updatedPackagesInfo.push({ name, version: nextVersion, path: pkgPath });
|
|
1781
1591
|
}
|
|
@@ -1783,30 +1593,6 @@ var PackageProcessor = class {
|
|
|
1783
1593
|
log("No packages required a version update.", "info");
|
|
1784
1594
|
return { updatedPackages: [], tags };
|
|
1785
1595
|
}
|
|
1786
|
-
const filesToCommit = [];
|
|
1787
|
-
for (const info of updatedPackagesInfo) {
|
|
1788
|
-
const packageJsonPath = import_node_path6.default.join(info.path, "package.json");
|
|
1789
|
-
if (fs5.existsSync(packageJsonPath)) {
|
|
1790
|
-
filesToCommit.push(packageJsonPath);
|
|
1791
|
-
}
|
|
1792
|
-
const cargoEnabled = this.fullConfig.cargo?.enabled !== false;
|
|
1793
|
-
if (cargoEnabled) {
|
|
1794
|
-
const cargoPaths = this.fullConfig.cargo?.paths;
|
|
1795
|
-
if (cargoPaths && cargoPaths.length > 0) {
|
|
1796
|
-
for (const cargoPath of cargoPaths) {
|
|
1797
|
-
const resolvedCargoPath = import_node_path6.default.resolve(info.path, cargoPath, "Cargo.toml");
|
|
1798
|
-
if (fs5.existsSync(resolvedCargoPath)) {
|
|
1799
|
-
filesToCommit.push(resolvedCargoPath);
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
|
-
} else {
|
|
1803
|
-
const cargoTomlPath = import_node_path6.default.join(info.path, "Cargo.toml");
|
|
1804
|
-
if (fs5.existsSync(cargoTomlPath)) {
|
|
1805
|
-
filesToCommit.push(cargoTomlPath);
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
}
|
|
1810
1596
|
const packageNames = updatedPackagesInfo.map((p) => p.name).join(", ");
|
|
1811
1597
|
const representativeVersion = updatedPackagesInfo[0]?.version || "multiple";
|
|
1812
1598
|
let commitMessage = this.commitMessageTemplate || "chore(release): publish packages";
|
|
@@ -1823,21 +1609,7 @@ var PackageProcessor = class {
|
|
|
1823
1609
|
commitMessage = `chore(release): ${packageNames} ${representativeVersion}`;
|
|
1824
1610
|
}
|
|
1825
1611
|
setCommitMessage(commitMessage);
|
|
1826
|
-
if (
|
|
1827
|
-
try {
|
|
1828
|
-
await gitAdd(filesToCommit);
|
|
1829
|
-
await gitCommit({ message: commitMessage, skipHooks: this.skipHooks });
|
|
1830
|
-
log(`Created commit for targeted release: ${packageNames}`, "success");
|
|
1831
|
-
} catch (commitError) {
|
|
1832
|
-
log("Failed to create commit for targeted release.", "error");
|
|
1833
|
-
console.error(commitError);
|
|
1834
|
-
(0, import_node_process3.exit)(1);
|
|
1835
|
-
}
|
|
1836
|
-
} else {
|
|
1837
|
-
log("[DRY RUN] Would add files:", "info");
|
|
1838
|
-
for (const file of filesToCommit) {
|
|
1839
|
-
log(` - ${file}`, "info");
|
|
1840
|
-
}
|
|
1612
|
+
if (this.dryRun) {
|
|
1841
1613
|
log(`[DRY RUN] Would commit with message: "${commitMessage}"`, "info");
|
|
1842
1614
|
}
|
|
1843
1615
|
return {
|
|
@@ -1888,7 +1660,6 @@ function createSyncStrategy(config) {
|
|
|
1888
1660
|
commitMessage = `chore(release): v\${version}`,
|
|
1889
1661
|
prereleaseIdentifier,
|
|
1890
1662
|
dryRun,
|
|
1891
|
-
skipHooks,
|
|
1892
1663
|
mainPackage
|
|
1893
1664
|
} = config;
|
|
1894
1665
|
const formattedPrefix = formatVersionPrefix(versionPrefix || "v");
|
|
@@ -2038,7 +1809,13 @@ function createSyncStrategy(config) {
|
|
|
2038
1809
|
config.packageSpecificTags || false
|
|
2039
1810
|
);
|
|
2040
1811
|
const formattedCommitMessage = formatCommitMessage(commitMessage, nextVersion, commitPackageName, void 0);
|
|
2041
|
-
|
|
1812
|
+
addTag(nextTag);
|
|
1813
|
+
setCommitMessage(formattedCommitMessage);
|
|
1814
|
+
if (!dryRun) {
|
|
1815
|
+
log(`Version ${nextVersion} prepared (tag: ${nextTag})`, "success");
|
|
1816
|
+
} else {
|
|
1817
|
+
log(`Would create tag: ${nextTag}`, "info");
|
|
1818
|
+
}
|
|
2042
1819
|
} catch (error) {
|
|
2043
1820
|
if (BaseVersionError.isVersionError(error)) {
|
|
2044
1821
|
log(`Synced Strategy failed: ${error.message} (${error.code})`, "error");
|
|
@@ -2053,14 +1830,7 @@ function createSyncStrategy(config) {
|
|
|
2053
1830
|
function createSingleStrategy(config) {
|
|
2054
1831
|
return async (packages) => {
|
|
2055
1832
|
try {
|
|
2056
|
-
const {
|
|
2057
|
-
mainPackage,
|
|
2058
|
-
versionPrefix,
|
|
2059
|
-
tagTemplate,
|
|
2060
|
-
commitMessage = `chore(release): \${version}`,
|
|
2061
|
-
dryRun,
|
|
2062
|
-
skipHooks
|
|
2063
|
-
} = config;
|
|
1833
|
+
const { mainPackage, versionPrefix, tagTemplate, commitMessage = `chore(release): \${version}`, dryRun } = config;
|
|
2064
1834
|
let packageName;
|
|
2065
1835
|
if (mainPackage) {
|
|
2066
1836
|
packageName = mainPackage;
|
|
@@ -2180,9 +1950,10 @@ function createSingleStrategy(config) {
|
|
|
2180
1950
|
log(`Updated package ${packageName} to version ${nextVersion}`, "success");
|
|
2181
1951
|
const tagName = formatTag(nextVersion, formattedPrefix, packageName, tagTemplate, config.packageSpecificTags);
|
|
2182
1952
|
const commitMsg = formatCommitMessage(commitMessage, nextVersion, packageName);
|
|
1953
|
+
addTag(tagName);
|
|
1954
|
+
setCommitMessage(commitMsg);
|
|
2183
1955
|
if (!dryRun) {
|
|
2184
|
-
|
|
2185
|
-
log(`Created tag: ${tagName}`, "success");
|
|
1956
|
+
log(`Version ${nextVersion} prepared (tag: ${tagName})`, "success");
|
|
2186
1957
|
} else {
|
|
2187
1958
|
log(`Would create tag: ${tagName}`, "info");
|
|
2188
1959
|
}
|
|
@@ -2207,7 +1978,6 @@ function createAsyncStrategy(config) {
|
|
|
2207
1978
|
tagTemplate: config.tagTemplate,
|
|
2208
1979
|
commitMessageTemplate: config.commitMessage || "",
|
|
2209
1980
|
dryRun: config.dryRun || false,
|
|
2210
|
-
skipHooks: config.skipHooks || false,
|
|
2211
1981
|
getLatestTag: dependencies.getLatestTag,
|
|
2212
1982
|
fullConfig: config,
|
|
2213
1983
|
// Extract common version configuration properties
|
|
@@ -2295,13 +2065,13 @@ var VersionEngine = class {
|
|
|
2295
2065
|
if (this.workspaceCache) {
|
|
2296
2066
|
return this.workspaceCache;
|
|
2297
2067
|
}
|
|
2298
|
-
const pkgsResult = (0, import_get_packages.getPackagesSync)((0,
|
|
2068
|
+
const pkgsResult = (0, import_get_packages.getPackagesSync)((0, import_node_process2.cwd)());
|
|
2299
2069
|
if (!pkgsResult || !pkgsResult.packages) {
|
|
2300
2070
|
throw createVersionError("PACKAGES_NOT_FOUND" /* PACKAGES_NOT_FOUND */);
|
|
2301
2071
|
}
|
|
2302
2072
|
if (!pkgsResult.root) {
|
|
2303
2073
|
log("Root path is undefined in packages result, setting to current working directory", "warning");
|
|
2304
|
-
pkgsResult.root = (0,
|
|
2074
|
+
pkgsResult.root = (0, import_node_process2.cwd)();
|
|
2305
2075
|
}
|
|
2306
2076
|
if (this.config.packages && this.config.packages.length > 0) {
|
|
2307
2077
|
const originalCount = pkgsResult.packages.length;
|