From 289525e86434d49c807844e3b3ac6997b47101f1 Mon Sep 17 00:00:00 2001 From: Emma De Silva Date: Fri, 3 Jul 2026 21:30:05 +0200 Subject: [PATCH 1/3] Deprecate the rebuild command It has no remaining internal consumers now that the realtime compiler renders pages in-memory, and single-page builds can silently leave aggregate outputs (sitemap, RSS, search index, navigation) stale. The command still works as before, but now prints a deprecation warning pointing to StaticPageBuilder::handle() for programmatic single-page builds. It will be removed in v3.0. --- CHANGELOG.md | 2 +- docs/creating-content/compile-and-deploy.md | 4 ++-- docs/getting-started/console-commands.md | 4 +++- .../src/Console/Commands/RebuildPageCommand.php | 17 ++++++++++++++++- .../Feature/Commands/RebuildPageCommandTest.php | 12 ++++++++++++ 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 841a755651d..c0a1df9e67a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ This serves two purposes: - for changes in existing functionality. ### Deprecated -- for soon-to-be removed features. +- Deprecated the `rebuild` command. It has no remaining internal consumers now that the realtime compiler renders pages in-memory, and single-page builds can silently leave aggregate outputs (sitemap, RSS, search index, navigation) stale. It will be removed in v3.0; use `Hyde\Framework\Actions\StaticPageBuilder::handle()` instead if you need to build a single page programmatically. ### Removed - for now removed features. diff --git a/docs/creating-content/compile-and-deploy.md b/docs/creating-content/compile-and-deploy.md index ff768885714..eb1cdd3b99f 100644 --- a/docs/creating-content/compile-and-deploy.md +++ b/docs/creating-content/compile-and-deploy.md @@ -16,7 +16,7 @@ Now that you have some amazing content, you'll want to compile your site into st php hyde build ``` -**You can also compile a single file:** +**You can also compile a single file, though this is deprecated and will be removed in v3.0 (use `StaticPageBuilder::handle()` instead if you need this programmatically):** ```bash php hyde rebuild @@ -35,7 +35,7 @@ php hyde serve #### Learn more about these commands in the [console commands](console-commands) documentation: - [Build command](console-commands#build-the-static-site) -- [Rebuild command](console-commands#build-a-single-file) +- [Rebuild command (Deprecated)](console-commands#rebuild) - [Serve command](console-commands#start-the-realtime-compiler) --- diff --git a/docs/getting-started/console-commands.md b/docs/getting-started/console-commands.md index 91b5acb3ae6..ac6bd345847 100644 --- a/docs/getting-started/console-commands.md +++ b/docs/getting-started/console-commands.md @@ -47,7 +47,7 @@ Here is a quick reference of all the available commands. You can also run `php h |-----------------------------------------|---------------------------------------------------------------------------------------------| | [`build`](#build) | Build the static site | | [`serve`](#serve) | Start the realtime compiler server | -| [`rebuild`](#rebuild) | Run the static site builder for a single file | +| [`rebuild`](#rebuild) | Run the static site builder for a single file (Deprecated, will be removed in v3.0) | | [`build:rss`](#build-rss) | Generate the RSS feed | | [`build:search`](#build-search) | Generate the `docs/search.json` file | | [`build:sitemap`](#build-sitemap) | Generate the `sitemap.xml` file | @@ -83,6 +83,8 @@ Build the static site +>warning **Deprecated:** The `rebuild` command is deprecated and will be removed in HydePHP v3.0. It has no remaining internal consumers now that the realtime compiler renders pages in-memory, and building a single page can silently leave aggregate outputs (sitemap, RSS, search index, navigation) stale. If you need to build a single page programmatically, use `Hyde\Framework\Actions\StaticPageBuilder::handle()` instead. + ```bash php hyde rebuild ``` diff --git a/packages/framework/src/Console/Commands/RebuildPageCommand.php b/packages/framework/src/Console/Commands/RebuildPageCommand.php index dba3e10331d..25dfcfed631 100644 --- a/packages/framework/src/Console/Commands/RebuildPageCommand.php +++ b/packages/framework/src/Console/Commands/RebuildPageCommand.php @@ -25,6 +25,8 @@ /** * Build a single static site file. + * + * @deprecated This command is deprecated and will be removed in HydePHP v3.0. Use \Hyde\Framework\Actions\StaticPageBuilder::handle() instead. */ class RebuildPageCommand extends Command { @@ -32,10 +34,12 @@ class RebuildPageCommand extends Command protected $signature = 'rebuild {path : The relative file path (example: _posts/hello-world.md)}'; /** @var string */ - protected $description = 'Run the static site builder for a single file'; + protected $description = 'Run the static site builder for a single file [Deprecated, will be removed in v3.0]'; public function handle(): int { + $this->printDeprecationWarning(); + if ($this->argument('path') === Hyde::getMediaDirectory()) { return (new TransferMediaAssets())->run($this->output); @@ -47,6 +51,17 @@ public function handle(): int return $this->makeBuildTask($this->output, $this->getNormalizedPathString())->run(); } + /** + * @deprecated The `rebuild` command is deprecated and will be removed in HydePHP v3.0. + * @since v2.x + */ + protected function printDeprecationWarning(): void + { + $this->warn('The `rebuild` command is deprecated and will be removed in HydePHP v3.0.'); + $this->line('If you need to build a single page programmatically, use Hyde\Framework\Actions\StaticPageBuilder::handle() instead.'); + $this->newLine(); + } + protected function getNormalizedPathString(): string { return str_replace('\\', '/', unslash($this->argument('path'))); diff --git a/packages/framework/tests/Feature/Commands/RebuildPageCommandTest.php b/packages/framework/tests/Feature/Commands/RebuildPageCommandTest.php index fbe8a83952f..df3e6acaa4c 100644 --- a/packages/framework/tests/Feature/Commands/RebuildPageCommandTest.php +++ b/packages/framework/tests/Feature/Commands/RebuildPageCommandTest.php @@ -23,6 +23,18 @@ public function testHandleIsSuccessfulWithValidPath() $this->resetSite(); } + public function testCommandOutputsDeprecationWarning() + { + $this->file('_pages/test-page.md', 'foo'); + + $this->artisan('rebuild _pages/test-page.md') + ->expectsOutput('The `rebuild` command is deprecated and will be removed in HydePHP v3.0.') + ->expectsOutput('If you need to build a single page programmatically, use Hyde\Framework\Actions\StaticPageBuilder::handle() instead.') + ->assertExitCode(0); + + $this->resetSite(); + } + public function testMediaFilesCanBeTransferred() { $this->directory(Hyde::path('_site/media')); From 7082298c2cfcb7295e6e6bb02f71e35afffede25 Mon Sep 17 00:00:00 2001 From: Emma De Silva Date: Fri, 3 Jul 2026 21:35:47 +0200 Subject: [PATCH 2/3] Add namespace to deprecation documentation Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/creating-content/compile-and-deploy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/creating-content/compile-and-deploy.md b/docs/creating-content/compile-and-deploy.md index eb1cdd3b99f..7025c3ba559 100644 --- a/docs/creating-content/compile-and-deploy.md +++ b/docs/creating-content/compile-and-deploy.md @@ -16,7 +16,7 @@ Now that you have some amazing content, you'll want to compile your site into st php hyde build ``` -**You can also compile a single file, though this is deprecated and will be removed in v3.0 (use `StaticPageBuilder::handle()` instead if you need this programmatically):** +**You can also compile a single file, though this is deprecated and will be removed in v3.0 (use `Hyde\Framework\Actions\StaticPageBuilder::handle()` instead if you need this programmatically):** ```bash php hyde rebuild From 9a35cacb756ce7b020a99e7f3f550fe45011bf49 Mon Sep 17 00:00:00 2001 From: Emma De Silva Date: Fri, 3 Jul 2026 21:43:51 +0200 Subject: [PATCH 3/3] Remove @since tag from deprecation warning Removed the @since tag from the deprecation warning comment as it feels unsemantic. --- packages/framework/src/Console/Commands/RebuildPageCommand.php | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/framework/src/Console/Commands/RebuildPageCommand.php b/packages/framework/src/Console/Commands/RebuildPageCommand.php index 25dfcfed631..f6cdb201858 100644 --- a/packages/framework/src/Console/Commands/RebuildPageCommand.php +++ b/packages/framework/src/Console/Commands/RebuildPageCommand.php @@ -53,7 +53,6 @@ public function handle(): int /** * @deprecated The `rebuild` command is deprecated and will be removed in HydePHP v3.0. - * @since v2.x */ protected function printDeprecationWarning(): void {