@reelout/core 0.5.3 → 0.7.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/analyzer.js +23 -6
- package/dist/analyzer.js.map +1 -1
- package/dist/builder.js +2 -2
- package/dist/builder.js.map +1 -1
- package/dist/changelog.js +1 -1
- package/dist/index.js +2 -22
- package/dist/index.js.map +1 -1
- package/dist/{workflow-CxxvBV04.js → workflow-BolfadM0.js} +135 -136
- package/dist/workflow-BolfadM0.js.map +1 -0
- package/package.json +1 -1
- package/src/analyzer.ts +45 -12
- package/src/builder.ts +2 -2
- package/src/git/history/index.ts +2 -2
- package/src/git/history/{showGitHistory.ts → readGitHistory.ts} +3 -3
- package/src/git/history/{showParsedGitHistory.ts → readParsedGitHistory.ts} +6 -6
- package/src/git/tag/generateGitTagName.ts +1 -0
- package/src/git/tag/index.ts +1 -1
- package/src/git/tag/{isGitTagPointed.ts → isGitTagExact.ts} +1 -1
- package/src/types.ts +1 -0
- package/src/util/isMatch.ts +11 -7
- package/src/workflow/analysis/deriveChangeReleases.ts +3 -3
- package/src/workflow/analysis/deriveTransitionReleases.ts +1 -1
- package/src/workflow/analysis/index.ts +2 -4
- package/src/workflow/analysis/{isCommitForPackage.ts → packageContainsCommit.ts} +4 -1
- package/src/workflow/analysis/readPackageHistory.ts +53 -0
- package/src/workflow/{committing → commit}/index.ts +0 -1
- package/src/workflow/discovery/filterPackages.ts +27 -0
- package/src/workflow/discovery/index.ts +1 -0
- package/src/workflow/discovery/verifyPackageTag.ts +2 -2
- package/src/workflow/index.ts +2 -2
- package/src/workflow/{versioning/determineReleaseType.ts → version/deriveCommitReleaseType.ts} +2 -2
- package/src/workflow/{versioning → version}/deriveReleaseType.ts +2 -2
- package/src/workflow/{versioning → version}/index.ts +2 -1
- package/dist/workflow-CxxvBV04.js.map +0 -1
- package/src/workflow/analysis/sliceUnreleased.ts +0 -36
- package/src/workflow/analysis/streamPackageCommits.ts +0 -34
- package/src/workflow/committing/isReleaseCommit.ts +0 -56
- /package/src/workflow/{committing → commit}/generateReleaseCommitMessage.ts +0 -0
- /package/src/workflow/{versioning → version}/bumpVersion.ts +0 -0
- /package/src/workflow/{versioning → version}/extractVersionQualifier.ts +0 -0
- /package/src/workflow/{versioning → version}/isSameReleaseCycle.ts +0 -0
- /package/src/workflow/{versioning → version}/isStableVersion.ts +0 -0
- /package/src/workflow/{versioning → version}/pickPriorityReleaseType.ts +0 -0
- /package/src/workflow/{analysis → version}/promotePrereleaseVersions.ts +0 -0
|
@@ -14,7 +14,7 @@ import assert from "node:assert";
|
|
|
14
14
|
import createPreset from "conventional-changelog-conventionalcommits";
|
|
15
15
|
import { writeChangelogString } from "conventional-changelog-writer";
|
|
16
16
|
import { toMarkdown } from "mdast-util-to-markdown";
|
|
17
|
-
// src/workflow/
|
|
17
|
+
// src/workflow/version/extractVersionQualifier.ts
|
|
18
18
|
/**
|
|
19
19
|
* Extract the version qualifier string from a parsed `SemVer` instance.
|
|
20
20
|
*
|
|
@@ -31,7 +31,7 @@ function extractVersionQualifier(version) {
|
|
|
31
31
|
return prerelease.join(".");
|
|
32
32
|
} else return;
|
|
33
33
|
}
|
|
34
|
-
// src/workflow/
|
|
34
|
+
// src/workflow/version/bumpVersion.ts
|
|
35
35
|
/**
|
|
36
36
|
* Bump a semantic version string based on release and transition rules.
|
|
37
37
|
*
|
|
@@ -65,9 +65,9 @@ function bumpVersion(options) {
|
|
|
65
65
|
}
|
|
66
66
|
return semver.inc(parsed, release, { loose: false }, identifier, "0");
|
|
67
67
|
}
|
|
68
|
-
// src/workflow/
|
|
68
|
+
// src/workflow/version/deriveCommitReleaseType.ts
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
70
|
+
* Derive the release type for a single commit.
|
|
71
71
|
*
|
|
72
72
|
* Returns `'minor'` for a commit marked as a breaking change while the
|
|
73
73
|
* supplied `version` is zero-major (`0.y.z`), and `'major'` otherwise, since
|
|
@@ -81,7 +81,7 @@ function bumpVersion(options) {
|
|
|
81
81
|
* @param version Current package version used to adjust zero-major breaking releases
|
|
82
82
|
* @returns `ReleaseType` string, or `null` when no matching rule applies
|
|
83
83
|
*/
|
|
84
|
-
function
|
|
84
|
+
function deriveCommitReleaseType(classifier, commit, version) {
|
|
85
85
|
if (commit.notes.length > 0) return semver.parse(version)?.major === 0 ? "minor" : "major";
|
|
86
86
|
const type = classifier(commit);
|
|
87
87
|
switch (type) {
|
|
@@ -91,7 +91,7 @@ function determineReleaseType(classifier, commit, version) {
|
|
|
91
91
|
}
|
|
92
92
|
return null;
|
|
93
93
|
}
|
|
94
|
-
// src/workflow/
|
|
94
|
+
// src/workflow/version/pickPriorityReleaseType.ts
|
|
95
95
|
/**
|
|
96
96
|
* Determine the highest-priority release type between two candidates.
|
|
97
97
|
*
|
|
@@ -110,7 +110,7 @@ function pickPriorityReleaseType(curr, next) {
|
|
|
110
110
|
]) if (curr === type || next === type) return type;
|
|
111
111
|
return null;
|
|
112
112
|
}
|
|
113
|
-
// src/workflow/
|
|
113
|
+
// src/workflow/version/deriveReleaseType.ts
|
|
114
114
|
/**
|
|
115
115
|
* Derive the combined release type from a release plan.
|
|
116
116
|
*
|
|
@@ -126,10 +126,10 @@ function pickPriorityReleaseType(curr, next) {
|
|
|
126
126
|
*/
|
|
127
127
|
function deriveReleaseType(classifier, plan) {
|
|
128
128
|
let releaseType = null;
|
|
129
|
-
for (const commit of plan.history) releaseType = pickPriorityReleaseType(releaseType,
|
|
129
|
+
for (const commit of plan.history) releaseType = pickPriorityReleaseType(releaseType, deriveCommitReleaseType(classifier, commit, plan.package.version));
|
|
130
130
|
return releaseType;
|
|
131
131
|
}
|
|
132
|
-
// src/workflow/
|
|
132
|
+
// src/workflow/version/isSameReleaseCycle.ts
|
|
133
133
|
/**
|
|
134
134
|
* Determine whether two semantic version strings or objects belong to the same release cycle.
|
|
135
135
|
*
|
|
@@ -149,7 +149,7 @@ function isSameReleaseCycle(currentVersion, nextVersion) {
|
|
|
149
149
|
if (current.compareMain(next) === 0) return true;
|
|
150
150
|
return current.major === 0 && (current.minor > 0 || current.patch > 0) && next.major === 1 && next.minor === 0 && next.patch === 0;
|
|
151
151
|
}
|
|
152
|
-
// src/workflow/
|
|
152
|
+
// src/workflow/version/isStableVersion.ts
|
|
153
153
|
/**
|
|
154
154
|
* Determine whether a version string represents a stable SemVer release.
|
|
155
155
|
*
|
|
@@ -169,6 +169,41 @@ function isStableVersion(version) {
|
|
|
169
169
|
if (!parsed) throw new Error(`The version "${colors.bold(version)}" is not a valid SemVer.`);
|
|
170
170
|
return parsed.major > 0 && parsed.prerelease.length === 0;
|
|
171
171
|
}
|
|
172
|
+
// src/workflow/version/promotePrereleaseVersions.ts
|
|
173
|
+
/**
|
|
174
|
+
* Promote prerelease versions when they have no explicit release type.
|
|
175
|
+
*
|
|
176
|
+
* Analyzes prerelease and zero-major versions to determine an appropriate
|
|
177
|
+
* release type for graduation:
|
|
178
|
+
* - Prerelease versions are promoted based on their highest incremented component
|
|
179
|
+
* (patch, minor, or major)
|
|
180
|
+
* - Zero-major versions (0.y.z) are promoted to major
|
|
181
|
+
* - Stable versions (1.0.0+) remain unchanged
|
|
182
|
+
* - Plans with explicit releases are preserved as-is
|
|
183
|
+
*
|
|
184
|
+
* @param plans Release plans to analyze
|
|
185
|
+
* @returns Plans with inferred release types for prerelease versions
|
|
186
|
+
*/
|
|
187
|
+
async function promotePrereleaseVersions(plans) {
|
|
188
|
+
return plans.map((plan) => {
|
|
189
|
+
if (plan.release) return plan;
|
|
190
|
+
if (!plan.package.tag) return plan;
|
|
191
|
+
const parsed = semver.parse(plan.package.version);
|
|
192
|
+
if (!parsed) return plan;
|
|
193
|
+
let type;
|
|
194
|
+
if (parsed.prerelease.length) {
|
|
195
|
+
if (parsed.patch !== 0) type = "patch";
|
|
196
|
+
else if (parsed.minor !== 0) type = "minor";
|
|
197
|
+
else if (parsed.major !== 0) type = "major";
|
|
198
|
+
else type = "major";
|
|
199
|
+
} else if (parsed.major === 0) type = "major";
|
|
200
|
+
if (type) return {
|
|
201
|
+
...plan,
|
|
202
|
+
release: { type }
|
|
203
|
+
};
|
|
204
|
+
return plan;
|
|
205
|
+
});
|
|
206
|
+
}
|
|
172
207
|
// src/config/const.ts
|
|
173
208
|
var ALL_FILES = "**/*";
|
|
174
209
|
var DEFAULT_CHANGELOG_FILE = "CHANGELOG.md";
|
|
@@ -540,18 +575,17 @@ function isClass(func) {
|
|
|
540
575
|
/**
|
|
541
576
|
* Determine whether a target string matches glob patterns.
|
|
542
577
|
*
|
|
543
|
-
* Matches positive and negative glob patterns using dotfile support.
|
|
544
|
-
*
|
|
578
|
+
* Matches positive and negative glob patterns using dotfile support.
|
|
579
|
+
* Negation-only patterns are expanded with a catch-all pattern so they match
|
|
580
|
+
* every named target the patterns do not exclude.
|
|
545
581
|
*
|
|
546
582
|
* @param target Target string to evaluate against glob patterns
|
|
547
583
|
* @param patterns Single glob pattern or list of patterns to evaluate
|
|
548
584
|
* @returns True if target matches positive patterns and satisfies negative patterns
|
|
549
585
|
*/
|
|
550
586
|
function isMatch(target, patterns) {
|
|
551
|
-
if (typeof patterns === "string")
|
|
552
|
-
|
|
553
|
-
else patterns = [patterns];
|
|
554
|
-
}
|
|
587
|
+
if (typeof patterns === "string") patterns = [patterns];
|
|
588
|
+
if (patterns.length > 0 && patterns.every((pattern) => pattern.startsWith("!"))) patterns = ["**/*", ...patterns];
|
|
555
589
|
const positives = [];
|
|
556
590
|
const negatives = [];
|
|
557
591
|
for (const pattern of patterns) if (pattern.startsWith("!")) negatives.push(pattern);
|
|
@@ -585,6 +619,26 @@ async function readJson(filePath) {
|
|
|
585
619
|
if (typeof json !== "object" || json === null) throw new Error(`JSON file at "${colors.bold(filePath)}" does not contain a valid object.`);
|
|
586
620
|
return json;
|
|
587
621
|
}
|
|
622
|
+
// src/util/unique.ts
|
|
623
|
+
/**
|
|
624
|
+
* Return a new array containing only the first-seen occurrence of each item.
|
|
625
|
+
*
|
|
626
|
+
* This preserves the original iteration order and performs equality checks
|
|
627
|
+
* using JavaScript's `Set` semantics (i.e., primitives by value, objects by
|
|
628
|
+
* reference). The input array is not mutated.
|
|
629
|
+
*
|
|
630
|
+
* @param array The array of items to deduplicate
|
|
631
|
+
* @returns A new array with duplicates removed, preserving first-seen order
|
|
632
|
+
*/
|
|
633
|
+
function unique(array) {
|
|
634
|
+
const seen = /* @__PURE__ */ new Set();
|
|
635
|
+
const result = [];
|
|
636
|
+
for (const item of array) if (!seen.has(item)) {
|
|
637
|
+
seen.add(item);
|
|
638
|
+
result.push(item);
|
|
639
|
+
}
|
|
640
|
+
return result;
|
|
641
|
+
}
|
|
588
642
|
// src/util/writeJson.ts
|
|
589
643
|
/**
|
|
590
644
|
* Write a JSON `payload` to `filePath`, formatting the content first.
|
|
@@ -725,7 +779,7 @@ function resolveVersionQualifier(options) {
|
|
|
725
779
|
if (resolved && !isSemVer(`1.0.0-${resolved}.1`)) throw new Error(`The resolved version qualifier "${resolved}" is not a valid SemVer prerelease identifier.`);
|
|
726
780
|
return resolved;
|
|
727
781
|
}
|
|
728
|
-
// src/workflow/analysis/
|
|
782
|
+
// src/workflow/analysis/packageContainsCommit.ts
|
|
729
783
|
/**
|
|
730
784
|
* Test whether a commit modifies files in a package.
|
|
731
785
|
*
|
|
@@ -733,7 +787,7 @@ function resolveVersionQualifier(options) {
|
|
|
733
787
|
* @param commit Parsed commit containing changed file paths
|
|
734
788
|
* @returns `true` if any changed file matches the package pattern
|
|
735
789
|
*/
|
|
736
|
-
function
|
|
790
|
+
function packageContainsCommit(pkg, commit) {
|
|
737
791
|
return commit.files.some((file) => {
|
|
738
792
|
const { location } = pkg;
|
|
739
793
|
return isMatch(file, pkg.files || path.join(location, "**/*"));
|
|
@@ -758,7 +812,7 @@ function isCommitForPackage(pkg, commit) {
|
|
|
758
812
|
*/
|
|
759
813
|
async function deriveChangeReleases(hint, classifier, plans, history) {
|
|
760
814
|
for await (const commit of history) plans = plans.map((plan) => {
|
|
761
|
-
if (!
|
|
815
|
+
if (!packageContainsCommit(plan.package, commit)) return plan;
|
|
762
816
|
return {
|
|
763
817
|
...plan,
|
|
764
818
|
history: plan.history.concat(commit)
|
|
@@ -846,41 +900,6 @@ function deriveTransitionReleases(hint, versionQualifier, plans) {
|
|
|
846
900
|
};
|
|
847
901
|
});
|
|
848
902
|
}
|
|
849
|
-
// src/workflow/analysis/promotePrereleaseVersions.ts
|
|
850
|
-
/**
|
|
851
|
-
* Promote prerelease versions when they have no explicit release type.
|
|
852
|
-
*
|
|
853
|
-
* Analyzes prerelease and zero-major versions to determine an appropriate
|
|
854
|
-
* release type for graduation:
|
|
855
|
-
* - Prerelease versions are promoted based on their highest incremented component
|
|
856
|
-
* (patch, minor, or major)
|
|
857
|
-
* - Zero-major versions (0.y.z) are promoted to major
|
|
858
|
-
* - Stable versions (1.0.0+) remain unchanged
|
|
859
|
-
* - Plans with explicit releases are preserved as-is
|
|
860
|
-
*
|
|
861
|
-
* @param plans Release plans to analyze
|
|
862
|
-
* @returns Plans with inferred release types for prerelease versions
|
|
863
|
-
*/
|
|
864
|
-
async function promotePrereleaseVersions(plans) {
|
|
865
|
-
return plans.map((plan) => {
|
|
866
|
-
if (plan.release) return plan;
|
|
867
|
-
if (!plan.package.tag) return plan;
|
|
868
|
-
const parsed = semver.parse(plan.package.version);
|
|
869
|
-
if (!parsed) return plan;
|
|
870
|
-
let type;
|
|
871
|
-
if (parsed.prerelease.length) {
|
|
872
|
-
if (parsed.patch !== 0) type = "patch";
|
|
873
|
-
else if (parsed.minor !== 0) type = "minor";
|
|
874
|
-
else if (parsed.major !== 0) type = "major";
|
|
875
|
-
else type = "major";
|
|
876
|
-
} else if (parsed.major === 0) type = "major";
|
|
877
|
-
if (type) return {
|
|
878
|
-
...plan,
|
|
879
|
-
release: { type }
|
|
880
|
-
};
|
|
881
|
-
return plan;
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
903
|
// src/git/branch/getCurrentGitBranch.ts
|
|
885
904
|
/**
|
|
886
905
|
* Get the current Git branch name.
|
|
@@ -1426,20 +1445,7 @@ async function mergeGitHistory(cwd, a, b) {
|
|
|
1426
1445
|
if (j) merged.push(j);
|
|
1427
1446
|
return merged.concat(a2).concat(b2);
|
|
1428
1447
|
}
|
|
1429
|
-
// src/git/history/
|
|
1430
|
-
/**
|
|
1431
|
-
* Convert a shallow clone into a full clone by fetching additional history.
|
|
1432
|
-
*
|
|
1433
|
-
* Runs `git fetch --unshallow`. Returns `true` when the operation succeeds
|
|
1434
|
-
* and `false` on error.
|
|
1435
|
-
*
|
|
1436
|
-
* @param cwd Repository working directory
|
|
1437
|
-
* @returns `true` when the operation succeeded, otherwise `false`
|
|
1438
|
-
*/
|
|
1439
|
-
function restoreFullGitHistory(cwd) {
|
|
1440
|
-
return execGit(cwd, ["fetch", "--unshallow"]).then(() => true).catch(() => false);
|
|
1441
|
-
}
|
|
1442
|
-
// src/git/history/showGitHistory.ts
|
|
1448
|
+
// src/git/history/readGitHistory.ts
|
|
1443
1449
|
/**
|
|
1444
1450
|
* Yield commit SHAs from repository history in paginated order.
|
|
1445
1451
|
*
|
|
@@ -1451,7 +1457,7 @@ function restoreFullGitHistory(cwd) {
|
|
|
1451
1457
|
* @param options Supports `from`, `until`, `pageSize`, and `filePath`
|
|
1452
1458
|
* @yields Commit SHA strings in paginated order
|
|
1453
1459
|
*/
|
|
1454
|
-
async function*
|
|
1460
|
+
async function* readGitHistory(cwd, options = {}) {
|
|
1455
1461
|
try {
|
|
1456
1462
|
const { filePath, pageSize = 50 } = options;
|
|
1457
1463
|
let from = options.from || "HEAD";
|
|
@@ -1482,23 +1488,36 @@ async function* showGitHistory(cwd, options = {}) {
|
|
|
1482
1488
|
}
|
|
1483
1489
|
} catch {}
|
|
1484
1490
|
}
|
|
1485
|
-
// src/git/history/
|
|
1491
|
+
// src/git/history/readParsedGitHistory.ts
|
|
1486
1492
|
/**
|
|
1487
1493
|
* Yield parsed commits sequentially from repository history.
|
|
1488
1494
|
*
|
|
1489
|
-
* Fetches commits using `
|
|
1495
|
+
* Fetches commits using `readGitHistory` and parses each commit with
|
|
1490
1496
|
* `getParsedGitCommit`. Yields successfully parsed `GitCommit` objects on demand
|
|
1491
1497
|
* and skips unparsable commits.
|
|
1492
1498
|
*
|
|
1493
1499
|
* @param cwd Repository working directory path
|
|
1494
|
-
* @param options Filter and pagination options passed to `
|
|
1500
|
+
* @param options Filter and pagination options passed to `readGitHistory`
|
|
1495
1501
|
* @yields Parsed `GitCommit` objects in historical order
|
|
1496
1502
|
*/
|
|
1497
|
-
async function*
|
|
1498
|
-
for await (const commit of
|
|
1503
|
+
async function* readParsedGitHistory(cwd, options) {
|
|
1504
|
+
for await (const commit of readGitHistory(cwd, options)) try {
|
|
1499
1505
|
yield await getParsedGitCommit(cwd, commit);
|
|
1500
1506
|
} catch {}
|
|
1501
1507
|
}
|
|
1508
|
+
// src/git/history/restoreFullGitHistory.ts
|
|
1509
|
+
/**
|
|
1510
|
+
* Convert a shallow clone into a full clone by fetching additional history.
|
|
1511
|
+
*
|
|
1512
|
+
* Runs `git fetch --unshallow`. Returns `true` when the operation succeeds
|
|
1513
|
+
* and `false` on error.
|
|
1514
|
+
*
|
|
1515
|
+
* @param cwd Repository working directory
|
|
1516
|
+
* @returns `true` when the operation succeeded, otherwise `false`
|
|
1517
|
+
*/
|
|
1518
|
+
function restoreFullGitHistory(cwd) {
|
|
1519
|
+
return execGit(cwd, ["fetch", "--unshallow"]).then(() => true).catch(() => false);
|
|
1520
|
+
}
|
|
1502
1521
|
// src/git/repository/getGitConfigValue.ts
|
|
1503
1522
|
/**
|
|
1504
1523
|
* Get a local git configuration value for `key` in the repository at `cwd`.
|
|
@@ -1824,7 +1843,7 @@ async function isGitTagConnected(cwd, tag) {
|
|
|
1824
1843
|
return false;
|
|
1825
1844
|
}
|
|
1826
1845
|
}
|
|
1827
|
-
// src/git/tag/
|
|
1846
|
+
// src/git/tag/isGitTagExact.ts
|
|
1828
1847
|
/**
|
|
1829
1848
|
* Check whether a given tag points to the provided commit.
|
|
1830
1849
|
*
|
|
@@ -1833,7 +1852,7 @@ async function isGitTagConnected(cwd, tag) {
|
|
|
1833
1852
|
* @param commit Commit hash to compare against
|
|
1834
1853
|
* @returns `true` when the tag points at `commit`, otherwise `false`
|
|
1835
1854
|
*/
|
|
1836
|
-
async function
|
|
1855
|
+
async function isGitTagExact(cwd, tag, commit) {
|
|
1837
1856
|
try {
|
|
1838
1857
|
await execGit(cwd, [
|
|
1839
1858
|
"merge-base",
|
|
@@ -1987,7 +2006,7 @@ async function verifyPackageTag(cwd, pkg, tagName) {
|
|
|
1987
2006
|
} catch {
|
|
1988
2007
|
return false;
|
|
1989
2008
|
}
|
|
1990
|
-
if (!
|
|
2009
|
+
if (!packageContainsCommit(pkg, tagCommit)) return false;
|
|
1991
2010
|
await expandGitHistory(cwd, { until: tagRef });
|
|
1992
2011
|
return isGitTagConnected(cwd, tagName);
|
|
1993
2012
|
}
|
|
@@ -2030,6 +2049,22 @@ async function discoverPackageTag(cwd, pkg) {
|
|
|
2030
2049
|
message: await getGitTagMessage(cwd, expectedTagName)
|
|
2031
2050
|
};
|
|
2032
2051
|
}
|
|
2052
|
+
// src/workflow/discovery/filterPackages.ts
|
|
2053
|
+
/**
|
|
2054
|
+
* Filter packages by name patterns.
|
|
2055
|
+
*
|
|
2056
|
+
* Keeps the packages whose names match `patterns`, scoping a release run to
|
|
2057
|
+
* a subset of the discovered workspace. Returns a copy of every package when
|
|
2058
|
+
* `patterns` is empty.
|
|
2059
|
+
*
|
|
2060
|
+
* @param packages Workspace packages to filter
|
|
2061
|
+
* @param patterns Minimatch patterns to match package names against
|
|
2062
|
+
* @returns Packages whose names match the patterns
|
|
2063
|
+
*/
|
|
2064
|
+
function filterPackages(packages, patterns) {
|
|
2065
|
+
if (patterns.length === 0) return [...packages];
|
|
2066
|
+
return packages.filter((pkg) => isMatch(pkg.name ?? "", patterns));
|
|
2067
|
+
}
|
|
2033
2068
|
// src/workflow/discovery/resolvePackageStableTag.ts
|
|
2034
2069
|
/**
|
|
2035
2070
|
* Resolve the latest stable Git tag for a package.
|
|
@@ -2136,70 +2171,34 @@ async function propagateDependencyUpdates(cwd, plans) {
|
|
|
2136
2171
|
return plan;
|
|
2137
2172
|
});
|
|
2138
2173
|
}
|
|
2139
|
-
// src/workflow/
|
|
2140
|
-
|
|
2141
|
-
* Determine whether a commit represents a release or matches a release marker.
|
|
2142
|
-
*
|
|
2143
|
-
* Resolves string commit identifiers to parsed commit objects, checks if any
|
|
2144
|
-
* associated trailer matches the `marker` predicate, and falls back to
|
|
2145
|
-
* verifying exact tag matches for the `commit` hash.
|
|
2146
|
-
*
|
|
2147
|
-
* @param cwd Working directory path for Git commands
|
|
2148
|
-
* @param commit Commit object, hash string, or nullish value
|
|
2149
|
-
* @param marker Trailer key string or predicate function to evaluate
|
|
2150
|
-
* @returns `true` if the commit is a release commit, otherwise `false`
|
|
2151
|
-
*/
|
|
2152
|
-
async function isReleaseCommit(cwd, commit, marker = GIT_TRAILER_RELEASE_AGENT) {
|
|
2153
|
-
if (typeof commit === "string") try {
|
|
2154
|
-
commit = await getParsedGitCommit(cwd, commit, typeof marker === "string" ? [marker] : []);
|
|
2155
|
-
} catch {
|
|
2156
|
-
commit = null;
|
|
2157
|
-
}
|
|
2158
|
-
if (!commit) return false;
|
|
2159
|
-
const predicate = typeof marker === "string" ? (trailer) => trailer.key === marker && !!trailer.value : marker;
|
|
2160
|
-
if (commit.trailers.some(predicate)) return true;
|
|
2161
|
-
return execGit(cwd, [
|
|
2162
|
-
"describe",
|
|
2163
|
-
"--tags",
|
|
2164
|
-
"--exact-match",
|
|
2165
|
-
commit.hash
|
|
2166
|
-
]).then(() => true).catch(() => false);
|
|
2167
|
-
}
|
|
2168
|
-
// src/workflow/analysis/sliceUnreleased.ts
|
|
2169
|
-
/**
|
|
2170
|
-
* Yield parsed commits from the workspace until a release commit is found.
|
|
2171
|
-
*
|
|
2172
|
-
* Iterates through parsed commit history and yields unreleased commits in
|
|
2173
|
-
* order. Stops processing upon reaching the first release commit.
|
|
2174
|
-
*
|
|
2175
|
-
* @param cwd Path to the working directory
|
|
2176
|
-
* @param options Options for configuring Git history retrieval
|
|
2177
|
-
* @yields Parsed `Commit` objects up to the most recent release commit
|
|
2178
|
-
*/
|
|
2179
|
-
async function* sliceUnreleased(cwd, options) {
|
|
2180
|
-
for await (const commit of showParsedGitHistory(cwd, options)) {
|
|
2181
|
-
if (await isReleaseCommit(cwd, commit, options?.marker)) break;
|
|
2182
|
-
yield commit;
|
|
2183
|
-
}
|
|
2184
|
-
}
|
|
2185
|
-
// src/workflow/analysis/streamPackageCommits.ts
|
|
2174
|
+
// src/workflow/analysis/readPackageHistory.ts
|
|
2175
|
+
var LITERAL_PATH = /^[^*?[\]{}!+@]*$/;
|
|
2186
2176
|
/**
|
|
2187
2177
|
* Yield commits from git history associated with a package.
|
|
2188
2178
|
*
|
|
2189
|
-
* Filters git commit history to
|
|
2190
|
-
* `pkg` directory.
|
|
2179
|
+
* Filters git commit history to yield only entries relevant to the target
|
|
2180
|
+
* `pkg` directory. When the package file pattern is a list, plain file
|
|
2181
|
+
* entries are added to the git path filter alongside the package directory
|
|
2182
|
+
* (duplicates removed), so commits touching extra package files (for example
|
|
2183
|
+
* the pnpm workspace manifest) are included. Only entries without glob or
|
|
2184
|
+
* pattern metacharacters (wildcards, braces, and the extglob or negation
|
|
2185
|
+
* characters used by package file patterns) are passed to git, because git
|
|
2186
|
+
* pathspecs would interpret those characters differently. Pattern-like
|
|
2187
|
+
* entries are left to `packageContainsCommit`, which matches them with the
|
|
2188
|
+
* package's own file-pattern semantics.
|
|
2191
2189
|
*
|
|
2192
2190
|
* @param cwd Path to the working directory for git commands
|
|
2193
2191
|
* @param pkg Package configuration containing the target directory
|
|
2194
2192
|
* @param options Options for parsing and filtering git history
|
|
2195
2193
|
* @yields Commits belonging to the specified package
|
|
2196
2194
|
*/
|
|
2197
|
-
async function*
|
|
2198
|
-
options = {
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2195
|
+
async function* readPackageHistory(cwd, pkg, options = {}) {
|
|
2196
|
+
options = { ...options };
|
|
2197
|
+
if (!options.filePath) {
|
|
2198
|
+
if (Array.isArray(pkg.files)) options.filePath = unique([pkg.location, ...pkg.files.filter((file) => LITERAL_PATH.test(file))]);
|
|
2199
|
+
else options.filePath = pkg.location;
|
|
2200
|
+
}
|
|
2201
|
+
for await (const commit of readParsedGitHistory(cwd, options)) if (packageContainsCommit(pkg, commit)) yield commit;
|
|
2203
2202
|
}
|
|
2204
2203
|
// src/workflow/changelog/buildChangelog.ts
|
|
2205
2204
|
var preset = await createPreset();
|
|
@@ -2355,8 +2354,8 @@ async function writeChangelog(cwd, plan) {
|
|
|
2355
2354
|
}
|
|
2356
2355
|
}
|
|
2357
2356
|
// package.json
|
|
2358
|
-
var version = "0.
|
|
2359
|
-
// src/workflow/
|
|
2357
|
+
var version = "0.6.0";
|
|
2358
|
+
// src/workflow/commit/generateReleaseCommitMessage.ts
|
|
2360
2359
|
var NOTABLE_TYPES = [
|
|
2361
2360
|
"feat",
|
|
2362
2361
|
"fix",
|
|
@@ -2653,6 +2652,6 @@ async function executeReleaseWorkflow(context, plugins) {
|
|
|
2653
2652
|
printReleaseReport(context.logger, generateReleaseReport(context));
|
|
2654
2653
|
}
|
|
2655
2654
|
}
|
|
2656
|
-
export {
|
|
2655
|
+
export { getCurrentGitCommit as $, generateGitTagName as A, buildTrailerPattern as At, getGitConfigValue as B, deriveReleaseType as Bt, extractPlainText as C, isClass as Ct, getLatestGitTag as D, execCommand as Dt, isGitTagConnected as E, execGit as Et, readGitFile as F, RELEASE_HOOK_NAMES as Ft, GIT_REL_FLAGS as G, readParsedGitHistory as H, deriveCommitReleaseType as Ht, resolveGitRepository as I, SEMVER_REGEX as It, resolveGitRevision as J, detectGitRelationship as K, pushGitChanges as L, promotePrereleaseVersions as Lt, isGitTagPresent as M, DEFAULT_CHANGELOG_FILE as Mt, deleteGitTag as N, DEV_NULL as Nt, getGitTagMessage as O, compact as Ot, createGitTag as P, GIT_TRAILER_RELEASE_AGENT as Pt, countGitHistory as Q, getGitRemote as R, isStableVersion as Rt, extractSemVer as S, isMatch as St, isGitTagExact as T, formatFile as Tt, readGitHistory as U, bumpVersion as Ut, restoreFullGitHistory as V, pickPriorityReleaseType as Vt, mergeGitHistory as W, extractVersionQualifier as Wt, withShallowLock as X, isGitAncestor as Y, isGitShallowRepository as Z, filterPackages as _, findReleaseRule as _t, HookPriority as a, TTLCache as at, extractLatestVersion as b, unique as bt, writeChangelog as c, getCurrentGitBranch as ct, buildReleaseNotes as d, packageContainsCommit as dt, getParsedGitCommit as et, buildChangelog as f, resolveVersionQualifier as ft, resolvePackageStableTag as g, isSemVer as gt, resolvePackageTag as h, isSemVerGitTag as ht, HookManager as i, parseGitCommit as it, ensureGitTag as j, ALL_FILES as jt, getCurrentGitTag as k, isDefined as kt, prependChangelog as l, deriveTransitionReleases as lt, propagateDependencyUpdates as m, sanitizePrereleaseLabel as mt, printReleaseReport as n, GIT_PRETTY_FORMAT as nt, generateReleaseCommitMessage as o, extractMentions as ot, readPackageHistory as p, resolveReleaseChannel as pt, expandGitHistory as q, generateReleaseReport as r, parseGitPrettyFormat as rt, version as s, createGitCommit as st, executeReleaseWorkflow as t, GIT_PRETTY_FIELD_SEPARATOR as tt, extractPreviousVersion as u, deriveChangeReleases as ut, discoverPackageTag as v, createPlugin as vt, buildDependencyGraph as w, interpolate as wt, iterateChangelogVersions as x, readJson as xt, verifyPackageTag as y, writeJson as yt, ensureGitUserConfig as z, isSameReleaseCycle as zt };
|
|
2657
2656
|
|
|
2658
|
-
//# sourceMappingURL=workflow-
|
|
2657
|
+
//# sourceMappingURL=workflow-BolfadM0.js.map
|