feat(pkg): add Composer (PHP) registry (#719)#1457
Conversation
|
Awesome work! Thank you for taking care. I'm not a PHP user, so could you please give simple instructions on how to:
|
|
Thanks! Here are simple step-by-step instructions. I verified the local flow end-to-end (the vendor/bin/lefthook proxy correctly runs the bundled binary for the host platform). A. Build & try it locallyYou don't need Packagist for this, Composer (php package manager) can install the package straight from the local folder. 1. Build the Go binaries for all platforms (same as the release
|
…ackage to a Packagist mirror and Add the publish-composer job to release.yml
Releasing the Composer packageThe package is fully built, validated and smoke-tested in CI, but the actual publish step stays dormant until the mirror repo exists the Why a mirror repo? Packagist reads One-time setup:
Once both are set, |
|
Thank you @midsonlajeanty! I'll have some time to experiment with this later next week, so I'm afraid the PR will hang for some time. |
|
Thanks |
Closes #719
Context
lefthook had no way to be installed through Composer, so PHP projects couldn't manage it as a dev dependency. This adds a Composer registry that distributes the existing prebuilt binaries on Packagist as
evilmartians/lefthook, letting PHP users runcomposer require --dev evilmartians/lefthook.It follows the bundled-binaries model already used by the RubyGems package: all platform binaries are copied into
libexec/lefthook-<os>-<arch>/, and a thin PHP launcher (bin/lefthook) detects the OS/arch at runtime and execs the matching binary, inheriting stdio and propagating the exit code.Changes
packaging/registries/php/:composer.json, thebin/lefthooklauncher, andlibexec/(binaries are git-ignored, copied in byprepare).Registries::PHPand wire it into the Raku pipeline (thephpTarget enum value,Packager, and the test harnessTestRegistry).t/05-php.rakutestcovering clean / prepare / publish.prepare/publish --target=php --dry-runfor php in CI (test.yml).set-versionis intentionally a no-op: Composer derives the version from git tags via Packagist, socomposer.jsoncarries noversionfield.publishonly runscomposer validate- Composer has no local push step.Publishing (needs maintainer action)
Packagist reads
composer.jsonfrom a repository root, but this package lives in a monorepo subdirectory, so publishing needs a dedicated mirror repo (same pattern as the AUR job):evilmartians/lefthook-php.evilmartians/lefthook.vX.Y.Zcan be added torelease.ymlas apublish-composerjob mirroring the AUR one (clone → copy → commit → tag → push), with a deploy key/token secret.I'm not part of the evilmartians org, so I couldn't create the mirror repo or register the Packagist vendor left those for maintainers. The package and CI validation are fully functional as-is.