Compare commits

..

1 Commits

Author SHA1 Message Date
jmiller 5c31771037 feat(cli): add semver fallback for package.json version bump
Generic: Repo Health / Site Health (push) Has been skipped
Generic: Repo Health / Access control (push) Successful in 2s
Generic: Project CI / Lint & Validate (push) Failing after 29s
Platform: mokoplatform CI / Gate 1: Code Quality (push) Failing after 1m27s
Generic: Project CI / Tests (push) Has been cancelled
Platform: mokoplatform CI / Gate 2: Unit Tests (8.1) (push) Has been cancelled
Platform: mokoplatform CI / Gate 2: Unit Tests (8.2) (push) Has been cancelled
Platform: mokoplatform CI / Gate 2: Unit Tests (8.3) (push) Has been cancelled
Platform: mokoplatform CI / Gate 3: Self-Health Check (push) Has been cancelled
Platform: mokoplatform CI / Gate 4: Governance (push) Has been cancelled
Platform: mokoplatform CI / Gate 5: Template Integrity (push) Has been cancelled
Platform: mokoplatform CI / CI Summary (push) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
When package.json uses standard x.y.z semver instead of
MokoPlatform XX.YY.ZZ format, auto-bump using the same
bump type (major/minor/patch). Respects --minor and --major flags.
2026-06-11 07:29:20 +00:00
+17 -1
View File
@@ -232,9 +232,25 @@ class VersionBumpCli extends CliFramework
$pkgContent $pkgContent
); );
} }
if ($updatedPkg !== $pkgContent) { if ($updatedPkg !== $pkgContent && $updatedPkg !== null) {
file_put_contents($packageJsonFile, $updatedPkg); file_put_contents($packageJsonFile, $updatedPkg);
fwrite(STDERR, "Updated package.json\n"); fwrite(STDERR, "Updated package.json\n");
} elseif (preg_match('/("version"\s*:\s*")(\d+)\.(\d+)\.(\d+)(")/m', $pkgContent, $semM)) {
// Semver fallback: bump standard x.y.z version when XX.YY.ZZ pattern didn't match
$sMajor = (int)$semM[2];
$sMinor = (int)$semM[3];
$sPatch = (int)$semM[4];
switch ($type) {
case 'major': $sMajor++; $sMinor = 0; $sPatch = 0; break;
case 'minor': $sMinor++; $sPatch = 0; break;
default: $sPatch++; break;
}
$semNew = "{$sMajor}.{$sMinor}.{$sPatch}";
$semUpdated = preg_replace('/("version"\s*:\s*")\d+\.\d+\.\d+(")/m', '${1}' . $semNew . '${2}', $pkgContent);
if ($semUpdated !== $pkgContent) {
file_put_contents($packageJsonFile, $semUpdated);
fwrite(STDERR, "Updated package.json (semver: {$semM[2]}.{$semM[3]}.{$semM[4]} -> $semNew)\n");
}
} }
} }
$pyprojectFile = "{$root}/pyproject.toml"; $pyprojectFile = "{$root}/pyproject.toml";