12
12
use Hyde \Framework \Models \DocumentationPage ;
13
13
use Hyde \Framework \Models \MarkdownPage ;
14
14
use Hyde \Framework \Models \MarkdownPost ;
15
+ use Hyde \Framework \Services \CollectionService ;
15
16
use Hyde \Framework \Services \DiscoveryService ;
16
17
use Hyde \Framework \Services \RssFeedService ;
17
18
use Hyde \Framework \Services \SitemapService ;
@@ -136,15 +137,15 @@ public function runPostBuildActions(): void
136
137
$ this ->runNodeCommand ('npm run prod ' , 'Building frontend assets for production! ' );
137
138
}
138
139
139
- if (SitemapService:: canGenerateSitemap ()) {
140
+ if ($ this -> canGenerateSitemap ()) {
140
141
Artisan::call ('build:sitemap ' , outputBuffer: $ this ->output );
141
142
}
142
143
143
- if (RssFeedService:: canGenerateFeed ()) {
144
+ if ($ this -> canGenerateFeed ()) {
144
145
Artisan::call ('build:rss ' , outputBuffer: $ this ->output );
145
146
}
146
147
147
- if (Features:: hasDocumentationSearch ()) {
148
+ if ($ this -> canGenerateSearch ()) {
148
149
Artisan::call ('build:search ' , outputBuffer: $ this ->output );
149
150
}
150
151
}
@@ -155,14 +156,14 @@ protected function printFinishMessage(float $time_start): void
155
156
$ time_end = microtime (true );
156
157
$ execution_time = ($ time_end - $ time_start );
157
158
$ this ->info ('All done! Finished in ' .number_format (
158
- $ execution_time ,
159
- 2
160
- ).' seconds. ( ' .number_format (($ execution_time * 1000 ), 2 ).'ms) ' );
159
+ $ execution_time ,
160
+ 2
161
+ ).' seconds. ( ' .number_format (($ execution_time * 1000 ), 2 ).'ms) ' );
161
162
162
163
$ this ->info ('Congratulations! 🎉 Your static site has been built! ' );
163
164
$ this ->line (
164
165
'Your new homepage is stored here -> ' .
165
- DiscoveryService::createClickableFilepath (Hyde::getSiteOutputPath ('index.html ' ))
166
+ DiscoveryService::createClickableFilepath (Hyde::getSiteOutputPath ('index.html ' ))
166
167
);
167
168
}
168
169
@@ -206,4 +207,20 @@ private function runNodeCommand(string $command, string $message, ?string $actio
206
207
$ output ?? '<fg=red>Could not ' .($ actionMessage ?? 'run script ' ).'! Is NPM installed?</> '
207
208
);
208
209
}
210
+
211
+ protected function canGenerateSitemap (): bool
212
+ {
213
+ return SitemapService::canGenerateSitemap ();
214
+ }
215
+
216
+ protected function canGenerateFeed (): bool
217
+ {
218
+ return RssFeedService::canGenerateFeed ();
219
+ }
220
+
221
+ protected function canGenerateSearch (): bool
222
+ {
223
+ return Features::hasDocumentationSearch ()
224
+ && count (CollectionService::getDocumentationPageList ()) > 0 ;
225
+ }
209
226
}
0 commit comments