Skip to content

Commit ebf45d8

Browse files
authored
Merge pull request #1813 from hydephp/documentation-generator-fixes
Internal: Add a linting feature to the documentation generator script
2 parents 0824579 + 4d509a8 commit ebf45d8

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

.github/workflows/hyde-stan.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@ jobs:
2121

2222
- name: Run HydeFront linter
2323
run: php packages/hydefront/.github/scripts/post-build.php
24+
25+
- name: Install dependencies
26+
run: composer install --no-progress --no-interaction --no-scripts --prefer-dist
27+
28+
- name: Run DocGen linter
29+
run: php monorepo/scripts/docs/DocGen.php --lint

docs/_data/partials/hyde-pages-api/hyde-kernel-base-methods.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<section id="hyde-kernel-base-methods">
22

33
<!-- Start generated docs for Hyde\Foundation\HydeKernel -->
4-
<!-- Generated by HydePHP DocGen script at 2023-03-11 11:09:45 in 2.53ms -->
4+
<!-- Generated by HydePHP DocGen script at 2024-07-08 20:47:38 in 2.89ms -->
55

66
#### `version()`
77

@@ -32,7 +32,7 @@ Hyde::features(): Hyde\Facades\Features
3232
No description provided.
3333

3434
```php
35-
Hyde::hasFeature(Hyde\Enums\Feature $feature): bool
35+
Hyde::hasFeature(Hyde\Enums\Feature|string $feature): bool
3636
```
3737

3838
#### `toArray()`

docs/_data/partials/hyde-pages-api/hyde-page-methods.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<section id="hyde-page-methods">
22

33
<!-- Start generated docs for Hyde\Pages\Concerns\HydePage -->
4-
<!-- Generated by HydePHP DocGen script at 2023-03-10 16:18:02 in 3.30ms -->
4+
<!-- Generated by HydePHP DocGen script at 2024-07-08 20:48:42 in 5.42ms -->
55

66
#### `make()`
77

@@ -24,7 +24,7 @@ HydePage::isDiscoverable(): bool
2424
Get a page instance from the Kernel&#039;s page index by its identifier.
2525

2626
```php
27-
HydePage::get(string $identifier): Hyde\Pages\Concerns\HydePage
27+
HydePage::get(string $identifier): static
2828
```
2929

3030
- **Throws:** \Hyde\Framework\Exceptions\FileNotFoundException If the page does not exist.

monorepo/scripts/docs/DocGen.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,24 @@
99
use Hyde\Pages\Concerns\HydePage;
1010
use Illuminate\Support\Str;
1111

12+
// Check if --lint flag is present
13+
if (in_array('--lint', $argv, true)) {
14+
echo "\033[32mLinting...\033[0m";
15+
16+
// Rerun the script without the --lint flag
17+
$output = shell_exec('php '.__FILE__);
18+
19+
$dirty = str_contains($output, 'Convents saved');
20+
21+
if ($dirty) {
22+
echo " \033[31mDocumentation is not up to date!\033[0m\n";
23+
exit(1);
24+
}
25+
26+
echo " \033[32mDocumentation is up to date!\033[0m\n";
27+
exit(0);
28+
}
29+
1230
require_once __DIR__.'/../../../vendor/autoload.php';
1331

1432
echo "\033[32mHydePHP method DocGen\033[0m\n\n";

0 commit comments

Comments
 (0)