@releasekit/version 0.2.0-next.10 → 0.2.0-next.11
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-DXDB5P7S.js → chunk-25A2IEAC.js} +57 -25
- package/dist/cli.cjs +57 -25
- package/dist/cli.js +1 -1
- package/dist/index.cjs +57 -25
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -969,9 +969,9 @@ import { exit } from "process";
|
|
|
969
969
|
// src/changelog/commitParser.ts
|
|
970
970
|
var CONVENTIONAL_COMMIT_REGEX = /^(\w+)(?:\(([^)]+)\))?(!)?: (.+)(?:\n\n([\s\S]*))?/;
|
|
971
971
|
var BREAKING_CHANGE_REGEX = /BREAKING CHANGE: ([\s\S]+?)(?:\n\n|$)/;
|
|
972
|
-
function
|
|
972
|
+
function extractAllChangelogEntriesWithHash(projectDir, revisionRange) {
|
|
973
973
|
try {
|
|
974
|
-
const args = ["log", revisionRange, "--pretty=format:%H|||%B---COMMIT_DELIMITER---", "--no-merges"
|
|
974
|
+
const args = ["log", revisionRange, "--pretty=format:%H|||%B---COMMIT_DELIMITER---", "--no-merges"];
|
|
975
975
|
const output = execSync("git", args, { cwd: projectDir, encoding: "utf8" }).toString();
|
|
976
976
|
const commits = output.split("---COMMIT_DELIMITER---").filter((commit) => commit.trim() !== "");
|
|
977
977
|
return commits.map((commit) => {
|
|
@@ -985,27 +985,54 @@ function extractChangelogEntriesWithHash(projectDir, revisionRange) {
|
|
|
985
985
|
}).filter((item) => item !== null);
|
|
986
986
|
} catch (error) {
|
|
987
987
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
988
|
-
log(`Error extracting commits with hash: ${errorMessage}`, "error");
|
|
988
|
+
log(`Error extracting all commits with hash: ${errorMessage}`, "error");
|
|
989
989
|
return [];
|
|
990
990
|
}
|
|
991
991
|
}
|
|
992
|
-
function
|
|
992
|
+
function commitTouchesAnyPackage(projectDir, commitHash, packageDirs, sharedPackageDirs = []) {
|
|
993
993
|
try {
|
|
994
|
-
const
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
994
|
+
const output = execSync("git", ["diff-tree", "--no-commit-id", "--name-only", "-r", commitHash], {
|
|
995
|
+
cwd: projectDir,
|
|
996
|
+
encoding: "utf8"
|
|
997
|
+
}).toString().trim();
|
|
998
|
+
if (!output) {
|
|
999
|
+
return false;
|
|
1000
|
+
}
|
|
1001
|
+
const changedFiles = output.split("\n");
|
|
1002
|
+
return changedFiles.some((file) => {
|
|
1003
|
+
return packageDirs.some((pkgDir) => {
|
|
1004
|
+
if (sharedPackageDirs.some((sharedDir) => pkgDir.includes(sharedDir))) {
|
|
1005
|
+
return false;
|
|
1006
|
+
}
|
|
1007
|
+
const normalizedFile = file.replace(/\\/g, "/");
|
|
1008
|
+
const normalizedPkgDir = pkgDir.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
1009
|
+
return normalizedFile.startsWith(normalizedPkgDir);
|
|
1010
|
+
});
|
|
1011
|
+
});
|
|
1006
1012
|
} catch (error) {
|
|
1007
|
-
|
|
1008
|
-
|
|
1013
|
+
log(
|
|
1014
|
+
`Error checking if commit ${commitHash} touches packages: ${error instanceof Error ? error.message : String(error)}`,
|
|
1015
|
+
"debug"
|
|
1016
|
+
);
|
|
1017
|
+
return false;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
function extractRepoLevelChangelogEntries(projectDir, revisionRange, packageDirs, sharedPackageDirs = []) {
|
|
1021
|
+
try {
|
|
1022
|
+
const allCommits = extractAllChangelogEntriesWithHash(projectDir, revisionRange);
|
|
1023
|
+
const repoLevelCommits = allCommits.filter((commit) => {
|
|
1024
|
+
const touchesPackage = commitTouchesAnyPackage(projectDir, commit.hash, packageDirs, sharedPackageDirs);
|
|
1025
|
+
return !touchesPackage;
|
|
1026
|
+
});
|
|
1027
|
+
if (repoLevelCommits.length > 0) {
|
|
1028
|
+
log(
|
|
1029
|
+
`Found ${repoLevelCommits.length} repo-level commit(s) (including shared packages: ${sharedPackageDirs.join(", ")})`,
|
|
1030
|
+
"debug"
|
|
1031
|
+
);
|
|
1032
|
+
}
|
|
1033
|
+
return repoLevelCommits.map((c) => c.entry);
|
|
1034
|
+
} catch (error) {
|
|
1035
|
+
log(`Error extracting repo-level commits: ${error instanceof Error ? error.message : String(error)}`, "warning");
|
|
1009
1036
|
return [];
|
|
1010
1037
|
}
|
|
1011
1038
|
}
|
|
@@ -1458,13 +1485,18 @@ var PackageProcessor = class {
|
|
|
1458
1485
|
revisionRange = "HEAD";
|
|
1459
1486
|
}
|
|
1460
1487
|
changelogEntries = extractChangelogEntriesFromCommits(pkgPath, revisionRange);
|
|
1461
|
-
const
|
|
1462
|
-
const
|
|
1463
|
-
const
|
|
1464
|
-
const
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1488
|
+
const allPackageDirs = packages.map((p) => p.dir);
|
|
1489
|
+
const sharedPackageNames = ["config", "core", "@releasekit/config", "@releasekit/core"];
|
|
1490
|
+
const sharedPackageDirs = packages.filter((p) => sharedPackageNames.includes(p.packageJson.name)).map((p) => p.dir);
|
|
1491
|
+
const repoLevelEntries = extractRepoLevelChangelogEntries(
|
|
1492
|
+
pkgPath,
|
|
1493
|
+
revisionRange,
|
|
1494
|
+
allPackageDirs,
|
|
1495
|
+
sharedPackageDirs
|
|
1496
|
+
);
|
|
1497
|
+
if (repoLevelEntries.length > 0) {
|
|
1498
|
+
log(`Adding ${repoLevelEntries.length} repo-level commit(s) to ${name} changelog`, "debug");
|
|
1499
|
+
changelogEntries = [...repoLevelEntries, ...changelogEntries];
|
|
1468
1500
|
}
|
|
1469
1501
|
if (changelogEntries.length === 0) {
|
|
1470
1502
|
changelogEntries = [
|
package/dist/cli.cjs
CHANGED
|
@@ -401,9 +401,9 @@ var path6 = __toESM(require("path"), 1);
|
|
|
401
401
|
init_commandExecutor();
|
|
402
402
|
var CONVENTIONAL_COMMIT_REGEX = /^(\w+)(?:\(([^)]+)\))?(!)?: (.+)(?:\n\n([\s\S]*))?/;
|
|
403
403
|
var BREAKING_CHANGE_REGEX = /BREAKING CHANGE: ([\s\S]+?)(?:\n\n|$)/;
|
|
404
|
-
function
|
|
404
|
+
function extractAllChangelogEntriesWithHash(projectDir, revisionRange) {
|
|
405
405
|
try {
|
|
406
|
-
const args = ["log", revisionRange, "--pretty=format:%H|||%B---COMMIT_DELIMITER---", "--no-merges"
|
|
406
|
+
const args = ["log", revisionRange, "--pretty=format:%H|||%B---COMMIT_DELIMITER---", "--no-merges"];
|
|
407
407
|
const output = execSync("git", args, { cwd: projectDir, encoding: "utf8" }).toString();
|
|
408
408
|
const commits = output.split("---COMMIT_DELIMITER---").filter((commit) => commit.trim() !== "");
|
|
409
409
|
return commits.map((commit) => {
|
|
@@ -417,27 +417,54 @@ function extractChangelogEntriesWithHash(projectDir, revisionRange) {
|
|
|
417
417
|
}).filter((item) => item !== null);
|
|
418
418
|
} catch (error) {
|
|
419
419
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
420
|
-
log(`Error extracting commits with hash: ${errorMessage}`, "error");
|
|
420
|
+
log(`Error extracting all commits with hash: ${errorMessage}`, "error");
|
|
421
421
|
return [];
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
function
|
|
424
|
+
function commitTouchesAnyPackage(projectDir, commitHash, packageDirs, sharedPackageDirs = []) {
|
|
425
425
|
try {
|
|
426
|
-
const
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
426
|
+
const output = execSync("git", ["diff-tree", "--no-commit-id", "--name-only", "-r", commitHash], {
|
|
427
|
+
cwd: projectDir,
|
|
428
|
+
encoding: "utf8"
|
|
429
|
+
}).toString().trim();
|
|
430
|
+
if (!output) {
|
|
431
|
+
return false;
|
|
432
|
+
}
|
|
433
|
+
const changedFiles = output.split("\n");
|
|
434
|
+
return changedFiles.some((file) => {
|
|
435
|
+
return packageDirs.some((pkgDir) => {
|
|
436
|
+
if (sharedPackageDirs.some((sharedDir) => pkgDir.includes(sharedDir))) {
|
|
437
|
+
return false;
|
|
438
|
+
}
|
|
439
|
+
const normalizedFile = file.replace(/\\/g, "/");
|
|
440
|
+
const normalizedPkgDir = pkgDir.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
441
|
+
return normalizedFile.startsWith(normalizedPkgDir);
|
|
442
|
+
});
|
|
443
|
+
});
|
|
438
444
|
} catch (error) {
|
|
439
|
-
|
|
440
|
-
|
|
445
|
+
log(
|
|
446
|
+
`Error checking if commit ${commitHash} touches packages: ${error instanceof Error ? error.message : String(error)}`,
|
|
447
|
+
"debug"
|
|
448
|
+
);
|
|
449
|
+
return false;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
function extractRepoLevelChangelogEntries(projectDir, revisionRange, packageDirs, sharedPackageDirs = []) {
|
|
453
|
+
try {
|
|
454
|
+
const allCommits = extractAllChangelogEntriesWithHash(projectDir, revisionRange);
|
|
455
|
+
const repoLevelCommits = allCommits.filter((commit) => {
|
|
456
|
+
const touchesPackage = commitTouchesAnyPackage(projectDir, commit.hash, packageDirs, sharedPackageDirs);
|
|
457
|
+
return !touchesPackage;
|
|
458
|
+
});
|
|
459
|
+
if (repoLevelCommits.length > 0) {
|
|
460
|
+
log(
|
|
461
|
+
`Found ${repoLevelCommits.length} repo-level commit(s) (including shared packages: ${sharedPackageDirs.join(", ")})`,
|
|
462
|
+
"debug"
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
return repoLevelCommits.map((c) => c.entry);
|
|
466
|
+
} catch (error) {
|
|
467
|
+
log(`Error extracting repo-level commits: ${error instanceof Error ? error.message : String(error)}`, "warning");
|
|
441
468
|
return [];
|
|
442
469
|
}
|
|
443
470
|
}
|
|
@@ -1634,13 +1661,18 @@ var PackageProcessor = class {
|
|
|
1634
1661
|
revisionRange = "HEAD";
|
|
1635
1662
|
}
|
|
1636
1663
|
changelogEntries = extractChangelogEntriesFromCommits(pkgPath, revisionRange);
|
|
1637
|
-
const
|
|
1638
|
-
const
|
|
1639
|
-
const
|
|
1640
|
-
const
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1664
|
+
const allPackageDirs = packages.map((p) => p.dir);
|
|
1665
|
+
const sharedPackageNames = ["config", "core", "@releasekit/config", "@releasekit/core"];
|
|
1666
|
+
const sharedPackageDirs = packages.filter((p) => sharedPackageNames.includes(p.packageJson.name)).map((p) => p.dir);
|
|
1667
|
+
const repoLevelEntries = extractRepoLevelChangelogEntries(
|
|
1668
|
+
pkgPath,
|
|
1669
|
+
revisionRange,
|
|
1670
|
+
allPackageDirs,
|
|
1671
|
+
sharedPackageDirs
|
|
1672
|
+
);
|
|
1673
|
+
if (repoLevelEntries.length > 0) {
|
|
1674
|
+
log(`Adding ${repoLevelEntries.length} repo-level commit(s) to ${name} changelog`, "debug");
|
|
1675
|
+
changelogEntries = [...repoLevelEntries, ...changelogEntries];
|
|
1644
1676
|
}
|
|
1645
1677
|
if (changelogEntries.length === 0) {
|
|
1646
1678
|
changelogEntries = [
|
package/dist/cli.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1168,9 +1168,9 @@ var path6 = __toESM(require("path"), 1);
|
|
|
1168
1168
|
init_commandExecutor();
|
|
1169
1169
|
var CONVENTIONAL_COMMIT_REGEX = /^(\w+)(?:\(([^)]+)\))?(!)?: (.+)(?:\n\n([\s\S]*))?/;
|
|
1170
1170
|
var BREAKING_CHANGE_REGEX = /BREAKING CHANGE: ([\s\S]+?)(?:\n\n|$)/;
|
|
1171
|
-
function
|
|
1171
|
+
function extractAllChangelogEntriesWithHash(projectDir, revisionRange) {
|
|
1172
1172
|
try {
|
|
1173
|
-
const args = ["log", revisionRange, "--pretty=format:%H|||%B---COMMIT_DELIMITER---", "--no-merges"
|
|
1173
|
+
const args = ["log", revisionRange, "--pretty=format:%H|||%B---COMMIT_DELIMITER---", "--no-merges"];
|
|
1174
1174
|
const output = execSync("git", args, { cwd: projectDir, encoding: "utf8" }).toString();
|
|
1175
1175
|
const commits = output.split("---COMMIT_DELIMITER---").filter((commit) => commit.trim() !== "");
|
|
1176
1176
|
return commits.map((commit) => {
|
|
@@ -1184,27 +1184,54 @@ function extractChangelogEntriesWithHash(projectDir, revisionRange) {
|
|
|
1184
1184
|
}).filter((item) => item !== null);
|
|
1185
1185
|
} catch (error) {
|
|
1186
1186
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1187
|
-
log(`Error extracting commits with hash: ${errorMessage}`, "error");
|
|
1187
|
+
log(`Error extracting all commits with hash: ${errorMessage}`, "error");
|
|
1188
1188
|
return [];
|
|
1189
1189
|
}
|
|
1190
1190
|
}
|
|
1191
|
-
function
|
|
1191
|
+
function commitTouchesAnyPackage(projectDir, commitHash, packageDirs, sharedPackageDirs = []) {
|
|
1192
1192
|
try {
|
|
1193
|
-
const
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1193
|
+
const output = execSync("git", ["diff-tree", "--no-commit-id", "--name-only", "-r", commitHash], {
|
|
1194
|
+
cwd: projectDir,
|
|
1195
|
+
encoding: "utf8"
|
|
1196
|
+
}).toString().trim();
|
|
1197
|
+
if (!output) {
|
|
1198
|
+
return false;
|
|
1199
|
+
}
|
|
1200
|
+
const changedFiles = output.split("\n");
|
|
1201
|
+
return changedFiles.some((file) => {
|
|
1202
|
+
return packageDirs.some((pkgDir) => {
|
|
1203
|
+
if (sharedPackageDirs.some((sharedDir) => pkgDir.includes(sharedDir))) {
|
|
1204
|
+
return false;
|
|
1205
|
+
}
|
|
1206
|
+
const normalizedFile = file.replace(/\\/g, "/");
|
|
1207
|
+
const normalizedPkgDir = pkgDir.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
1208
|
+
return normalizedFile.startsWith(normalizedPkgDir);
|
|
1209
|
+
});
|
|
1210
|
+
});
|
|
1205
1211
|
} catch (error) {
|
|
1206
|
-
|
|
1207
|
-
|
|
1212
|
+
log(
|
|
1213
|
+
`Error checking if commit ${commitHash} touches packages: ${error instanceof Error ? error.message : String(error)}`,
|
|
1214
|
+
"debug"
|
|
1215
|
+
);
|
|
1216
|
+
return false;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
function extractRepoLevelChangelogEntries(projectDir, revisionRange, packageDirs, sharedPackageDirs = []) {
|
|
1220
|
+
try {
|
|
1221
|
+
const allCommits = extractAllChangelogEntriesWithHash(projectDir, revisionRange);
|
|
1222
|
+
const repoLevelCommits = allCommits.filter((commit) => {
|
|
1223
|
+
const touchesPackage = commitTouchesAnyPackage(projectDir, commit.hash, packageDirs, sharedPackageDirs);
|
|
1224
|
+
return !touchesPackage;
|
|
1225
|
+
});
|
|
1226
|
+
if (repoLevelCommits.length > 0) {
|
|
1227
|
+
log(
|
|
1228
|
+
`Found ${repoLevelCommits.length} repo-level commit(s) (including shared packages: ${sharedPackageDirs.join(", ")})`,
|
|
1229
|
+
"debug"
|
|
1230
|
+
);
|
|
1231
|
+
}
|
|
1232
|
+
return repoLevelCommits.map((c) => c.entry);
|
|
1233
|
+
} catch (error) {
|
|
1234
|
+
log(`Error extracting repo-level commits: ${error instanceof Error ? error.message : String(error)}`, "warning");
|
|
1208
1235
|
return [];
|
|
1209
1236
|
}
|
|
1210
1237
|
}
|
|
@@ -1632,13 +1659,18 @@ var PackageProcessor = class {
|
|
|
1632
1659
|
revisionRange = "HEAD";
|
|
1633
1660
|
}
|
|
1634
1661
|
changelogEntries = extractChangelogEntriesFromCommits(pkgPath, revisionRange);
|
|
1635
|
-
const
|
|
1636
|
-
const
|
|
1637
|
-
const
|
|
1638
|
-
const
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1662
|
+
const allPackageDirs = packages.map((p) => p.dir);
|
|
1663
|
+
const sharedPackageNames = ["config", "core", "@releasekit/config", "@releasekit/core"];
|
|
1664
|
+
const sharedPackageDirs = packages.filter((p) => sharedPackageNames.includes(p.packageJson.name)).map((p) => p.dir);
|
|
1665
|
+
const repoLevelEntries = extractRepoLevelChangelogEntries(
|
|
1666
|
+
pkgPath,
|
|
1667
|
+
revisionRange,
|
|
1668
|
+
allPackageDirs,
|
|
1669
|
+
sharedPackageDirs
|
|
1670
|
+
);
|
|
1671
|
+
if (repoLevelEntries.length > 0) {
|
|
1672
|
+
log(`Adding ${repoLevelEntries.length} repo-level commit(s) to ${name} changelog`, "debug");
|
|
1673
|
+
changelogEntries = [...repoLevelEntries, ...changelogEntries];
|
|
1642
1674
|
}
|
|
1643
1675
|
if (changelogEntries.length === 0) {
|
|
1644
1676
|
changelogEntries = [
|
package/dist/index.js
CHANGED