diff --git a/.mokogitea/workflows/pre-release.yml b/.mokogitea/workflows/pre-release.yml index 2f70d8c..b433f6b 100644 --- a/.mokogitea/workflows/pre-release.yml +++ b/.mokogitea/workflows/pre-release.yml @@ -276,7 +276,7 @@ jobs: [ "$BRANCH" = "$CURRENT_BRANCH" ] && continue echo "Syncing updates.xml -> ${BRANCH}" git fetch origin "${BRANCH}" 2>/dev/null || continue - git checkout "origin/${BRANCH}" -- . 2>/dev/null || continue + git checkout "origin/${BRANCH}" -- updates.xml 2>/dev/null || continue git checkout "${CURRENT_BRANCH}" -- updates.xml if ! git diff --quiet updates.xml 2>/dev/null; then git add updates.xml diff --git a/README.md b/README.md index 3ad5cfe..ee7c00a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ DEFGROUP: MokoStandards.Root INGROUP: MokoStandards REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform PATH: /README.md -VERSION: 09.01.00 +VERSION: 09.02.00 BRIEF: Project overview and documentation --> diff --git a/cli/version_bump.php b/cli/version_bump.php index eb5d122..4c15810 100644 --- a/cli/version_bump.php +++ b/cli/version_bump.php @@ -160,5 +160,35 @@ if (!empty($updatedFiles)) { fwrite(STDERR, "Updated " . count($updatedFiles) . " Joomla manifest(s): " . implode(', ', $updatedFiles) . "\n"); } +// -- Update package.json (Node.js / MCP) -- +$packageJsonFile = "{$root}/package.json"; +if (file_exists($packageJsonFile)) { + $pkgContent = file_get_contents($packageJsonFile); + $updatedPkg = preg_replace( + '/("version"\s*:\s*")\d{2}\.\d{2}\.\d{2}(")/m', + '${1}' . $new . '${2}', + $pkgContent + ); + if ($updatedPkg !== $pkgContent) { + file_put_contents($packageJsonFile, $updatedPkg); + fwrite(STDERR, "Updated package.json\n"); + } +} + +// -- Update pyproject.toml (Python) -- +$pyprojectFile = "{$root}/pyproject.toml"; +if (file_exists($pyprojectFile)) { + $pyContent = file_get_contents($pyprojectFile); + $updatedPy = preg_replace( + '/^(version\s*=\s*")\d{2}\.\d{2}\.\d{2}(")/m', + '${1}' . $new . '${2}', + $pyContent + ); + if ($updatedPy !== $pyContent) { + file_put_contents($pyprojectFile, $updatedPy); + fwrite(STDERR, "Updated pyproject.toml\n"); + } +} + echo "{$old} -> {$new}\n"; exit(0); diff --git a/cli/version_read.php b/cli/version_read.php index c31a4f8..cb45c93 100644 --- a/cli/version_read.php +++ b/cli/version_read.php @@ -74,23 +74,48 @@ foreach ($manifestFiles as $xmlFile) { } } +// -- 4. Fallback: package.json (Node.js / MCP) -- +$packageJsonVersion = null; +$packageJsonFile = "{$root}/package.json"; +if (file_exists($packageJsonFile)) { + $pkgData = json_decode(file_get_contents($packageJsonFile), true); + if (isset($pkgData['version']) && preg_match('/^\d{2}\.\d{2}\.\d{2}$/', $pkgData['version'])) { + $packageJsonVersion = $pkgData['version']; + } +} + +// -- 5. Fallback: pyproject.toml (Python) -- +$pyprojectVersion = null; +$pyprojectFile = "{$root}/pyproject.toml"; +if (file_exists($pyprojectFile)) { + $pyContent = file_get_contents($pyprojectFile); + if (preg_match('/^version\s*=\s*"(\d{2}\.\d{2}\.\d{2})"/m', $pyContent, $pm)) { + $pyprojectVersion = $pm[1]; + } +} + // -- Output the higher version -- +$candidates = array_filter([ + $readmeVersion, + $manifestVersion, + $packageJsonVersion, + $pyprojectVersion, +]); + $version = null; -if ($readmeVersion !== null && $manifestVersion !== null) { - $version = version_compare($manifestVersion, $readmeVersion, '>') ? $manifestVersion : $readmeVersion; -} elseif ($manifestVersion !== null) { - $version = $manifestVersion; -} elseif ($readmeVersion !== null) { - $version = $readmeVersion; +foreach ($candidates as $candidate) { + if ($version === null || version_compare($candidate, $version, '>')) { + $version = $candidate; + } } if ($version === null) { - fwrite(STDERR, "No version found in manifest.xml, README.md, or Joomla XML\n"); + fwrite(STDERR, "No version found in manifest.xml, README.md, Joomla XML, package.json, or pyproject.toml\n"); exit(1); } // -- Backfill: if manifest.xml exists but lacks , insert it -- -if ($mokoVersion === null && file_exists($mokoManifest)) { +if (file_exists($mokoManifest)) { $content = file_get_contents($mokoManifest); if (!preg_match('|\d{2}\.\d{2}\.\d{2}|', $content)) { if (strpos($content, '