From 8058baef9572f3e2c0813a770eda0afe9a6eadef Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Tue, 2 Jun 2026 09:57:27 -0500 Subject: [PATCH] feat(cli): detect src/ entry-point in Joomla package sub-extensions When building a Joomla package, sub-package directories that contain a src/ folder with a Joomla manifest XML (e.g. git submodules of full repos) now zip src/ instead of the repo root. This avoids bundling README, CI config, and other repo-level files into extension packages. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) --- cli/release_package.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/cli/release_package.php b/cli/release_package.php index be6abf5..6b2d3df 100644 --- a/cli/release_package.php +++ b/cli/release_package.php @@ -230,12 +230,31 @@ class ReleasePackageCli extends CliFramework $subName = basename($pkgDir); $subZipPath = "{$outputDir}/{$subName}.zip"; + // If sub-package is a full repo checkout (e.g. git submodule), + // look for a src/ subdirectory containing a Joomla manifest XML + // and zip that instead of the repo root. + $subSourceDir = $pkgDir; + $srcCandidate = "{$pkgDir}/src"; + if (is_dir($srcCandidate)) { + $srcManifests = array_merge( + glob("{$srcCandidate}/*.xml") ?: [], + glob("{$srcCandidate}/pkg_*.xml") ?: [] + ); + foreach ($srcManifests as $mf) { + if (strpos(file_get_contents($mf) ?: '', 'open($subZipPath, \ZipArchive::CREATE | \ZipArchive::OVERWRITE) !== true) { $this->log('ERROR', "Failed to create sub-package ZIP: {$subZipPath}"); continue; } - $this->addDirToZip($subZip, $pkgDir, '', $this->excludePatterns); + $this->addDirToZip($subZip, $subSourceDir, '', $this->excludePatterns); $subZip->close(); $zip->addFile($subZipPath, "packages/{$subName}.zip");