@releasekit/version 0.2.0 → 0.3.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-GH75HGCN.js → chunk-4OGOAITO.js} +27 -253
- package/dist/cli.cjs +44 -271
- package/dist/cli.js +1 -1
- package/dist/index.cjs +23 -248
- 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();
|
|
@@ -576,162 +546,6 @@ function extractIssueIds(body) {
|
|
|
576
546
|
init_baseError();
|
|
577
547
|
init_commandExecutor();
|
|
578
548
|
|
|
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
549
|
// src/git/tagsAndBranches.ts
|
|
736
550
|
var import_git_semver_tags = require("git-semver-tags");
|
|
737
551
|
var import_semver = __toESM(require("semver"), 1);
|
|
@@ -980,16 +794,16 @@ async function getLatestTagForPackage(packageName, versionPrefix, options) {
|
|
|
980
794
|
}
|
|
981
795
|
|
|
982
796
|
// 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
797
|
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
988
798
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
799
|
+
|
|
800
|
+
// src/cargo/cargoHandler.ts
|
|
801
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
802
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
989
803
|
var import_config2 = require("@releasekit/config");
|
|
990
804
|
var TOML = __toESM(require("smol-toml"), 1);
|
|
991
805
|
function getCargoInfo(cargoPath) {
|
|
992
|
-
if (!
|
|
806
|
+
if (!import_node_fs.default.existsSync(cargoPath)) {
|
|
993
807
|
log(`Cargo.toml file not found at: ${cargoPath}`, "error");
|
|
994
808
|
throw new Error(`Cargo.toml file not found at: ${cargoPath}`);
|
|
995
809
|
}
|
|
@@ -1003,7 +817,7 @@ function getCargoInfo(cargoPath) {
|
|
|
1003
817
|
name: cargo.package.name,
|
|
1004
818
|
version: cargo.package.version || "0.0.0",
|
|
1005
819
|
path: cargoPath,
|
|
1006
|
-
dir:
|
|
820
|
+
dir: import_node_path2.default.dirname(cargoPath),
|
|
1007
821
|
content: cargo
|
|
1008
822
|
};
|
|
1009
823
|
} catch (error) {
|
|
@@ -1029,7 +843,7 @@ function updateCargoVersion(cargoPath, version, dryRun = false) {
|
|
|
1029
843
|
cargo.package.version = version;
|
|
1030
844
|
}
|
|
1031
845
|
const updatedContent = TOML.stringify(cargo);
|
|
1032
|
-
|
|
846
|
+
import_node_fs.default.writeFileSync(cargoPath, updatedContent);
|
|
1033
847
|
}
|
|
1034
848
|
addPackageUpdate(packageName, version, cargoPath);
|
|
1035
849
|
log(`${dryRun ? "[DRY RUN] Would update" : "Updated"} Cargo.toml at ${cargoPath} to version ${version}`, "success");
|
|
@@ -1049,12 +863,12 @@ function updatePackageVersion(packagePath, version, dryRun = false) {
|
|
|
1049
863
|
return;
|
|
1050
864
|
}
|
|
1051
865
|
try {
|
|
1052
|
-
const packageContent =
|
|
866
|
+
const packageContent = import_node_fs2.default.readFileSync(packagePath, "utf8");
|
|
1053
867
|
const packageJson = JSON.parse(packageContent);
|
|
1054
868
|
const packageName = packageJson.name;
|
|
1055
869
|
if (!dryRun) {
|
|
1056
870
|
packageJson.version = version;
|
|
1057
|
-
|
|
871
|
+
import_node_fs2.default.writeFileSync(packagePath, `${JSON.stringify(packageJson, null, 2)}
|
|
1058
872
|
`);
|
|
1059
873
|
}
|
|
1060
874
|
addPackageUpdate(packageName, version, packagePath);
|
|
@@ -1074,13 +888,21 @@ function updatePackageVersion(packagePath, version, dryRun = false) {
|
|
|
1074
888
|
// src/package/packageProcessor.ts
|
|
1075
889
|
var fs5 = __toESM(require("fs"), 1);
|
|
1076
890
|
var import_node_path6 = __toESM(require("path"), 1);
|
|
1077
|
-
var import_node_process3 = require("process");
|
|
1078
891
|
|
|
1079
892
|
// src/core/versionCalculator.ts
|
|
1080
|
-
var
|
|
893
|
+
var import_node_process = require("process");
|
|
1081
894
|
var import_conventional_recommended_bump = require("conventional-recommended-bump");
|
|
1082
895
|
var import_semver3 = __toESM(require("semver"), 1);
|
|
1083
896
|
|
|
897
|
+
// src/git/repository.ts
|
|
898
|
+
var import_node_fs3 = require("fs");
|
|
899
|
+
var import_node_path4 = require("path");
|
|
900
|
+
init_commandExecutor();
|
|
901
|
+
function getCurrentBranch() {
|
|
902
|
+
const result = execSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
903
|
+
return result.toString().trim();
|
|
904
|
+
}
|
|
905
|
+
|
|
1084
906
|
// src/utils/manifestHelpers.ts
|
|
1085
907
|
var import_node_fs4 = __toESM(require("fs"), 1);
|
|
1086
908
|
var import_node_path5 = __toESM(require("path"), 1);
|
|
@@ -1138,13 +960,13 @@ var import_semver2 = __toESM(require("semver"), 1);
|
|
|
1138
960
|
|
|
1139
961
|
// src/git/tagVerification.ts
|
|
1140
962
|
init_commandExecutor();
|
|
1141
|
-
function verifyTag(tagName,
|
|
963
|
+
function verifyTag(tagName, cwd3) {
|
|
1142
964
|
if (!tagName || tagName.trim() === "") {
|
|
1143
965
|
return { exists: false, reachable: false, error: "Empty tag name" };
|
|
1144
966
|
}
|
|
1145
967
|
try {
|
|
1146
968
|
execSync("git", ["rev-parse", "--verify", tagName], {
|
|
1147
|
-
cwd:
|
|
969
|
+
cwd: cwd3,
|
|
1148
970
|
stdio: "ignore"
|
|
1149
971
|
});
|
|
1150
972
|
return { exists: true, reachable: true };
|
|
@@ -1241,11 +1063,11 @@ var VersionMismatchError = class extends Error {
|
|
|
1241
1063
|
this.name = "VersionMismatchError";
|
|
1242
1064
|
}
|
|
1243
1065
|
};
|
|
1244
|
-
async function getBestVersionSource(tagName, packageVersion,
|
|
1066
|
+
async function getBestVersionSource(tagName, packageVersion, cwd3, mismatchStrategy = "error", strictReachable = false) {
|
|
1245
1067
|
if (!tagName?.trim()) {
|
|
1246
1068
|
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
1069
|
}
|
|
1248
|
-
const verification = verifyTag(tagName,
|
|
1070
|
+
const verification = verifyTag(tagName, cwd3);
|
|
1249
1071
|
if (!verification.exists || !verification.reachable) {
|
|
1250
1072
|
if (strictReachable) {
|
|
1251
1073
|
throw new Error(
|
|
@@ -1400,7 +1222,7 @@ async function calculateVersion(config, options) {
|
|
|
1400
1222
|
const escapedTagPattern = escapeRegExp3(tagSearchPattern);
|
|
1401
1223
|
let versionSource;
|
|
1402
1224
|
if (pkgPath) {
|
|
1403
|
-
const packageDir = pkgPath || (0,
|
|
1225
|
+
const packageDir = pkgPath || (0, import_node_process.cwd)();
|
|
1404
1226
|
const manifestResult = getVersionFromManifests(packageDir);
|
|
1405
1227
|
const packageVersion = manifestResult.manifestFound && manifestResult.version ? manifestResult.version : void 0;
|
|
1406
1228
|
versionSource = await getBestVersionSource(
|
|
@@ -1463,7 +1285,7 @@ async function calculateVersion(config, options) {
|
|
|
1463
1285
|
const releaseTypeFromCommits = recommendedBump && "releaseType" in recommendedBump ? recommendedBump.releaseType : void 0;
|
|
1464
1286
|
const currentVersion = getCurrentVersionFromSource2();
|
|
1465
1287
|
if (versionSource && versionSource.source === "git") {
|
|
1466
|
-
const checkPath = pkgPath || (0,
|
|
1288
|
+
const checkPath = pkgPath || (0, import_node_process.cwd)();
|
|
1467
1289
|
const commitsLength = getCommitsLength(checkPath, versionSource.version);
|
|
1468
1290
|
if (commitsLength === 0) {
|
|
1469
1291
|
log(
|
|
@@ -1549,7 +1371,6 @@ var PackageProcessor = class {
|
|
|
1549
1371
|
tagTemplate;
|
|
1550
1372
|
commitMessageTemplate;
|
|
1551
1373
|
dryRun;
|
|
1552
|
-
skipHooks;
|
|
1553
1374
|
getLatestTag;
|
|
1554
1375
|
config;
|
|
1555
1376
|
// Config for version calculation
|
|
@@ -1560,7 +1381,6 @@ var PackageProcessor = class {
|
|
|
1560
1381
|
this.tagTemplate = options.tagTemplate;
|
|
1561
1382
|
this.commitMessageTemplate = options.commitMessageTemplate || "";
|
|
1562
1383
|
this.dryRun = options.dryRun || false;
|
|
1563
|
-
this.skipHooks = options.skipHooks || false;
|
|
1564
1384
|
this.getLatestTag = options.getLatestTag;
|
|
1565
1385
|
this.config = options.config;
|
|
1566
1386
|
this.fullConfig = options.fullConfig;
|
|
@@ -1763,19 +1583,12 @@ var PackageProcessor = class {
|
|
|
1763
1583
|
this.tagTemplate,
|
|
1764
1584
|
this.fullConfig.packageSpecificTags
|
|
1765
1585
|
);
|
|
1766
|
-
const tagMessage = `chore(release): ${name} ${nextVersion}`;
|
|
1767
1586
|
addTag(packageTag);
|
|
1768
1587
|
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 {
|
|
1588
|
+
if (this.dryRun) {
|
|
1778
1589
|
log(`[DRY RUN] Would create tag: ${packageTag}`, "info");
|
|
1590
|
+
} else {
|
|
1591
|
+
log(`Version ${nextVersion} prepared (tag: ${packageTag})`, "success");
|
|
1779
1592
|
}
|
|
1780
1593
|
updatedPackagesInfo.push({ name, version: nextVersion, path: pkgPath });
|
|
1781
1594
|
}
|
|
@@ -1783,30 +1596,6 @@ var PackageProcessor = class {
|
|
|
1783
1596
|
log("No packages required a version update.", "info");
|
|
1784
1597
|
return { updatedPackages: [], tags };
|
|
1785
1598
|
}
|
|
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
1599
|
const packageNames = updatedPackagesInfo.map((p) => p.name).join(", ");
|
|
1811
1600
|
const representativeVersion = updatedPackagesInfo[0]?.version || "multiple";
|
|
1812
1601
|
let commitMessage = this.commitMessageTemplate || "chore(release): publish packages";
|
|
@@ -1823,21 +1612,7 @@ var PackageProcessor = class {
|
|
|
1823
1612
|
commitMessage = `chore(release): ${packageNames} ${representativeVersion}`;
|
|
1824
1613
|
}
|
|
1825
1614
|
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
|
-
}
|
|
1615
|
+
if (this.dryRun) {
|
|
1841
1616
|
log(`[DRY RUN] Would commit with message: "${commitMessage}"`, "info");
|
|
1842
1617
|
}
|
|
1843
1618
|
return {
|
|
@@ -1888,7 +1663,6 @@ function createSyncStrategy(config) {
|
|
|
1888
1663
|
commitMessage = `chore(release): v\${version}`,
|
|
1889
1664
|
prereleaseIdentifier,
|
|
1890
1665
|
dryRun,
|
|
1891
|
-
skipHooks,
|
|
1892
1666
|
mainPackage
|
|
1893
1667
|
} = config;
|
|
1894
1668
|
const formattedPrefix = formatVersionPrefix(versionPrefix || "v");
|
|
@@ -2038,7 +1812,13 @@ function createSyncStrategy(config) {
|
|
|
2038
1812
|
config.packageSpecificTags || false
|
|
2039
1813
|
);
|
|
2040
1814
|
const formattedCommitMessage = formatCommitMessage(commitMessage, nextVersion, commitPackageName, void 0);
|
|
2041
|
-
|
|
1815
|
+
addTag(nextTag);
|
|
1816
|
+
setCommitMessage(formattedCommitMessage);
|
|
1817
|
+
if (!dryRun) {
|
|
1818
|
+
log(`Version ${nextVersion} prepared (tag: ${nextTag})`, "success");
|
|
1819
|
+
} else {
|
|
1820
|
+
log(`Would create tag: ${nextTag}`, "info");
|
|
1821
|
+
}
|
|
2042
1822
|
} catch (error) {
|
|
2043
1823
|
if (BaseVersionError.isVersionError(error)) {
|
|
2044
1824
|
log(`Synced Strategy failed: ${error.message} (${error.code})`, "error");
|
|
@@ -2053,14 +1833,7 @@ function createSyncStrategy(config) {
|
|
|
2053
1833
|
function createSingleStrategy(config) {
|
|
2054
1834
|
return async (packages) => {
|
|
2055
1835
|
try {
|
|
2056
|
-
const {
|
|
2057
|
-
mainPackage,
|
|
2058
|
-
versionPrefix,
|
|
2059
|
-
tagTemplate,
|
|
2060
|
-
commitMessage = `chore(release): \${version}`,
|
|
2061
|
-
dryRun,
|
|
2062
|
-
skipHooks
|
|
2063
|
-
} = config;
|
|
1836
|
+
const { mainPackage, versionPrefix, tagTemplate, commitMessage = `chore(release): \${version}`, dryRun } = config;
|
|
2064
1837
|
let packageName;
|
|
2065
1838
|
if (mainPackage) {
|
|
2066
1839
|
packageName = mainPackage;
|
|
@@ -2180,9 +1953,10 @@ function createSingleStrategy(config) {
|
|
|
2180
1953
|
log(`Updated package ${packageName} to version ${nextVersion}`, "success");
|
|
2181
1954
|
const tagName = formatTag(nextVersion, formattedPrefix, packageName, tagTemplate, config.packageSpecificTags);
|
|
2182
1955
|
const commitMsg = formatCommitMessage(commitMessage, nextVersion, packageName);
|
|
1956
|
+
addTag(tagName);
|
|
1957
|
+
setCommitMessage(commitMsg);
|
|
2183
1958
|
if (!dryRun) {
|
|
2184
|
-
|
|
2185
|
-
log(`Created tag: ${tagName}`, "success");
|
|
1959
|
+
log(`Version ${nextVersion} prepared (tag: ${tagName})`, "success");
|
|
2186
1960
|
} else {
|
|
2187
1961
|
log(`Would create tag: ${tagName}`, "info");
|
|
2188
1962
|
}
|
|
@@ -2207,7 +1981,6 @@ function createAsyncStrategy(config) {
|
|
|
2207
1981
|
tagTemplate: config.tagTemplate,
|
|
2208
1982
|
commitMessageTemplate: config.commitMessage || "",
|
|
2209
1983
|
dryRun: config.dryRun || false,
|
|
2210
|
-
skipHooks: config.skipHooks || false,
|
|
2211
1984
|
getLatestTag: dependencies.getLatestTag,
|
|
2212
1985
|
fullConfig: config,
|
|
2213
1986
|
// Extract common version configuration properties
|
|
@@ -2295,13 +2068,13 @@ var VersionEngine = class {
|
|
|
2295
2068
|
if (this.workspaceCache) {
|
|
2296
2069
|
return this.workspaceCache;
|
|
2297
2070
|
}
|
|
2298
|
-
const pkgsResult = (0, import_get_packages.getPackagesSync)((0,
|
|
2071
|
+
const pkgsResult = (0, import_get_packages.getPackagesSync)((0, import_node_process2.cwd)());
|
|
2299
2072
|
if (!pkgsResult || !pkgsResult.packages) {
|
|
2300
2073
|
throw createVersionError("PACKAGES_NOT_FOUND" /* PACKAGES_NOT_FOUND */);
|
|
2301
2074
|
}
|
|
2302
2075
|
if (!pkgsResult.root) {
|
|
2303
2076
|
log("Root path is undefined in packages result, setting to current working directory", "warning");
|
|
2304
|
-
pkgsResult.root = (0,
|
|
2077
|
+
pkgsResult.root = (0, import_node_process2.cwd)();
|
|
2305
2078
|
}
|
|
2306
2079
|
if (this.config.packages && this.config.packages.length > 0) {
|
|
2307
2080
|
const originalCount = pkgsResult.packages.length;
|