mirror of
https://github.com/symfony/recipes-contrib.git
synced 2026-09-20 11:56:25 +03:00
Improve JanePHP recipes first-run experience (#2033)
* Improve JanePHP recipes first-run experience Recipes pointed the generator configs to specification files they never created, hid all generator output behind a NullOutput (so failures showed up as raw PHP fatals and successes printed nothing) and always exited 0, even when generation failed. - document every config key and the spec file prerequisite in config/jane/*.php - render generator output, format thrown errors and propagate exit codes in the recipe bin scripts - reorder post-install steps: placing the specification file now comes before running the generator - explain when/how to uncomment the generated normalizer service in config/packages/jane.yaml Refs: https://github.com/janephp/janephp/issues/860 * Point recipes to the current documentation website jane.readthedocs.io is outdated, jane.jolicode.com/latest/ is the current documentation home. * Re-trigger QA after adding the license header to the PR description
This commit is contained in:
@@ -7,10 +7,18 @@ use Jane\Component\OpenApiCommon\Console\Command\GenerateCommand;
|
||||
use Jane\Component\OpenApiCommon\Console\Loader\ConfigLoader;
|
||||
use Jane\Component\OpenApiCommon\Console\Loader\OpenApiMatcher;
|
||||
use Jane\Component\OpenApiCommon\Console\Loader\SchemaLoader;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Output\NullOutput;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
|
||||
$command = new GenerateCommand(new ConfigLoader(), new SchemaLoader(), new OpenApiMatcher());
|
||||
$inputArray = new ArrayInput(['--config-file' => __DIR__ . '/../config/jane/open_api.php'], $command->getDefinition());
|
||||
$output = new ConsoleOutput();
|
||||
|
||||
$command->execute($inputArray, new NullOutput());
|
||||
try {
|
||||
exit($command->execute($inputArray, $output));
|
||||
} catch (\Throwable $throwable) {
|
||||
(new Application())->renderThrowable($throwable, $output->getErrorOutput());
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user