From 3f110d2f5c71e57bdfd62a19850b3ce7cfa50397 Mon Sep 17 00:00:00 2001 From: Jannik Zschiesche Date: Thu, 22 Jan 2026 17:52:42 +0100 Subject: [PATCH 1/4] Disable Janus autorun It fails to often. Replace it with a big message --- CHANGELOG.md | 6 ++ src/Composer/JanusPlugin.php | 100 ++--------------------------- src/Package/PackageInitializer.php | 8 +-- 3 files changed, 16 insertions(+), 98 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9a4594..8646c29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +2.0.1 +===== + +* (improvement) Disable automatically running janus, as it often fails. + + 2.0.0 ===== diff --git a/src/Composer/JanusPlugin.php b/src/Composer/JanusPlugin.php index f79d0ce..d67ea28 100644 --- a/src/Composer/JanusPlugin.php +++ b/src/Composer/JanusPlugin.php @@ -3,7 +3,6 @@ namespace Janus\Composer; use Composer\Composer; -use Composer\DependencyResolver\Operation\InstallOperation; use Composer\DependencyResolver\Operation\OperationInterface; use Composer\DependencyResolver\Operation\UpdateOperation; use Composer\EventDispatcher\EventSubscriberInterface; @@ -13,9 +12,6 @@ use Composer\Plugin\PluginInterface; use Composer\Script\Event; use Composer\Script\ScriptEvents; -use Janus\Command\InitializeCommand; -use Janus\Package\PackageType; -use Symfony\Component\Process\Process; /** * @final @@ -68,11 +64,6 @@ public function checkForJanusOperations (PackageEvent $event) : void */ private function isJanusUpdate (OperationInterface $operation) : bool { - if ($operation instanceof InstallOperation) - { - return "21torr/janus" === $operation->getPackage()->getName(); - } - if ($operation instanceof UpdateOperation) { return "21torr/janus" === $operation->getTargetPackage()->getName(); @@ -94,91 +85,12 @@ public function afterAutoloadDump (Event $event) : void $this->hadJanusOperation = false; $io = $event->getIO(); - $io->write("\nJanus update detected, running janus update\n"); - - // please note, that the detection can fail: composer defaults to "library", if it's not set - $packageType = PackageType::tryFromComposerType( - $event->getComposer()->getPackage()->getType(), - ); - - if (null === $packageType) - { - $selected = $io->select( - "What are you currently using?", - InitializeCommand::ALLOWED_TYPES, - "library", - ); - $packageType = PackageType::tryFromComposerType(InitializeCommand::ALLOWED_TYPES[$selected] ?? null); - } - else - { - $io->write(\sprintf( - "Detected package type %s", - $packageType->value, - )); - } - - $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir'); - \assert(\is_string($vendorDir)); - - $success = $this->runJanus($io, $vendorDir, $packageType); - - if ($success) - { - $io->write("\nJanus installation complete.\n"); - } - else - { - $io->writeError("\nJanus installation failed, please run it manually: `composer exec janus init`\n"); - } - } - - /** - * Runs Janus - */ - private function runJanus ( - IOInterface $io, - string $vendorDir, - ?PackageType $type, - ) : bool - { - $command = [ - $this->findJanusExecutable($vendorDir), - "init", - ]; - - if (null !== $type) - { - $command[] = $type->value; - } - - $command[] = "--no-auto-install"; - $command[] = "--ansi"; - - $output = new Process($command); - $output->run( - static function ($type, $buffer) use ($io) : void - { - $io->write($buffer); - }, - ); - - return $output->isSuccessful(); - } - - /** - * Finds the path to the janus executable - */ - private function findJanusExecutable (string $vendorDir) : string - { - // first check if it's installed in the project via composer - if (is_dir("{$vendorDir}/bin/janus")) - { - return "{$vendorDir}/bin/janus"; - } - - // otherwise just fetch the executable from the library and run it - return \dirname(__DIR__, 2) . "/bin/janus"; + $io->write("\nJanus update detected, you need to run janus:\n"); + $io->write("\n"); + $io->write(" ╭───────────────────────────────────────────╮\n"); + $io->write(" │ $ composer exec janus init │\n"); + $io->write(" ╰───────────────────────────────────────────╯\n"); + $io->write("\n"); } /** diff --git a/src/Package/PackageInitializer.php b/src/Package/PackageInitializer.php index 42dad95..6162f6f 100644 --- a/src/Package/PackageInitializer.php +++ b/src/Package/PackageInitializer.php @@ -36,14 +36,14 @@ public function initializeSymfony (ComposerJson $composerJson) : void $composerJson->updateScripts("fix-lint", [ "normalize" => "@composer bin c-norm normalize \"$(pwd)/composer.json\" --indent-style tab --indent-size 1 --ansi", - "cs-fixer" => "PHP_CS_FIXER_IGNORE_ENV=1 vendor-bin/cs-fixer/vendor/bin/php-cs-fixer fix --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --no-interaction --ansi", + "cs-fixer" => "vendor-bin/cs-fixer/vendor/bin/php-cs-fixer fix --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --allow-unsupported-php-version=yes --no-interaction --ansi", ]); $composerJson->updateScripts("lint", [ "lint:yaml" => "bin/console lint:yaml config --parse-tags", "lint:twig" => "bin/console lint:twig templates", "normalize" => "@composer bin c-norm normalize \"$(pwd)/composer.json\" --indent-style tab --indent-size 1 --dry-run --ansi", - "cs-fixer" => "PHP_CS_FIXER_IGNORE_ENV=1 vendor-bin/cs-fixer/vendor/bin/php-cs-fixer check --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --no-interaction --ansi", + "cs-fixer" => "vendor-bin/cs-fixer/vendor/bin/php-cs-fixer check --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --allow-unsupported-php-version=yes --no-interaction --ansi", ]); $composerJson->updateScripts("test", [ @@ -77,12 +77,12 @@ public function initializeLibrary (ComposerJson $composerJson) : void $composerJson->updateScripts("fix-lint", [ "normalize" => "@composer bin c-norm normalize \"$(pwd)/composer.json\" --indent-style tab --indent-size 1 --ansi", - "cs-fixer" => "PHP_CS_FIXER_IGNORE_ENV=1 vendor-bin/cs-fixer/vendor/bin/php-cs-fixer fix --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --no-interaction --ansi", + "cs-fixer" => "vendor-bin/cs-fixer/vendor/bin/php-cs-fixer fix --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --allow-unsupported-php-version=yes --no-interaction --ansi", ]); $composerJson->updateScripts("lint", [ "normalize" => "@composer bin c-norm normalize \"$(pwd)/composer.json\" --indent-style tab --indent-size 1 --dry-run --ansi", - "cs-fixer" => "PHP_CS_FIXER_IGNORE_ENV=1 vendor-bin/cs-fixer/vendor/bin/php-cs-fixer check --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --no-interaction --ansi", + "cs-fixer" => "vendor-bin/cs-fixer/vendor/bin/php-cs-fixer check --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --allow-unsupported-php-version=yes --no-interaction --ansi", ]); $composerJson->updateScripts("test", [ From 47164321f62b3efcb6625ec443418b995b6bb285 Mon Sep 17 00:00:00 2001 From: Jannik Zschiesche Date: Thu, 22 Jan 2026 17:53:04 +0100 Subject: [PATCH 2/4] Make color more stand out --- src/Composer/JanusPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/JanusPlugin.php b/src/Composer/JanusPlugin.php index d67ea28..f01aa92 100644 --- a/src/Composer/JanusPlugin.php +++ b/src/Composer/JanusPlugin.php @@ -85,7 +85,7 @@ public function afterAutoloadDump (Event $event) : void $this->hadJanusOperation = false; $io = $event->getIO(); - $io->write("\nJanus update detected, you need to run janus:\n"); + $io->write("\nJanus update detected, you need to run janus:\n"); $io->write("\n"); $io->write(" ╭───────────────────────────────────────────╮\n"); $io->write(" │ $ composer exec janus init │\n"); From 0bab0f90b00cb1950d3f288fdb3a35b57f9119b9 Mon Sep 17 00:00:00 2001 From: Jannik Zschiesche Date: Thu, 22 Jan 2026 17:54:26 +0100 Subject: [PATCH 3/4] Bump dependencies --- CHANGELOG.md | 1 + composer.json | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8646c29..180d61d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ===== * (improvement) Disable automatically running janus, as it often fails. +* (improvement) Bump dependencies. 2.0.0 diff --git a/composer.json b/composer.json index 53cdeb5..58cf19b 100644 --- a/composer.json +++ b/composer.json @@ -14,13 +14,13 @@ "php": ">= 8.4", "composer-plugin-api": "^2.6", "21torr/cli": "^1.2.3", - "symfony/console": "^7.3", - "symfony/process": "^7.3" + "symfony/console": "^7.4 || ^8.0", + "symfony/process": "^7.4 || ^8.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.2", - "composer/composer": "^2.8.9", - "phpstan/phpstan": "^2.1.17", + "bamarni/composer-bin-plugin": "^1.8.3", + "composer/composer": "^2.9.4", + "phpstan/phpstan": "^2.1.36", "roave/security-advisories": "dev-latest" }, "autoload": { From 552bf17556092a7a4f2819a51f17bfccacb8f5de Mon Sep 17 00:00:00 2001 From: Jannik Zschiesche Date: Thu, 22 Jan 2026 17:56:55 +0100 Subject: [PATCH 4/4] Fix CS --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 58cf19b..b646a5c 100644 --- a/composer.json +++ b/composer.json @@ -14,8 +14,8 @@ "php": ">= 8.4", "composer-plugin-api": "^2.6", "21torr/cli": "^1.2.3", - "symfony/console": "^7.4 || ^8.0", - "symfony/process": "^7.4 || ^8.0" + "symfony/console": "^7.4 || ^8.0", + "symfony/process": "^7.4 || ^8.0" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.3",