@releasekit/version 0.7.45 → 0.7.47
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-45DJUNXI.js → chunk-UBCKZYTO.js} +60 -738
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/dist-3B6ZXCEH.js +0 -431
- package/dist/dist-XFQOB6BJ.js +0 -102
|
@@ -531,14 +531,14 @@ function enableJsonOutput(dryRun = false) {
|
|
|
531
531
|
_jsonData.commitMessage = void 0;
|
|
532
532
|
_pendingWrites.length = 0;
|
|
533
533
|
}
|
|
534
|
-
function recordPendingWrite(
|
|
534
|
+
function recordPendingWrite(path10, content) {
|
|
535
535
|
if (!_jsonOutputMode) return;
|
|
536
|
-
_pendingWrites.push({ path:
|
|
536
|
+
_pendingWrites.push({ path: path10, content });
|
|
537
537
|
}
|
|
538
538
|
function flushPendingWrites() {
|
|
539
539
|
try {
|
|
540
|
-
for (const { path:
|
|
541
|
-
fs4.writeFileSync(
|
|
540
|
+
for (const { path: path10, content } of _pendingWrites) {
|
|
541
|
+
fs4.writeFileSync(path10, content);
|
|
542
542
|
}
|
|
543
543
|
} finally {
|
|
544
544
|
_pendingWrites.length = 0;
|
|
@@ -582,686 +582,8 @@ function printJsonOutput() {
|
|
|
582
582
|
|
|
583
583
|
// src/core/versionCalculator.ts
|
|
584
584
|
import { cwd } from "process";
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
function formatArgs(...args) {
|
|
588
|
-
return args.reduce((finalArgs, arg) => {
|
|
589
|
-
if (arg) {
|
|
590
|
-
finalArgs.push(String(arg));
|
|
591
|
-
}
|
|
592
|
-
return finalArgs;
|
|
593
|
-
}, []);
|
|
594
|
-
}
|
|
595
|
-
function toArray(value) {
|
|
596
|
-
return Array.isArray(value) ? value : [value];
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
// ../../node_modules/.pnpm/@conventional-changelog+git-client@2.5.1_conventional-commits-filter@5.0.0_conventional-commits-parser@6.2.1/node_modules/@conventional-changelog/git-client/dist/GitClient.js
|
|
600
|
-
import { spawn } from "child_process";
|
|
601
|
-
|
|
602
|
-
// ../../node_modules/.pnpm/@simple-libs+stream-utils@1.1.0/node_modules/@simple-libs/stream-utils/dist/index.js
|
|
603
|
-
import { Readable } from "stream";
|
|
604
|
-
async function toArray2(iterable) {
|
|
605
|
-
const result = [];
|
|
606
|
-
for await (const item of iterable) {
|
|
607
|
-
result.push(item);
|
|
608
|
-
}
|
|
609
|
-
return result;
|
|
610
|
-
}
|
|
611
|
-
async function concatBufferStream(iterable) {
|
|
612
|
-
return Buffer.concat(await toArray2(iterable));
|
|
613
|
-
}
|
|
614
|
-
async function firstFromStream(stream) {
|
|
615
|
-
for await (const tag of stream) {
|
|
616
|
-
return tag;
|
|
617
|
-
}
|
|
618
|
-
return null;
|
|
619
|
-
}
|
|
620
|
-
async function* splitStream(stream, separator) {
|
|
621
|
-
let chunk;
|
|
622
|
-
let payload;
|
|
623
|
-
let buffer = "";
|
|
624
|
-
for await (chunk of stream) {
|
|
625
|
-
buffer += chunk.toString();
|
|
626
|
-
if (buffer.includes(separator)) {
|
|
627
|
-
payload = buffer.split(separator);
|
|
628
|
-
buffer = payload.pop() || "";
|
|
629
|
-
yield* payload;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
if (buffer) {
|
|
633
|
-
yield buffer;
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
// ../../node_modules/.pnpm/@simple-libs+child-process-utils@1.0.1/node_modules/@simple-libs/child-process-utils/dist/index.js
|
|
638
|
-
async function exitCode(process2) {
|
|
639
|
-
if (process2.exitCode !== null) {
|
|
640
|
-
return process2.exitCode;
|
|
641
|
-
}
|
|
642
|
-
return new Promise((resolve2) => process2.once("close", resolve2));
|
|
643
|
-
}
|
|
644
|
-
async function catchProcessError(process2) {
|
|
645
|
-
let error = new Error("Process exited with non-zero code");
|
|
646
|
-
let stderr = "";
|
|
647
|
-
process2.on("error", (err) => {
|
|
648
|
-
error = err;
|
|
649
|
-
});
|
|
650
|
-
if (process2.stderr) {
|
|
651
|
-
let chunk;
|
|
652
|
-
for await (chunk of process2.stderr) {
|
|
653
|
-
stderr += chunk.toString();
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
const code = await exitCode(process2);
|
|
657
|
-
if (stderr) {
|
|
658
|
-
error = new Error(stderr);
|
|
659
|
-
}
|
|
660
|
-
return code ? error : null;
|
|
661
|
-
}
|
|
662
|
-
async function* outputStream(process2) {
|
|
663
|
-
const { stdout } = process2;
|
|
664
|
-
const errorPromise = catchProcessError(process2);
|
|
665
|
-
if (stdout) {
|
|
666
|
-
stdout.on("error", (err) => {
|
|
667
|
-
if (err.name === "AbortError" && process2.exitCode === null) {
|
|
668
|
-
process2.kill("SIGKILL");
|
|
669
|
-
}
|
|
670
|
-
});
|
|
671
|
-
yield* stdout;
|
|
672
|
-
}
|
|
673
|
-
const error = await errorPromise;
|
|
674
|
-
if (error) {
|
|
675
|
-
throw error;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
function output(process2) {
|
|
679
|
-
return concatBufferStream(outputStream(process2));
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
// ../../node_modules/.pnpm/@conventional-changelog+git-client@2.5.1_conventional-commits-filter@5.0.0_conventional-commits-parser@6.2.1/node_modules/@conventional-changelog/git-client/dist/GitClient.js
|
|
683
|
-
var SCISSOR = "------------------------ >8 ------------------------";
|
|
684
|
-
var GitClient = class {
|
|
685
|
-
cwd;
|
|
686
|
-
debug;
|
|
687
|
-
constructor(cwd3, debug) {
|
|
688
|
-
this.cwd = cwd3;
|
|
689
|
-
this.debug = debug;
|
|
690
|
-
}
|
|
691
|
-
formatArgs(...args) {
|
|
692
|
-
const finalArgs = formatArgs(...args);
|
|
693
|
-
if (this.debug) {
|
|
694
|
-
this.debug(finalArgs);
|
|
695
|
-
}
|
|
696
|
-
return finalArgs;
|
|
697
|
-
}
|
|
698
|
-
/**
|
|
699
|
-
* Raw exec method to run git commands.
|
|
700
|
-
* @param args
|
|
701
|
-
* @returns Stdout string output of the command.
|
|
702
|
-
*/
|
|
703
|
-
async exec(...args) {
|
|
704
|
-
return (await output(spawn("git", this.formatArgs(...args), {
|
|
705
|
-
cwd: this.cwd
|
|
706
|
-
}))).toString().trim();
|
|
707
|
-
}
|
|
708
|
-
/**
|
|
709
|
-
* Raw exec method to run git commands with stream output.
|
|
710
|
-
* @param args
|
|
711
|
-
* @returns Stdout stream of the command.
|
|
712
|
-
*/
|
|
713
|
-
execStream(...args) {
|
|
714
|
-
return outputStream(spawn("git", this.formatArgs(...args), {
|
|
715
|
-
cwd: this.cwd
|
|
716
|
-
}));
|
|
717
|
-
}
|
|
718
|
-
/**
|
|
719
|
-
* Initialize a new git repository.
|
|
720
|
-
* @returns Boolean result.
|
|
721
|
-
*/
|
|
722
|
-
async init() {
|
|
723
|
-
try {
|
|
724
|
-
await this.exec("init");
|
|
725
|
-
return true;
|
|
726
|
-
} catch (err) {
|
|
727
|
-
return false;
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
/**
|
|
731
|
-
* Get raw commits stream.
|
|
732
|
-
* @param params
|
|
733
|
-
* @param params.path - Read commits from specific path.
|
|
734
|
-
* @param params.from - Start commits range.
|
|
735
|
-
* @param params.to - End commits range.
|
|
736
|
-
* @param params.format - Commits format.
|
|
737
|
-
* @yields Raw commits data.
|
|
738
|
-
*/
|
|
739
|
-
async *getRawCommits(params = {}) {
|
|
740
|
-
const { path: path11, from = "", to = "HEAD", format = "%B", ignore, reverse, merges, since } = params;
|
|
741
|
-
const shouldNotIgnore = ignore ? (chunk2) => !ignore.test(chunk2) : () => true;
|
|
742
|
-
const stdout = this.execStream("log", `--format=${format}%n${SCISSOR}`, since && `--since=${since instanceof Date ? since.toISOString() : since}`, reverse && "--reverse", merges && "--merges", merges === false && "--no-merges", [from, to].filter(Boolean).join(".."), ...path11 ? ["--", ...toArray(path11)] : []);
|
|
743
|
-
const commitsStream = splitStream(stdout, `${SCISSOR}
|
|
744
|
-
`);
|
|
745
|
-
let chunk;
|
|
746
|
-
for await (chunk of commitsStream) {
|
|
747
|
-
if (shouldNotIgnore(chunk)) {
|
|
748
|
-
yield chunk;
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
/**
|
|
753
|
-
* Get tags stream.
|
|
754
|
-
* @param params
|
|
755
|
-
* @yields Tags
|
|
756
|
-
*/
|
|
757
|
-
async *getTags(params = {}) {
|
|
758
|
-
const { path: path11, from = "", to = "HEAD", since } = params;
|
|
759
|
-
const tagRegex = /tag:\s*(.+?)[,)]/gi;
|
|
760
|
-
const stdout = this.execStream("log", "--decorate", "--no-color", "--date-order", since && `--since=${since instanceof Date ? since.toISOString() : since}`, [from, to].filter(Boolean).join(".."), ...path11 ? ["--", ...toArray(path11)] : []);
|
|
761
|
-
let chunk;
|
|
762
|
-
let matches;
|
|
763
|
-
let tag;
|
|
764
|
-
for await (chunk of stdout) {
|
|
765
|
-
matches = chunk.toString().trim().matchAll(tagRegex);
|
|
766
|
-
for ([, tag] of matches) {
|
|
767
|
-
yield tag;
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
/**
|
|
772
|
-
* Get last tag.
|
|
773
|
-
* @param params
|
|
774
|
-
* @returns Last tag, `null` if not found.
|
|
775
|
-
*/
|
|
776
|
-
async getLastTag(params) {
|
|
777
|
-
return firstFromStream(this.getTags(params));
|
|
778
|
-
}
|
|
779
|
-
/**
|
|
780
|
-
* Check file is ignored via .gitignore.
|
|
781
|
-
* @param file - Path to target file.
|
|
782
|
-
* @returns Boolean value.
|
|
783
|
-
*/
|
|
784
|
-
async checkIgnore(file) {
|
|
785
|
-
try {
|
|
786
|
-
await this.exec("check-ignore", "--", file);
|
|
787
|
-
return true;
|
|
788
|
-
} catch (err) {
|
|
789
|
-
return false;
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
/**
|
|
793
|
-
* Add files to git index.
|
|
794
|
-
* @param files - Files to stage.
|
|
795
|
-
*/
|
|
796
|
-
async add(files) {
|
|
797
|
-
await this.exec("add", "--", ...toArray(files));
|
|
798
|
-
}
|
|
799
|
-
/**
|
|
800
|
-
* Commit changes.
|
|
801
|
-
* @param params
|
|
802
|
-
* @param params.verify
|
|
803
|
-
* @param params.sign
|
|
804
|
-
* @param params.files
|
|
805
|
-
* @param params.allowEmpty
|
|
806
|
-
* @param params.message
|
|
807
|
-
*/
|
|
808
|
-
async commit(params) {
|
|
809
|
-
const { verify = true, sign = false, files = [], allowEmpty = false, message } = params;
|
|
810
|
-
await this.exec("commit", !verify && "--no-verify", sign && "-S", allowEmpty && "--allow-empty", "-m", message, "--", ...files);
|
|
811
|
-
}
|
|
812
|
-
/**
|
|
813
|
-
* Create a tag for the current commit.
|
|
814
|
-
* @param params
|
|
815
|
-
* @param params.sign
|
|
816
|
-
* @param params.name
|
|
817
|
-
* @param params.message
|
|
818
|
-
*/
|
|
819
|
-
async tag(params) {
|
|
820
|
-
let { sign = false, name, message } = params;
|
|
821
|
-
if (sign) {
|
|
822
|
-
message = "";
|
|
823
|
-
}
|
|
824
|
-
await this.exec("tag", sign && "-s", message && "-a", ...message ? ["-m", message] : [], "--", name);
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
* Get current branch name.
|
|
828
|
-
* @returns Current branch name.
|
|
829
|
-
*/
|
|
830
|
-
async getCurrentBranch() {
|
|
831
|
-
const branch = await this.exec("rev-parse", "--abbrev-ref", "HEAD");
|
|
832
|
-
return branch;
|
|
833
|
-
}
|
|
834
|
-
/**
|
|
835
|
-
* Get default branch name.
|
|
836
|
-
* @returns Default branch name.
|
|
837
|
-
*/
|
|
838
|
-
async getDefaultBranch() {
|
|
839
|
-
const branch = (await this.exec("rev-parse", "--abbrev-ref", "origin/HEAD")).replace(/^origin\//, "");
|
|
840
|
-
return branch;
|
|
841
|
-
}
|
|
842
|
-
/**
|
|
843
|
-
* Push changes to remote.
|
|
844
|
-
* @param branch
|
|
845
|
-
* @param params
|
|
846
|
-
* @param params.verify
|
|
847
|
-
*/
|
|
848
|
-
async push(branch, params = {}) {
|
|
849
|
-
const { verify = true, tags = false, followTags = false, force = false } = params;
|
|
850
|
-
await this.exec("push", followTags && "--follow-tags", tags && "--tags", !verify && "--no-verify", force && "--force", "origin", "--", branch);
|
|
851
|
-
}
|
|
852
|
-
/**
|
|
853
|
-
* Verify rev exists.
|
|
854
|
-
* @param rev
|
|
855
|
-
* @param safe - If `true`, will not throw error if rev not found.
|
|
856
|
-
* @returns Target hash.
|
|
857
|
-
*/
|
|
858
|
-
async verify(rev, safe) {
|
|
859
|
-
let git = this.exec("rev-parse", "--verify", rev);
|
|
860
|
-
if (safe) {
|
|
861
|
-
git = git.catch(() => "");
|
|
862
|
-
}
|
|
863
|
-
return await git;
|
|
864
|
-
}
|
|
865
|
-
/**
|
|
866
|
-
* Get config value by key.
|
|
867
|
-
* @param key - Config key.
|
|
868
|
-
* @returns Config value.
|
|
869
|
-
*/
|
|
870
|
-
async getConfig(key) {
|
|
871
|
-
return await this.exec("config", "--get", "--", key);
|
|
872
|
-
}
|
|
873
|
-
/**
|
|
874
|
-
* Set config value by key.
|
|
875
|
-
* @param key - Config key.
|
|
876
|
-
* @param value - Config value.
|
|
877
|
-
*/
|
|
878
|
-
async setConfig(key, value) {
|
|
879
|
-
await this.exec("config", "--", key, value);
|
|
880
|
-
}
|
|
881
|
-
/**
|
|
882
|
-
* Fetch changes from remote.
|
|
883
|
-
* @param params
|
|
884
|
-
*/
|
|
885
|
-
async fetch(params = {}) {
|
|
886
|
-
const { prune = false, unshallow = false, tags = false, all = false, remote, branch } = params;
|
|
887
|
-
await this.exec("fetch", prune && "--prune", unshallow && "--unshallow", tags && "--tags", all && "--all", ...remote && branch ? [
|
|
888
|
-
"--",
|
|
889
|
-
remote,
|
|
890
|
-
branch
|
|
891
|
-
] : []);
|
|
892
|
-
}
|
|
893
|
-
/**
|
|
894
|
-
* Create a new branch.
|
|
895
|
-
* @param branch - Branch name.
|
|
896
|
-
*/
|
|
897
|
-
async createBranch(branch) {
|
|
898
|
-
await this.exec("checkout", "-b", branch);
|
|
899
|
-
}
|
|
900
|
-
/**
|
|
901
|
-
* Delete a branch.
|
|
902
|
-
* @param branch - Branch name.
|
|
903
|
-
*/
|
|
904
|
-
async deleteBranch(branch) {
|
|
905
|
-
await this.exec("branch", "-D", "--", branch);
|
|
906
|
-
}
|
|
907
|
-
/**
|
|
908
|
-
* Checkout a branch.
|
|
909
|
-
* @param branch - Branch name.
|
|
910
|
-
*/
|
|
911
|
-
async checkout(branch) {
|
|
912
|
-
await this.exec("checkout", branch);
|
|
913
|
-
}
|
|
914
|
-
};
|
|
915
|
-
|
|
916
|
-
// ../../node_modules/.pnpm/@conventional-changelog+git-client@2.5.1_conventional-commits-filter@5.0.0_conventional-commits-parser@6.2.1/node_modules/@conventional-changelog/git-client/dist/ConventionalGitClient.js
|
|
917
|
-
import semver from "semver";
|
|
918
|
-
var ConventionalGitClient = class extends GitClient {
|
|
919
|
-
deps = null;
|
|
920
|
-
loadDeps() {
|
|
921
|
-
if (this.deps) {
|
|
922
|
-
return this.deps;
|
|
923
|
-
}
|
|
924
|
-
this.deps = Promise.all([
|
|
925
|
-
import("./dist-3B6ZXCEH.js").then(({ parseCommits }) => parseCommits),
|
|
926
|
-
import("./dist-XFQOB6BJ.js").then(({ filterRevertedCommits }) => filterRevertedCommits)
|
|
927
|
-
]);
|
|
928
|
-
return this.deps;
|
|
929
|
-
}
|
|
930
|
-
/**
|
|
931
|
-
* Get parsed commits stream.
|
|
932
|
-
* @param params
|
|
933
|
-
* @param params.path - Read commits from specific path.
|
|
934
|
-
* @param params.from - Start commits range.
|
|
935
|
-
* @param params.to - End commits range.
|
|
936
|
-
* @param params.format - Commits format.
|
|
937
|
-
* @param parserOptions - Commit parser options.
|
|
938
|
-
* @yields Raw commits data.
|
|
939
|
-
*/
|
|
940
|
-
async *getCommits(params = {}, parserOptions = {}) {
|
|
941
|
-
const { filterReverts, ...gitLogParams } = params;
|
|
942
|
-
const [parseCommits, filterRevertedCommits] = await this.loadDeps();
|
|
943
|
-
if (filterReverts) {
|
|
944
|
-
yield* filterRevertedCommits(this.getCommits(gitLogParams, parserOptions));
|
|
945
|
-
return;
|
|
946
|
-
}
|
|
947
|
-
const parse2 = parseCommits(parserOptions);
|
|
948
|
-
const commitsStream = this.getRawCommits(gitLogParams);
|
|
949
|
-
yield* parse2(commitsStream);
|
|
950
|
-
}
|
|
951
|
-
/**
|
|
952
|
-
* Get semver tags stream.
|
|
953
|
-
* @param params
|
|
954
|
-
* @param params.prefix - Get semver tags with specific prefix.
|
|
955
|
-
* @param params.skipUnstable - Skip semver tags with unstable versions.
|
|
956
|
-
* @param params.clean - Clean version from prefix and trash.
|
|
957
|
-
* @yields Semver tags.
|
|
958
|
-
*/
|
|
959
|
-
async *getSemverTags(params = {}) {
|
|
960
|
-
const { prefix, skipUnstable, clean } = params;
|
|
961
|
-
const tagsStream = this.getTags();
|
|
962
|
-
const unstableTagRegex = /\d+\.\d+\.\d+-.+/;
|
|
963
|
-
const cleanTag = clean ? (tag2, unprefixed2) => semver.clean(unprefixed2 || tag2) : (tag2) => tag2;
|
|
964
|
-
let unprefixed;
|
|
965
|
-
let tag;
|
|
966
|
-
for await (tag of tagsStream) {
|
|
967
|
-
if (skipUnstable && unstableTagRegex.test(tag)) {
|
|
968
|
-
continue;
|
|
969
|
-
}
|
|
970
|
-
if (prefix) {
|
|
971
|
-
const isPrefixed = typeof prefix === "string" ? tag.startsWith(prefix) : prefix.test(tag);
|
|
972
|
-
if (isPrefixed) {
|
|
973
|
-
unprefixed = tag.replace(prefix, "");
|
|
974
|
-
if (semver.valid(unprefixed)) {
|
|
975
|
-
tag = cleanTag(tag, unprefixed);
|
|
976
|
-
if (tag) {
|
|
977
|
-
yield tag;
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
} else if (semver.valid(tag)) {
|
|
982
|
-
tag = cleanTag(tag);
|
|
983
|
-
if (tag) {
|
|
984
|
-
yield tag;
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
/**
|
|
990
|
-
* Get last semver tag.
|
|
991
|
-
* @param params - getSemverTags params.
|
|
992
|
-
* @returns Last semver tag, `null` if not found.
|
|
993
|
-
*/
|
|
994
|
-
async getLastSemverTag(params = {}) {
|
|
995
|
-
return firstFromStream(this.getSemverTags(params));
|
|
996
|
-
}
|
|
997
|
-
/**
|
|
998
|
-
* Get current sematic version from git tags.
|
|
999
|
-
* @param params - Additional git params.
|
|
1000
|
-
* @returns Current sematic version, `null` if not found.
|
|
1001
|
-
*/
|
|
1002
|
-
async getVersionFromTags(params = {}) {
|
|
1003
|
-
const semverTagsStream = this.getSemverTags({
|
|
1004
|
-
clean: true,
|
|
1005
|
-
...params
|
|
1006
|
-
});
|
|
1007
|
-
const semverTags = [];
|
|
1008
|
-
for await (const tag of semverTagsStream) {
|
|
1009
|
-
semverTags.push(tag);
|
|
1010
|
-
}
|
|
1011
|
-
if (!semverTags.length) {
|
|
1012
|
-
return null;
|
|
1013
|
-
}
|
|
1014
|
-
return semverTags.sort(semver.rcompare)[0] || null;
|
|
1015
|
-
}
|
|
1016
|
-
};
|
|
1017
|
-
|
|
1018
|
-
// ../../node_modules/.pnpm/conventional-changelog-preset-loader@5.0.0/node_modules/conventional-changelog-preset-loader/dist/presetLoader.js
|
|
1019
|
-
import path4 from "path";
|
|
1020
|
-
function resolvePresetNameVariants(preset) {
|
|
1021
|
-
if (path4.isAbsolute(preset)) {
|
|
1022
|
-
return [preset];
|
|
1023
|
-
}
|
|
1024
|
-
let scope = "";
|
|
1025
|
-
let name = preset.toLocaleLowerCase();
|
|
1026
|
-
if (preset.startsWith("@")) {
|
|
1027
|
-
const parts = preset.split("/");
|
|
1028
|
-
scope = `${parts.shift()}/`;
|
|
1029
|
-
if (scope === "@conventional-changelog/") {
|
|
1030
|
-
return [preset];
|
|
1031
|
-
}
|
|
1032
|
-
name = parts.join("/");
|
|
1033
|
-
}
|
|
1034
|
-
if (!name.startsWith("conventional-changelog-")) {
|
|
1035
|
-
name = `conventional-changelog-${name}`;
|
|
1036
|
-
}
|
|
1037
|
-
const altPreset = `${scope}${name}`;
|
|
1038
|
-
if (altPreset !== preset) {
|
|
1039
|
-
return [altPreset, preset];
|
|
1040
|
-
}
|
|
1041
|
-
return [preset];
|
|
1042
|
-
}
|
|
1043
|
-
function getModuleDefaultExport(module) {
|
|
1044
|
-
if (("__esModule" in module || Object.getPrototypeOf(module) === null) && "default" in module) {
|
|
1045
|
-
return module.default;
|
|
1046
|
-
}
|
|
1047
|
-
return module;
|
|
1048
|
-
}
|
|
1049
|
-
async function loadWithFallbacks(moduleLoader, variants) {
|
|
1050
|
-
let error = null;
|
|
1051
|
-
for (const variant of variants) {
|
|
1052
|
-
try {
|
|
1053
|
-
return getModuleDefaultExport(await moduleLoader(variant));
|
|
1054
|
-
} catch (err) {
|
|
1055
|
-
if (!error) {
|
|
1056
|
-
error = err;
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
throw error;
|
|
1061
|
-
}
|
|
1062
|
-
function createPresetLoader(moduleLoader) {
|
|
1063
|
-
return async function loadPreset2(presetOrParams) {
|
|
1064
|
-
let preset = "";
|
|
1065
|
-
let params = null;
|
|
1066
|
-
if (typeof presetOrParams === "string") {
|
|
1067
|
-
preset = presetOrParams;
|
|
1068
|
-
} else if (typeof presetOrParams === "object" && typeof presetOrParams.name === "string") {
|
|
1069
|
-
preset = presetOrParams.name;
|
|
1070
|
-
params = presetOrParams;
|
|
1071
|
-
} else {
|
|
1072
|
-
throw Error("Preset must be string or object with property `name`");
|
|
1073
|
-
}
|
|
1074
|
-
const presetNameVariants = resolvePresetNameVariants(preset);
|
|
1075
|
-
let createPreset = null;
|
|
1076
|
-
try {
|
|
1077
|
-
createPreset = await loadWithFallbacks(moduleLoader, presetNameVariants);
|
|
1078
|
-
} catch (err) {
|
|
1079
|
-
throw new Error(`Unable to load the "${preset}" preset. Please make sure it's installed.`, {
|
|
1080
|
-
cause: err
|
|
1081
|
-
});
|
|
1082
|
-
}
|
|
1083
|
-
if (typeof createPreset !== "function") {
|
|
1084
|
-
throw new Error(`The "${preset}" preset does not export a function. Maybe you are using an old version of the preset. Please upgrade.`);
|
|
1085
|
-
}
|
|
1086
|
-
return params ? await createPreset(params) : await createPreset();
|
|
1087
|
-
};
|
|
1088
|
-
}
|
|
1089
|
-
var loadPreset = createPresetLoader((preset) => import(preset));
|
|
1090
|
-
|
|
1091
|
-
// ../../node_modules/.pnpm/conventional-recommended-bump@11.2.0/node_modules/conventional-recommended-bump/dist/utils.js
|
|
1092
|
-
function isIterable(value) {
|
|
1093
|
-
return value !== null && (typeof value[Symbol.iterator] === "function" || typeof value[Symbol.asyncIterator] === "function");
|
|
1094
|
-
}
|
|
1095
|
-
function bindLogNamespace(namespace, logger) {
|
|
1096
|
-
return (messages) => logger(namespace, messages);
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
// ../../node_modules/.pnpm/conventional-recommended-bump@11.2.0/node_modules/conventional-recommended-bump/dist/bumper.js
|
|
1100
|
-
var VERSIONS = [
|
|
1101
|
-
"major",
|
|
1102
|
-
"minor",
|
|
1103
|
-
"patch"
|
|
1104
|
-
];
|
|
1105
|
-
var Bumper = class {
|
|
1106
|
-
gitClient;
|
|
1107
|
-
params;
|
|
1108
|
-
whatBump;
|
|
1109
|
-
tagGetter;
|
|
1110
|
-
commitsGetter;
|
|
1111
|
-
constructor(cwdOrGitClient = process.cwd()) {
|
|
1112
|
-
this.gitClient = typeof cwdOrGitClient === "string" ? new ConventionalGitClient(cwdOrGitClient) : cwdOrGitClient;
|
|
1113
|
-
this.whatBump = null;
|
|
1114
|
-
this.params = Promise.resolve({
|
|
1115
|
-
commits: {
|
|
1116
|
-
format: "%B%n-hash-%n%H",
|
|
1117
|
-
filterReverts: true
|
|
1118
|
-
}
|
|
1119
|
-
});
|
|
1120
|
-
this.tagGetter = () => this.getLastSemverTag();
|
|
1121
|
-
this.commitsGetter = () => this.getCommits();
|
|
1122
|
-
}
|
|
1123
|
-
composeParams(params) {
|
|
1124
|
-
this.params = Promise.all([params, this.params]).then(([params2, prevParams]) => ({
|
|
1125
|
-
options: {
|
|
1126
|
-
...prevParams.options,
|
|
1127
|
-
...params2.options
|
|
1128
|
-
},
|
|
1129
|
-
tags: {
|
|
1130
|
-
...prevParams.tags,
|
|
1131
|
-
...params2.tags
|
|
1132
|
-
},
|
|
1133
|
-
commits: {
|
|
1134
|
-
...prevParams.commits,
|
|
1135
|
-
...params2.commits
|
|
1136
|
-
},
|
|
1137
|
-
parser: {
|
|
1138
|
-
...prevParams.parser,
|
|
1139
|
-
...params2.parser
|
|
1140
|
-
}
|
|
1141
|
-
}));
|
|
1142
|
-
}
|
|
1143
|
-
async getLastSemverTag() {
|
|
1144
|
-
const { tags } = await this.params;
|
|
1145
|
-
return await this.gitClient.getLastSemverTag(tags);
|
|
1146
|
-
}
|
|
1147
|
-
async *getCommits() {
|
|
1148
|
-
const { options, commits, parser } = await this.params;
|
|
1149
|
-
const parserParams = {
|
|
1150
|
-
...parser
|
|
1151
|
-
};
|
|
1152
|
-
if (!parserParams.warn && options?.warn) {
|
|
1153
|
-
parserParams.warn = bindLogNamespace("parser", options.warn);
|
|
1154
|
-
}
|
|
1155
|
-
yield* this.gitClient.getCommits({
|
|
1156
|
-
from: await this.tagGetter() || "",
|
|
1157
|
-
...commits
|
|
1158
|
-
}, parserParams);
|
|
1159
|
-
}
|
|
1160
|
-
/**
|
|
1161
|
-
* Load configs from a preset
|
|
1162
|
-
* @param preset
|
|
1163
|
-
* @param loader - Preset module loader, if not provided, will use default loader
|
|
1164
|
-
* @returns this
|
|
1165
|
-
*/
|
|
1166
|
-
loadPreset(preset, loader) {
|
|
1167
|
-
const loadPreset2 = loader ? createPresetLoader(loader) : loadPreset;
|
|
1168
|
-
const config = loadPreset2(preset).then((config2) => {
|
|
1169
|
-
if (!config2) {
|
|
1170
|
-
throw Error("Preset is not loaded or have incorrect exports");
|
|
1171
|
-
}
|
|
1172
|
-
return config2;
|
|
1173
|
-
});
|
|
1174
|
-
this.whatBump = async (commits) => {
|
|
1175
|
-
const { whatBump } = await config;
|
|
1176
|
-
return whatBump(commits);
|
|
1177
|
-
};
|
|
1178
|
-
this.composeParams(config);
|
|
1179
|
-
return this;
|
|
1180
|
-
}
|
|
1181
|
-
/**
|
|
1182
|
-
* Set config directly
|
|
1183
|
-
* @param config - Config object
|
|
1184
|
-
* @returns this
|
|
1185
|
-
*/
|
|
1186
|
-
config(config) {
|
|
1187
|
-
this.composeParams(config);
|
|
1188
|
-
return this;
|
|
1189
|
-
}
|
|
1190
|
-
/**
|
|
1191
|
-
* Set bumper options
|
|
1192
|
-
* @param options - Bumper options
|
|
1193
|
-
* @returns this
|
|
1194
|
-
*/
|
|
1195
|
-
options(options) {
|
|
1196
|
-
this.composeParams({
|
|
1197
|
-
options
|
|
1198
|
-
});
|
|
1199
|
-
return this;
|
|
1200
|
-
}
|
|
1201
|
-
/**
|
|
1202
|
-
* Set params to get the last semver tag
|
|
1203
|
-
* @param paramsOrTag - Params to get the last semver tag or a tag name
|
|
1204
|
-
* @returns this
|
|
1205
|
-
*/
|
|
1206
|
-
tag(paramsOrTag) {
|
|
1207
|
-
if (typeof paramsOrTag === "string") {
|
|
1208
|
-
this.tagGetter = () => paramsOrTag;
|
|
1209
|
-
} else {
|
|
1210
|
-
this.tagGetter = () => this.getLastSemverTag();
|
|
1211
|
-
this.composeParams({
|
|
1212
|
-
tags: paramsOrTag
|
|
1213
|
-
});
|
|
1214
|
-
}
|
|
1215
|
-
return this;
|
|
1216
|
-
}
|
|
1217
|
-
commits(paramsOrCommits, parserOptions) {
|
|
1218
|
-
if (isIterable(paramsOrCommits)) {
|
|
1219
|
-
this.commitsGetter = () => paramsOrCommits;
|
|
1220
|
-
} else {
|
|
1221
|
-
this.commitsGetter = () => this.getCommits();
|
|
1222
|
-
this.composeParams({
|
|
1223
|
-
commits: paramsOrCommits,
|
|
1224
|
-
parser: parserOptions
|
|
1225
|
-
});
|
|
1226
|
-
}
|
|
1227
|
-
return this;
|
|
1228
|
-
}
|
|
1229
|
-
/**
|
|
1230
|
-
* Recommend a bump by `whatBump` function
|
|
1231
|
-
* @param whatBump - Function to recommend a bump from commits
|
|
1232
|
-
* @returns Bump recommendation
|
|
1233
|
-
*/
|
|
1234
|
-
async bump(whatBump = this.whatBump) {
|
|
1235
|
-
if (typeof whatBump !== "function") {
|
|
1236
|
-
throw Error("`whatBump` must be a function");
|
|
1237
|
-
}
|
|
1238
|
-
const { gitClient } = this;
|
|
1239
|
-
const { options } = await this.params;
|
|
1240
|
-
if (!gitClient.debug && options?.debug) {
|
|
1241
|
-
gitClient.debug = bindLogNamespace("git-client", options.debug);
|
|
1242
|
-
}
|
|
1243
|
-
const commitsStream = this.commitsGetter();
|
|
1244
|
-
const commits = [];
|
|
1245
|
-
let commit;
|
|
1246
|
-
for await (commit of commitsStream) {
|
|
1247
|
-
commits.push(commit);
|
|
1248
|
-
}
|
|
1249
|
-
const result = await whatBump(commits);
|
|
1250
|
-
if (result && "level" in result) {
|
|
1251
|
-
return {
|
|
1252
|
-
...result,
|
|
1253
|
-
releaseType: VERSIONS[result.level],
|
|
1254
|
-
commits
|
|
1255
|
-
};
|
|
1256
|
-
}
|
|
1257
|
-
return {
|
|
1258
|
-
commits
|
|
1259
|
-
};
|
|
1260
|
-
}
|
|
1261
|
-
};
|
|
1262
|
-
|
|
1263
|
-
// src/core/versionCalculator.ts
|
|
1264
|
-
import semver4 from "semver";
|
|
585
|
+
import { Bumper } from "conventional-recommended-bump";
|
|
586
|
+
import semver3 from "semver";
|
|
1265
587
|
|
|
1266
588
|
// src/git/repository.ts
|
|
1267
589
|
import { existsSync as existsSync3, statSync } from "fs";
|
|
@@ -1273,7 +595,7 @@ function getCurrentBranch() {
|
|
|
1273
595
|
|
|
1274
596
|
// src/git/tagsAndBranches.ts
|
|
1275
597
|
import { getSemverTags } from "git-semver-tags";
|
|
1276
|
-
import
|
|
598
|
+
import semver from "semver";
|
|
1277
599
|
|
|
1278
600
|
// src/utils/logging.ts
|
|
1279
601
|
import chalk from "chalk";
|
|
@@ -1391,9 +713,9 @@ async function getLatestTag(versionPrefix) {
|
|
|
1391
713
|
}
|
|
1392
714
|
const chronologicalLatest = tags[0];
|
|
1393
715
|
const sortedTags = [...tags].sort((a, b) => {
|
|
1394
|
-
const versionA =
|
|
1395
|
-
const versionB =
|
|
1396
|
-
return
|
|
716
|
+
const versionA = semver.clean(a) || "0.0.0";
|
|
717
|
+
const versionB = semver.clean(b) || "0.0.0";
|
|
718
|
+
return semver.rcompare(versionA, versionB);
|
|
1397
719
|
});
|
|
1398
720
|
const semanticLatest = sortedTags[0];
|
|
1399
721
|
if (semanticLatest !== chronologicalLatest) {
|
|
@@ -1485,11 +807,11 @@ async function getLatestTagForPackage(packageName, versionPrefix, options) {
|
|
|
1485
807
|
|
|
1486
808
|
// src/utils/manifestHelpers.ts
|
|
1487
809
|
import fs6 from "fs";
|
|
1488
|
-
import
|
|
810
|
+
import path5 from "path";
|
|
1489
811
|
|
|
1490
812
|
// src/cargo/cargoHandler.ts
|
|
1491
813
|
import fs5 from "fs";
|
|
1492
|
-
import
|
|
814
|
+
import path4 from "path";
|
|
1493
815
|
import * as TOML2 from "smol-toml";
|
|
1494
816
|
function getCargoInfo(cargoPath) {
|
|
1495
817
|
if (!fs5.existsSync(cargoPath)) {
|
|
@@ -1506,7 +828,7 @@ function getCargoInfo(cargoPath) {
|
|
|
1506
828
|
name: cargo.package.name,
|
|
1507
829
|
version: cargo.package.version || "0.0.0",
|
|
1508
830
|
path: cargoPath,
|
|
1509
|
-
dir:
|
|
831
|
+
dir: path4.dirname(cargoPath),
|
|
1510
832
|
content: cargo
|
|
1511
833
|
};
|
|
1512
834
|
} catch (error) {
|
|
@@ -1549,8 +871,8 @@ function updateCargoVersion(cargoPath, version, dryRun = false) {
|
|
|
1549
871
|
|
|
1550
872
|
// src/utils/manifestHelpers.ts
|
|
1551
873
|
function getVersionFromManifests(packageDir) {
|
|
1552
|
-
const packageJsonPath =
|
|
1553
|
-
const cargoTomlPath =
|
|
874
|
+
const packageJsonPath = path5.join(packageDir, "package.json");
|
|
875
|
+
const cargoTomlPath = path5.join(packageDir, "Cargo.toml");
|
|
1554
876
|
if (fs6.existsSync(packageJsonPath)) {
|
|
1555
877
|
try {
|
|
1556
878
|
const packageJson = JSON.parse(fs6.readFileSync(packageJsonPath, "utf-8"));
|
|
@@ -1597,7 +919,7 @@ function getVersionFromManifests(packageDir) {
|
|
|
1597
919
|
|
|
1598
920
|
// src/utils/versionUtils.ts
|
|
1599
921
|
import fs7 from "fs";
|
|
1600
|
-
import
|
|
922
|
+
import semver2 from "semver";
|
|
1601
923
|
|
|
1602
924
|
// src/git/tagVerification.ts
|
|
1603
925
|
function verifyTag(tagName, cwd3) {
|
|
@@ -1639,33 +961,33 @@ function normalizePrereleaseIdentifier(prereleaseIdentifier, config) {
|
|
|
1639
961
|
return void 0;
|
|
1640
962
|
}
|
|
1641
963
|
function bumpVersion(currentVersion, bumpType, prereleaseIdentifier) {
|
|
1642
|
-
if (prereleaseIdentifier && STANDARD_BUMP_TYPES.includes(bumpType) && !
|
|
964
|
+
if (prereleaseIdentifier && STANDARD_BUMP_TYPES.includes(bumpType) && !semver2.prerelease(currentVersion)) {
|
|
1643
965
|
const preBumpType = `pre${bumpType}`;
|
|
1644
966
|
log(`Creating prerelease version with identifier '${prereleaseIdentifier}' using ${preBumpType}`, "debug");
|
|
1645
|
-
return
|
|
967
|
+
return semver2.inc(currentVersion, preBumpType, prereleaseIdentifier) || "";
|
|
1646
968
|
}
|
|
1647
|
-
if (
|
|
1648
|
-
const parsed =
|
|
969
|
+
if (semver2.prerelease(currentVersion) && STANDARD_BUMP_TYPES.includes(bumpType)) {
|
|
970
|
+
const parsed = semver2.parse(currentVersion);
|
|
1649
971
|
if (!parsed) {
|
|
1650
|
-
return
|
|
972
|
+
return semver2.inc(currentVersion, bumpType) || "";
|
|
1651
973
|
}
|
|
1652
974
|
if (bumpType === "major" && parsed.minor === 0 && parsed.patch === 0 || bumpType === "minor" && parsed.patch === 0 || bumpType === "patch") {
|
|
1653
975
|
log(`Cleaning prerelease identifier from ${currentVersion} for ${bumpType} bump`, "debug");
|
|
1654
976
|
return `${parsed.major}.${parsed.minor}.${parsed.patch}`;
|
|
1655
977
|
}
|
|
1656
978
|
log(`Standard increment for ${currentVersion} with ${bumpType} bump`, "debug");
|
|
1657
|
-
return
|
|
979
|
+
return semver2.inc(currentVersion, bumpType) || "";
|
|
1658
980
|
}
|
|
1659
981
|
if (prereleaseIdentifier) {
|
|
1660
|
-
return
|
|
982
|
+
return semver2.inc(currentVersion, bumpType, prereleaseIdentifier) || "";
|
|
1661
983
|
}
|
|
1662
|
-
return
|
|
984
|
+
return semver2.inc(currentVersion, bumpType) || "";
|
|
1663
985
|
}
|
|
1664
986
|
function detectVersionMismatch(tagVersion, packageVersion) {
|
|
1665
|
-
const tagIsPrerelease =
|
|
1666
|
-
const packageIsPrerelease =
|
|
1667
|
-
const tagParsed =
|
|
1668
|
-
const packageParsed =
|
|
987
|
+
const tagIsPrerelease = semver2.prerelease(tagVersion) !== null;
|
|
988
|
+
const packageIsPrerelease = semver2.prerelease(packageVersion) !== null;
|
|
989
|
+
const tagParsed = semver2.parse(tagVersion);
|
|
990
|
+
const packageParsed = semver2.parse(packageVersion);
|
|
1669
991
|
if (!tagParsed || !packageParsed) {
|
|
1670
992
|
return { isMismatch: false, severity: "minor", message: "" };
|
|
1671
993
|
}
|
|
@@ -1676,9 +998,9 @@ function detectVersionMismatch(tagVersion, packageVersion) {
|
|
|
1676
998
|
message: `Git tag ${tagVersion} (stable) is ahead of package ${packageVersion} (prerelease). This may indicate a reverted release. Consider deleting tag ${tagVersion} or updating package.json.`
|
|
1677
999
|
};
|
|
1678
1000
|
}
|
|
1679
|
-
const tagHigher =
|
|
1001
|
+
const tagHigher = semver2.gt(tagVersion, packageVersion);
|
|
1680
1002
|
if (tagHigher) {
|
|
1681
|
-
const diff =
|
|
1003
|
+
const diff = semver2.diff(packageVersion, tagVersion);
|
|
1682
1004
|
if (diff === "major" || diff === "minor") {
|
|
1683
1005
|
return {
|
|
1684
1006
|
isMismatch: true,
|
|
@@ -1777,7 +1099,7 @@ To resolve: delete the conflicting tag, update package.json, or change mismatchS
|
|
|
1777
1099
|
};
|
|
1778
1100
|
}
|
|
1779
1101
|
}
|
|
1780
|
-
if (
|
|
1102
|
+
if (semver2.gt(cleanPackageVersion, cleanTagVersion)) {
|
|
1781
1103
|
log(`Package version ${packageVersion} is newer than git tag ${tagName}, using package version`, "info");
|
|
1782
1104
|
return {
|
|
1783
1105
|
source: "package",
|
|
@@ -1786,7 +1108,7 @@ To resolve: delete the conflicting tag, update package.json, or change mismatchS
|
|
|
1786
1108
|
mismatch: mismatchInfo
|
|
1787
1109
|
};
|
|
1788
1110
|
}
|
|
1789
|
-
if (
|
|
1111
|
+
if (semver2.gt(cleanTagVersion, cleanPackageVersion)) {
|
|
1790
1112
|
log(`Git tag ${tagName} is newer than package version ${packageVersion}, using git tag`, "info");
|
|
1791
1113
|
return {
|
|
1792
1114
|
source: "git",
|
|
@@ -1847,12 +1169,12 @@ async function calculateVersion(config, options) {
|
|
|
1847
1169
|
if (hasNoTags) {
|
|
1848
1170
|
return initialVersion;
|
|
1849
1171
|
}
|
|
1850
|
-
const cleanedTag =
|
|
1851
|
-
return
|
|
1172
|
+
const cleanedTag = semver3.clean(latestTag) || latestTag;
|
|
1173
|
+
return semver3.clean(cleanedTag.replace(new RegExp(`^${escapedTagPattern}`), "")) || "0.0.0";
|
|
1852
1174
|
}
|
|
1853
1175
|
if (versionSource.source === "git") {
|
|
1854
|
-
const cleanedTag =
|
|
1855
|
-
return
|
|
1176
|
+
const cleanedTag = semver3.clean(versionSource.version) || versionSource.version;
|
|
1177
|
+
return semver3.clean(cleanedTag.replace(new RegExp(`^${escapedTagPattern}`), "")) || "0.0.0";
|
|
1856
1178
|
}
|
|
1857
1179
|
return versionSource.version;
|
|
1858
1180
|
};
|
|
@@ -1876,7 +1198,7 @@ async function calculateVersion(config, options) {
|
|
|
1876
1198
|
const specifiedType = type;
|
|
1877
1199
|
if (specifiedType) {
|
|
1878
1200
|
const currentVersion = getCurrentVersionFromSource2();
|
|
1879
|
-
const isCurrentPrerelease =
|
|
1201
|
+
const isCurrentPrerelease = semver3.prerelease(currentVersion);
|
|
1880
1202
|
const explicitlyRequestedPrerelease = config.isPrerelease;
|
|
1881
1203
|
if (STANDARD_BUMP_TYPES.includes(specifiedType) && (isCurrentPrerelease || explicitlyRequestedPrerelease)) {
|
|
1882
1204
|
const prereleaseId2 = explicitlyRequestedPrerelease || isCurrentPrerelease ? normalizedPrereleaseId : void 0;
|
|
@@ -1972,7 +1294,7 @@ async function calculateVersion(config, options) {
|
|
|
1972
1294
|
|
|
1973
1295
|
// src/package/packageProcessor.ts
|
|
1974
1296
|
import * as fs9 from "fs";
|
|
1975
|
-
import
|
|
1297
|
+
import path7 from "path";
|
|
1976
1298
|
|
|
1977
1299
|
// src/changelog/commitParser.ts
|
|
1978
1300
|
var CONVENTIONAL_COMMIT_REGEX = /^(\w+)(?:\(([^)]+)\))?(!)?: (.+)(?:\n\n([\s\S]*))?/;
|
|
@@ -1980,8 +1302,8 @@ var BREAKING_CHANGE_REGEX = /BREAKING CHANGE: ([\s\S]+?)(?:\n\n|$)/;
|
|
|
1980
1302
|
function extractAllChangelogEntriesWithHash(projectDir, revisionRange) {
|
|
1981
1303
|
try {
|
|
1982
1304
|
const args = ["log", revisionRange, "--pretty=format:%H|||%B---COMMIT_DELIMITER---", "--no-merges"];
|
|
1983
|
-
const
|
|
1984
|
-
const commits =
|
|
1305
|
+
const output = execSync("git", args, { cwd: projectDir, encoding: "utf8" }).toString();
|
|
1306
|
+
const commits = output.split("---COMMIT_DELIMITER---").filter((commit) => commit.trim() !== "");
|
|
1985
1307
|
return commits.map((commit) => {
|
|
1986
1308
|
const [hash, ...messageParts] = commit.split("|||");
|
|
1987
1309
|
const message = messageParts.join("|||").trim();
|
|
@@ -1999,14 +1321,14 @@ function extractAllChangelogEntriesWithHash(projectDir, revisionRange) {
|
|
|
1999
1321
|
}
|
|
2000
1322
|
function commitTouchesAnyPackage(projectDir, commitHash, packageDirs, sharedPackageDirs = []) {
|
|
2001
1323
|
try {
|
|
2002
|
-
const
|
|
1324
|
+
const output = execSync("git", ["diff-tree", "--no-commit-id", "--name-only", "-r", commitHash], {
|
|
2003
1325
|
cwd: projectDir,
|
|
2004
1326
|
encoding: "utf8"
|
|
2005
1327
|
}).toString().trim();
|
|
2006
|
-
if (!
|
|
1328
|
+
if (!output) {
|
|
2007
1329
|
return false;
|
|
2008
1330
|
}
|
|
2009
|
-
const changedFiles =
|
|
1331
|
+
const changedFiles = output.split("\n");
|
|
2010
1332
|
return changedFiles.some((file) => {
|
|
2011
1333
|
return packageDirs.some((pkgDir) => {
|
|
2012
1334
|
if (sharedPackageDirs.some((sharedDir) => pkgDir.includes(sharedDir))) {
|
|
@@ -2053,8 +1375,8 @@ function extractCommitsFromGitLog(projectDir, revisionRange, filterToPath) {
|
|
|
2053
1375
|
if (filterToPath) {
|
|
2054
1376
|
args.push("--", ".");
|
|
2055
1377
|
}
|
|
2056
|
-
const
|
|
2057
|
-
const commits =
|
|
1378
|
+
const output = execSync("git", args, { cwd: projectDir, encoding: "utf8" }).toString();
|
|
1379
|
+
const commits = output.split("---COMMIT_DELIMITER---").filter((commit) => commit.trim() !== "");
|
|
2058
1380
|
return commits.map((commit) => parseCommitMessage(commit)).filter((entry) => entry !== null);
|
|
2059
1381
|
} catch (error) {
|
|
2060
1382
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -2177,7 +1499,7 @@ function shouldProcessPackage(packageName, skip = []) {
|
|
|
2177
1499
|
|
|
2178
1500
|
// src/package/packageManagement.ts
|
|
2179
1501
|
import fs8 from "fs";
|
|
2180
|
-
import
|
|
1502
|
+
import path6 from "path";
|
|
2181
1503
|
function updatePackageVersion(packagePath, version, dryRun = false) {
|
|
2182
1504
|
if (isCargoToml(packagePath)) {
|
|
2183
1505
|
updateCargoVersion(packagePath, version, dryRun);
|
|
@@ -2362,7 +1684,7 @@ var PackageProcessor = class {
|
|
|
2362
1684
|
}
|
|
2363
1685
|
let repoUrl;
|
|
2364
1686
|
try {
|
|
2365
|
-
const packageJsonPath2 =
|
|
1687
|
+
const packageJsonPath2 = path7.join(pkgPath, "package.json");
|
|
2366
1688
|
if (fs9.existsSync(packageJsonPath2)) {
|
|
2367
1689
|
const packageJson = JSON.parse(fs9.readFileSync(packageJsonPath2, "utf8"));
|
|
2368
1690
|
if (packageJson.repository) {
|
|
@@ -2390,7 +1712,7 @@ var PackageProcessor = class {
|
|
|
2390
1712
|
repoUrl: repoUrl || null,
|
|
2391
1713
|
entries: changelogEntries
|
|
2392
1714
|
});
|
|
2393
|
-
const packageJsonPath =
|
|
1715
|
+
const packageJsonPath = path7.join(pkgPath, "package.json");
|
|
2394
1716
|
if (fs9.existsSync(packageJsonPath)) {
|
|
2395
1717
|
updatePackageVersion(packageJsonPath, nextVersion, this.dryRun);
|
|
2396
1718
|
}
|
|
@@ -2401,7 +1723,7 @@ var PackageProcessor = class {
|
|
|
2401
1723
|
log(`Cargo paths config for ${name}: ${JSON.stringify(cargoPaths)}`, "debug");
|
|
2402
1724
|
if (cargoPaths && cargoPaths.length > 0) {
|
|
2403
1725
|
for (const cargoPath of cargoPaths) {
|
|
2404
|
-
const resolvedCargoPath =
|
|
1726
|
+
const resolvedCargoPath = path7.resolve(pkgPath, cargoPath, "Cargo.toml");
|
|
2405
1727
|
log(`Checking cargo path for ${name}: ${resolvedCargoPath}`, "debug");
|
|
2406
1728
|
if (fs9.existsSync(resolvedCargoPath)) {
|
|
2407
1729
|
log(`Found Cargo.toml for ${name} at ${resolvedCargoPath}, updating...`, "debug");
|
|
@@ -2411,7 +1733,7 @@ var PackageProcessor = class {
|
|
|
2411
1733
|
}
|
|
2412
1734
|
}
|
|
2413
1735
|
} else {
|
|
2414
|
-
const cargoTomlPath =
|
|
1736
|
+
const cargoTomlPath = path7.join(pkgPath, "Cargo.toml");
|
|
2415
1737
|
log(`Checking default cargo path for ${name}: ${cargoTomlPath}`, "debug");
|
|
2416
1738
|
if (fs9.existsSync(cargoTomlPath)) {
|
|
2417
1739
|
log(`Found Cargo.toml for ${name} at ${cargoTomlPath}, updating...`, "debug");
|
|
@@ -2480,7 +1802,7 @@ var PackageProcessor = class {
|
|
|
2480
1802
|
|
|
2481
1803
|
// src/core/versionStrategies.ts
|
|
2482
1804
|
import fs10 from "fs";
|
|
2483
|
-
import * as
|
|
1805
|
+
import * as path8 from "path";
|
|
2484
1806
|
function shouldProcessPackage2(pkg, config) {
|
|
2485
1807
|
const pkgName = pkg.packageJson.name;
|
|
2486
1808
|
return shouldProcessPackage(pkgName, config.skip);
|
|
@@ -2494,14 +1816,14 @@ function updateCargoFiles(packageDir, version, cargoConfig, dryRun = false) {
|
|
|
2494
1816
|
const cargoPaths = cargoConfig?.paths;
|
|
2495
1817
|
if (cargoPaths && cargoPaths.length > 0) {
|
|
2496
1818
|
for (const cargoPath of cargoPaths) {
|
|
2497
|
-
const resolvedCargoPath =
|
|
1819
|
+
const resolvedCargoPath = path8.resolve(packageDir, cargoPath, "Cargo.toml");
|
|
2498
1820
|
if (fs10.existsSync(resolvedCargoPath)) {
|
|
2499
1821
|
updatePackageVersion(resolvedCargoPath, version, dryRun);
|
|
2500
1822
|
updatedFiles.push(resolvedCargoPath);
|
|
2501
1823
|
}
|
|
2502
1824
|
}
|
|
2503
1825
|
} else {
|
|
2504
|
-
const cargoTomlPath =
|
|
1826
|
+
const cargoTomlPath = path8.join(packageDir, "Cargo.toml");
|
|
2505
1827
|
if (fs10.existsSync(cargoTomlPath)) {
|
|
2506
1828
|
updatePackageVersion(cargoTomlPath, version, dryRun);
|
|
2507
1829
|
updatedFiles.push(cargoTomlPath);
|
|
@@ -2582,7 +1904,7 @@ function createSyncStrategy(config) {
|
|
|
2582
1904
|
const processedPaths = /* @__PURE__ */ new Set();
|
|
2583
1905
|
try {
|
|
2584
1906
|
if (packages.root) {
|
|
2585
|
-
const rootPkgPath =
|
|
1907
|
+
const rootPkgPath = path8.join(packages.root, "package.json");
|
|
2586
1908
|
if (fs10.existsSync(rootPkgPath)) {
|
|
2587
1909
|
updatePackageVersion(rootPkgPath, nextVersion, dryRun);
|
|
2588
1910
|
files.push(rootPkgPath);
|
|
@@ -2602,7 +1924,7 @@ function createSyncStrategy(config) {
|
|
|
2602
1924
|
if (!shouldProcessPackage2(pkg, config)) {
|
|
2603
1925
|
continue;
|
|
2604
1926
|
}
|
|
2605
|
-
const packageJsonPath =
|
|
1927
|
+
const packageJsonPath = path8.join(pkg.dir, "package.json");
|
|
2606
1928
|
if (processedPaths.has(packageJsonPath)) {
|
|
2607
1929
|
continue;
|
|
2608
1930
|
}
|
|
@@ -2661,7 +1983,7 @@ function createSyncStrategy(config) {
|
|
|
2661
1983
|
let repoUrl = null;
|
|
2662
1984
|
for (const searchPath of [mainPkgPath, versionSourcePath].filter(Boolean)) {
|
|
2663
1985
|
try {
|
|
2664
|
-
const pkgJsonPath =
|
|
1986
|
+
const pkgJsonPath = path8.join(searchPath, "package.json");
|
|
2665
1987
|
if (fs10.existsSync(pkgJsonPath)) {
|
|
2666
1988
|
const pkgJson = JSON.parse(fs10.readFileSync(pkgJsonPath, "utf8"));
|
|
2667
1989
|
let url;
|
|
@@ -2830,7 +2152,7 @@ function createSingleStrategy(config) {
|
|
|
2830
2152
|
}
|
|
2831
2153
|
let repoUrl;
|
|
2832
2154
|
try {
|
|
2833
|
-
const packageJsonPath2 =
|
|
2155
|
+
const packageJsonPath2 = path8.join(pkgPath, "package.json");
|
|
2834
2156
|
if (fs10.existsSync(packageJsonPath2)) {
|
|
2835
2157
|
const packageJson = JSON.parse(fs10.readFileSync(packageJsonPath2, "utf8"));
|
|
2836
2158
|
if (packageJson.repository) {
|
|
@@ -2858,7 +2180,7 @@ function createSingleStrategy(config) {
|
|
|
2858
2180
|
repoUrl: repoUrl || null,
|
|
2859
2181
|
entries: changelogEntries
|
|
2860
2182
|
});
|
|
2861
|
-
const packageJsonPath =
|
|
2183
|
+
const packageJsonPath = path8.join(pkgPath, "package.json");
|
|
2862
2184
|
updatePackageVersion(packageJsonPath, nextVersion, dryRun);
|
|
2863
2185
|
const filesToCommit = [packageJsonPath];
|
|
2864
2186
|
const cargoFiles = updateCargoFiles(pkgPath, nextVersion, config.cargo, dryRun);
|
|
@@ -2964,7 +2286,7 @@ var GitError = class extends BaseVersionError {
|
|
|
2964
2286
|
};
|
|
2965
2287
|
|
|
2966
2288
|
// src/utils/packageFiltering.ts
|
|
2967
|
-
import
|
|
2289
|
+
import path9 from "path";
|
|
2968
2290
|
import { minimatch as minimatch2 } from "minimatch";
|
|
2969
2291
|
function filterPackagesByConfig(packages, configTargets, workspaceRoot) {
|
|
2970
2292
|
if (configTargets.length === 0) {
|
|
@@ -2990,7 +2312,7 @@ function filterByDirectoryPattern(packages, pattern, workspaceRoot) {
|
|
|
2990
2312
|
}
|
|
2991
2313
|
const normalizedPattern = pattern.replace(/\\/g, "/");
|
|
2992
2314
|
return packages.filter((pkg) => {
|
|
2993
|
-
const relativePath =
|
|
2315
|
+
const relativePath = path9.relative(workspaceRoot, pkg.dir);
|
|
2994
2316
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
2995
2317
|
if (normalizedPattern === normalizedRelativePath) {
|
|
2996
2318
|
return true;
|