@kb-labs/release-manager-core 2.119.0 → 2.119.1-canary.b53bbee1d

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/index.d.ts CHANGED
@@ -23,7 +23,7 @@ interface ReleaseShell {
23
23
  }>;
24
24
  }
25
25
  type ReleaseStage = 'planning' | 'checking' | 'versioning' | 'publishing' | 'verifying' | 'rollback';
26
- type VersionBump = 'patch' | 'minor' | 'major' | 'auto';
26
+ type VersionBump = 'patch' | 'minor' | 'major' | 'auto' | 'none';
27
27
  /**
28
28
  * Release track. Orthogonal to VersionBump — bump decides how much to
29
29
  * increment, channel decides which track a release ships on.
package/dist/index.js CHANGED
@@ -40,6 +40,13 @@ function applyLockstep(packages) {
40
40
  const maxVersion = packages.reduce((max, pkg) => {
41
41
  return semver2.gt(pkg.currentVersion, max) ? pkg.currentVersion : max;
42
42
  }, packages[0].currentVersion);
43
+ if (maxBump === "none") {
44
+ return packages.map((pkg) => ({
45
+ ...pkg,
46
+ bump: "none",
47
+ nextVersion: maxVersion
48
+ }));
49
+ }
43
50
  const releaseType = maxBump === "auto" ? "patch" : maxBump;
44
51
  const nextVersion = semver2.inc(maxVersion, releaseType) || maxVersion;
45
52
  return packages.map((pkg) => ({
@@ -65,7 +72,7 @@ function applyCanarySuffix(packages, shortSha) {
65
72
  }));
66
73
  }
67
74
  function getMaxBump(packages) {
68
- let maxBump = "patch";
75
+ let maxBump = "none";
69
76
  for (const pkg of packages) {
70
77
  if (pkg.bump === "major") {
71
78
  return "major";
@@ -73,6 +80,12 @@ function getMaxBump(packages) {
73
80
  if (pkg.bump === "minor") {
74
81
  maxBump = "minor";
75
82
  }
83
+ if (pkg.bump === "patch" && maxBump !== "minor") {
84
+ maxBump = "patch";
85
+ }
86
+ if (pkg.bump === "auto" && maxBump === "none") {
87
+ maxBump = "patch";
88
+ }
76
89
  }
77
90
  return maxBump;
78
91
  }
@@ -442,14 +455,23 @@ async function detectModifiedPackages(git, packages, cwd, flowTagGlob) {
442
455
  async function computeNextVersion(packagePath, currentVersion, bump, git, gitCwd, pkgName, flowTagGlob) {
443
456
  if (bump === "auto") {
444
457
  const detectedBump = await detectVersionFromCommits(git, packagePath, gitCwd, pkgName, flowTagGlob);
458
+ if (detectedBump === "none") {
459
+ return currentVersion;
460
+ }
445
461
  return semver2.inc(currentVersion, detectedBump) || currentVersion;
446
462
  }
463
+ if (bump === "none") {
464
+ return currentVersion;
465
+ }
447
466
  return semver2.inc(currentVersion, bump) || currentVersion;
448
467
  }
449
468
  async function detectVersionFromCommits(git, packagePath, gitCwd, pkgName, flowTagGlob) {
450
469
  try {
451
470
  const relPath = relative(resolve(gitCwd), resolve(packagePath));
452
471
  const messages = await getCommitsSinceTag(git, pkgName, relPath, flowTagGlob);
472
+ if (messages.length === 0) {
473
+ return "none";
474
+ }
453
475
  let hasMinor = false;
454
476
  let hasBreaking = false;
455
477
  for (const message of messages) {
@@ -472,6 +494,9 @@ async function detectVersionFromCommits(git, packagePath, gitCwd, pkgName, flowT
472
494
  }
473
495
  }
474
496
  function detectBumpType(currentVersion, nextVersion) {
497
+ if (currentVersion === nextVersion) {
498
+ return "none";
499
+ }
475
500
  if (semver2.major(currentVersion) < semver2.major(nextVersion)) {
476
501
  return "major";
477
502
  }
@@ -1257,11 +1282,27 @@ async function buildPackages(packages, options) {
1257
1282
  }
1258
1283
  async function runSafeBuild(packagePath, packageName, shell) {
1259
1284
  const usesTsup = existsSync(join(packagePath, "tsup.config.ts")) || existsSync(join(packagePath, "tsup.config.js"));
1260
- if (usesTsup) {
1285
+ if (usesTsup && await isBareTsupBuildScript(packagePath)) {
1261
1286
  return runTsupSafeBuild(packagePath, packageName, shell);
1262
1287
  }
1263
1288
  return runDirectBuild(packagePath, packageName, shell);
1264
1289
  }
1290
+ async function isBareTsupBuildScript(packagePath) {
1291
+ try {
1292
+ const raw = await readFile(join(packagePath, "package.json"), "utf-8");
1293
+ const pkg = JSON.parse(raw);
1294
+ const buildScript = pkg.scripts?.build?.trim();
1295
+ if (!buildScript) {
1296
+ return false;
1297
+ }
1298
+ if (/&&|\|\||;|\|/.test(buildScript)) {
1299
+ return false;
1300
+ }
1301
+ return /^(npx\s+)?tsup(\s|$)/.test(buildScript);
1302
+ } catch {
1303
+ return false;
1304
+ }
1305
+ }
1265
1306
  function isBuildCommand(command, args) {
1266
1307
  const full = [command, ...args ?? []].join(" ").trim();
1267
1308
  return /\b(pnpm|npm|yarn)\s+(run\s+)?build\b/.test(full);