Skip to content

Commit

Permalink
Change composer version-update script to only generate supporting files
Browse files Browse the repository at this point in the history
  • Loading branch information
jlevers committed Jul 14, 2023
1 parent e946f51 commit a282417
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@customize-schemas",
"@generate"
],
"version-update": "@generate --category=mp --country=us --api-code=auth",
"version-update": "@generate --supporting-files-only",
"clean": "rm -rf docs src/Models/*/* src/Apis/*/*/*",
"lint": "php vendor/bin/php-cs-fixer fix --allow-risky=yes -vvv"
},
Expand Down
2 changes: 1 addition & 1 deletion resources/templates/composer.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@customize-schemas",
"@generate"
],
"version-update": "@generate --category=mp --country=us --api-code=auth",
"version-update": "@generate --supporting-files-only",
"clean": "rm -rf docs src/Models/*/* src/Apis/*/*/*",
"lint": "php vendor/bin/php-cs-fixer fix --allow-risky=yes -vvv"
},
Expand Down
10 changes: 8 additions & 2 deletions utils/generate-apis.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,11 @@ function setPrettifyEnv(): void
putenv('PHP_POST_PROCESS_FILE=' . __DIR__ . '/../vendor/bin/php-cs-fixer fix --allow-risky=yes --config ' . __DIR__ . '/../.php-cs-fixer.dist.php');
}

$opts = handleSchemaOpts();
generateApis(...$opts);
// Only regenerate supporting files if the --supporting-files-only flag is passed, regardless of any other flags
$opts = getopt('', ['supporting-files-only']);
if (array_key_exists('supporting-files-only', $opts)) {
generateSupportingFiles();
} else {
$opts = handleSchemaOpts();
generateApis(...$opts);
}

0 comments on commit a282417

Please sign in to comment.