Skip to content

Commit

Permalink
Inline added simplified experimental method
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Dec 14, 2023
1 parent 01cba90 commit 93ecfa5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

namespace Hyde\Console\Commands;

use Hyde\Pages\InMemoryPage;
use Hyde\Foundation\Facades\Pages;
use Hyde\Framework\Actions\StaticPageBuilder;
use LaravelZero\Framework\Commands\Command;
use Hyde\Framework\Actions\GeneratesDocumentationSearchIndex;
use Hyde\Framework\Features\Documentation\DocumentationSearchPage;
use Hyde\Framework\Features\Documentation\DocumentationSearchIndex;

/**
* Run the build process for the documentation search index.
Expand All @@ -23,7 +25,7 @@ class BuildSearchCommand extends Command

public function handle(): int
{
StaticPageBuilder::handle(Pages::get('search.json') ?? GeneratesDocumentationSearchIndex::makePage());
StaticPageBuilder::handle(Pages::get('search.json') ?? DocumentationSearchIndex::make());

if (DocumentationSearchPage::enabled()) {
StaticPageBuilder::handle(Pages::get('docs/search') ?? new DocumentationSearchPage());
Expand Down
4 changes: 3 additions & 1 deletion packages/framework/src/Foundation/HydeCoreExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
use Hyde\Pages\BladePage;
use Hyde\Pages\MarkdownPage;
use Hyde\Pages\MarkdownPost;
use Hyde\Pages\InMemoryPage;
use Hyde\Pages\DocumentationPage;
use Hyde\Foundation\Kernel\PageCollection;
use Hyde\Foundation\Concerns\HydeExtension;
use Hyde\Facades\Features;
use Hyde\Framework\Actions\GeneratesDocumentationSearchIndex;
use Hyde\Framework\Features\Documentation\DocumentationSearchPage;

use Hyde\Framework\Features\Documentation\DocumentationSearchIndex;
use function array_filter;
use function array_keys;

Expand All @@ -35,7 +37,7 @@ public static function getPageClasses(): array
public function discoverPages(PageCollection $collection): void
{
if (Features::hasDocumentationSearch()) {
$collection->addPage(GeneratesDocumentationSearchIndex::makePage());
$collection->addPage(DocumentationSearchIndex::make());

if (DocumentationSearchPage::enabled()) {
$collection->addPage(new DocumentationSearchPage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ public static function generate(): string
return $service->index->toJson();
}

/** @experimental May be moved to a DocumentationSearch class */
public static function makePage(): InMemoryPage
{
return DocumentationSearchIndex::make();
}

protected function __construct()
{
$this->index = new Collection();
Expand Down

0 comments on commit 93ecfa5

Please sign in to comment.