Skip to content

Commit f694dff

Browse files
authored
Merge pull request #1979 from hydephp/improve-documentation-generator-script
Internal: Improve documentation generator script to update the kernel overview page
2 parents 876e36e + 8a385e5 commit f694dff

File tree

2 files changed

+58
-7
lines changed

2 files changed

+58
-7
lines changed

docs/architecture-concepts/the-hydekernel.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ You can read all about it in the [Autodiscovery Documentation](autodiscovery).
5353
Since the most common way to interact with the kernel is through the Hyde facade, we will use that for the examples.
5454
But you could just as well chain the methods on the accessed kernel singleton instance if you wanted.
5555

56+
<!-- Start generated docs for the HydeKernel -->
57+
5658
<section id="hyde-kernel-base-methods">
5759

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

6163
#### `version()`
6264

@@ -87,7 +89,7 @@ Hyde::features(): Hyde\Facades\Features
8789
No description provided.
8890

8991
```php
90-
Hyde::hasFeature(string $feature): bool
92+
Hyde::hasFeature(Hyde\Enums\Feature|string $feature): bool
9193
```
9294

9395
#### `toArray()`
@@ -105,30 +107,30 @@ Hyde::toArray(): array<TKey, TValue>
105107
<section id="hyde-kernel-foundation-methods">
106108

107109
<!-- Start generated docs for Hyde\Foundation\Concerns\HandlesFoundationCollections -->
108-
<!-- Generated by HydePHP DocGen script at 2023-03-11 11:14:55 in 0.06ms -->
110+
<!-- Generated by HydePHP DocGen script at 2024-07-17 15:27:42 in 0.04ms -->
109111

110112
#### `files()`
111113

112114
No description provided.
113115

114116
```php
115-
Hyde::files(): \Hyde\Foundation\Kernel\FileCollection<string, \Hyde\Support\Filesystem\ProjectFile>
117+
Hyde::files(): Hyde\Foundation\Kernel\FileCollection
116118
```
117119

118120
#### `pages()`
119121

120122
No description provided.
121123

122124
```php
123-
Hyde::pages(): \Hyde\Foundation\Kernel\PageCollection<string, \Hyde\Pages\Concerns\HydePage>
125+
Hyde::pages(): Hyde\Foundation\Kernel\PageCollection
124126
```
125127

126128
#### `routes()`
127129

128130
No description provided.
129131

130132
```php
131-
Hyde::routes(): \Hyde\Foundation\Kernel\RouteCollection<string, \Hyde\Support\Models\Route>
133+
Hyde::routes(): Hyde\Foundation\Kernel\RouteCollection
132134
```
133135

134136
<!-- End generated docs for Hyde\Foundation\Concerns\HandlesFoundationCollections -->
@@ -187,7 +189,7 @@ Hyde::markdown(string $text, bool $normalizeIndentation): Illuminate\Support\Htm
187189
<section id="hyde-kernel-hyperlink-methods">
188190

189191
<!-- Start generated docs for Hyde\Foundation\Concerns\ForwardsHyperlinks -->
190-
<!-- Generated by HydePHP DocGen script at 2023-03-11 11:17:34 in 0.09ms -->
192+
<!-- Generated by HydePHP DocGen script at 2024-02-25 19:02:29 in 0.09ms -->
191193

192194
#### `formatLink()`
193195

@@ -229,6 +231,14 @@ No description provided.
229231
Hyde::url(string $path): string
230232
```
231233

234+
#### `route()`
235+
236+
No description provided.
237+
238+
```php
239+
Hyde::route(string $key): Hyde\Support\Models\Route
240+
```
241+
232242
#### `hasSiteUrl()`
233243

234244
No description provided.
@@ -557,3 +567,5 @@ Hyde::booted(callable(\Hyde\Foundation\HydeKernel): void): void
557567
<!-- End generated docs for Hyde\Foundation\Concerns\BootsHydeKernel -->
558568

559569
</section>
570+
571+
<!-- End generated docs for the HydeKernel -->

monorepo/scripts/docs/DocGen.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,45 @@
152152
generate($options);
153153
}
154154

155+
// Update the HydeKernel page
156+
(function (): void {
157+
echo "\n\033[33mUpdating the HydeKernel page...\033[0m";
158+
159+
$pages = [
160+
'hyde-kernel-base-methods',
161+
'hyde-kernel-foundation-methods',
162+
'hyde-kernel-string-methods',
163+
'hyde-kernel-hyperlink-methods',
164+
'hyde-kernel-filesystem-methods',
165+
'hyde-kernel-kernel-methods',
166+
'hyde-kernel-extensions-methods',
167+
'hyde-kernel-view-methods',
168+
'hyde-kernel-boot-methods',
169+
];
170+
171+
$page = 'docs/architecture-concepts/the-hydekernel.md';
172+
173+
// Replace everything between <!-- Start generated docs for the HydeKernel --> and <!-- End generated docs for the HydeKernel -->
174+
// With the concatenated content of the partials
175+
176+
$startMarker = '<!-- Start generated docs for the HydeKernel -->';
177+
$endMarker = '<!-- End generated docs for the HydeKernel -->';
178+
179+
$rootPath = realpath(__DIR__.'/../../../');
180+
181+
$content = '';
182+
foreach ($pages as $partial) {
183+
$content .= trim(file_get_contents($rootPath.'/docs/_data/partials/hyde-pages-api/'.$partial.'.md'))."\n\n";
184+
}
185+
186+
$file = file_get_contents($page);
187+
$file = preg_replace('/<!-- Start generated docs for the HydeKernel -->.*<!-- End generated docs for the HydeKernel -->/s', $startMarker."\n\n".$content.$endMarker, $file);
188+
189+
file_put_contents($page, $file);
190+
191+
echo " \033[37mDone!\033[0m\n";
192+
})();
193+
155194
// Assemble end time in milliseconds
156195
$timeEnd = microtime(true);
157196
$time = number_format(($timeEnd - $timeStart) * 1000, 2);

0 commit comments

Comments
 (0)