diff --git a/.github/workflows/end-to-end-testing.yml b/.github/workflows/end-to-end-testing.yml index fc4be718221..1fa41996f34 100644 --- a/.github/workflows/end-to-end-testing.yml +++ b/.github/workflows/end-to-end-testing.yml @@ -81,7 +81,7 @@ jobs: name: dusk-source path: _site - # @TODO compile latest hydefront version + # @TODO #444 compile latest hydefront version - name: Download app.css uses: actions/download-artifact@v2 with: diff --git a/.github/workflows/split-monorepo.yml b/.github/workflows/split-monorepo.yml index eb823759771..358c7fa9b14 100644 --- a/.github/workflows/split-monorepo.yml +++ b/.github/workflows/split-monorepo.yml @@ -1,10 +1,4 @@ # Split the monorepo into readonly repositories -# TODO: Some way to preserve commit messages? I'd love to get some help here. -# โœ” Done, though it only gets the latest commit. It would be great to have something that handles all commit messages. Or at least says " (and X more [commits]) Maybe this could be done by creating an auto-closing PR listing all the commits since the last merge? Preferably filtered to only contain changes affecting the package. -# @TODO add all previous commits to the commit message -# @TODO change graceful git error handling to only catch working tree cleanness errors, allowing jobs to fail when it should -# @TODO group similar jobs into matrix -# @TODO merge workflow file into main ci file name: ๐Ÿช“ Split monorepo diff --git a/packages/framework/src/Services/HydeSmartDocs.php b/packages/framework/src/Services/HydeSmartDocs.php index 65f40a386f1..d57d01d43f8 100644 --- a/packages/framework/src/Services/HydeSmartDocs.php +++ b/packages/framework/src/Services/HydeSmartDocs.php @@ -13,6 +13,8 @@ * * @experimental ๐Ÿงช Subject to change without notice. * + * @todo #445 Rename to HydeSemanticDocs + * * @see \Hyde\Framework\Testing\Feature\Services\HydeSmartDocsTest */ class HydeSmartDocs diff --git a/packages/framework/tests/Feature/Foundation/FilesystemTest.php b/packages/framework/tests/Feature/Foundation/FilesystemTest.php index 046f4b19ede..68f976d247b 100644 --- a/packages/framework/tests/Feature/Foundation/FilesystemTest.php +++ b/packages/framework/tests/Feature/Foundation/FilesystemTest.php @@ -4,12 +4,15 @@ use Hyde\Framework\Foundation\Filesystem; use Hyde\Framework\Hyde; +use Hyde\Framework\Models\Pages\BladePage; +use Hyde\Framework\Models\Pages\DocumentationPage; +use Hyde\Framework\Models\Pages\MarkdownPage; +use Hyde\Framework\Models\Pages\MarkdownPost; use Hyde\Testing\TestCase; /** + * @covers \Hyde\Framework\HydeKernel * @covers \Hyde\Framework\Foundation\Filesystem - * - * @see \Hyde\Framework\Testing\Unit\Foundation\FluentFilesystemModelPathHelpersTest */ class FilesystemTest extends TestCase { @@ -146,4 +149,163 @@ public function test_unlink_helper_deletes_multiple_files_at_given_paths() $this->assertFileDoesNotExist(Hyde::path('foo')); $this->assertFileDoesNotExist(Hyde::path('bar')); } + + public function test_get_model_source_path_method_returns_path_for_model_classes() + { + $this->assertEquals( + Hyde::path('_posts'), + Hyde::getModelSourcePath(MarkdownPost::class) + ); + + $this->assertEquals( + Hyde::path('_pages'), + Hyde::getModelSourcePath(MarkdownPage::class) + ); + + $this->assertEquals( + Hyde::path('_docs'), + Hyde::getModelSourcePath(DocumentationPage::class) + ); + + $this->assertEquals( + Hyde::path('_pages'), + Hyde::getModelSourcePath(BladePage::class) + ); + } + + public function test_get_model_source_path_method_returns_path_to_file_for_model_classes() + { + $this->assertEquals( + Hyde::path('_posts'.DIRECTORY_SEPARATOR.'foo.md'), + Hyde::getModelSourcePath(MarkdownPost::class, 'foo.md') + ); + + $this->assertEquals( + Hyde::path('_pages'.DIRECTORY_SEPARATOR.'foo.md'), + Hyde::getModelSourcePath(MarkdownPage::class, 'foo.md') + ); + + $this->assertEquals( + Hyde::path('_docs'.DIRECTORY_SEPARATOR.'foo.md'), + Hyde::getModelSourcePath(DocumentationPage::class, 'foo.md') + ); + + $this->assertEquals( + Hyde::path('_pages'.DIRECTORY_SEPARATOR.'foo.md'), + Hyde::getModelSourcePath(BladePage::class, 'foo.md') + ); + } + + public function test_helper_for_blade_pages() + { + $this->assertEquals( + Hyde::path('_pages'), + Hyde::getBladePagePath() + ); + } + + public function test_helper_for_markdown_pages() + { + $this->assertEquals( + Hyde::path('_pages'), + Hyde::getMarkdownPagePath() + ); + } + + public function test_helper_for_markdown_posts() + { + $this->assertEquals( + Hyde::path('_posts'), + Hyde::getMarkdownPostPath() + ); + } + + public function test_helper_for_documentation_pages() + { + $this->assertEquals( + Hyde::path('_docs'), + Hyde::getDocumentationPagePath() + ); + } + + public function test_helper_for_site_output_path() + { + $this->assertEquals( + Hyde::path('_site'), + Hyde::getSiteOutputPath() + ); + } + + public function test_helper_for_site_output_path_returns_path_to_file_within_the_directory() + { + $this->assertEquals( + Hyde::path('_site'.DIRECTORY_SEPARATOR.'foo.html'), + Hyde::getSiteOutputPath('foo.html') + ); + } + + public function test_get_site_output_path_returns_absolute_path() + { + $this->assertEquals( + Hyde::path('_site'), + Hyde::getSiteOutputPath() + ); + } + + public function test_site_output_path_helper_ignores_trailing_slashes() + { + $this->assertEquals( + Hyde::path('_site'.DIRECTORY_SEPARATOR.'foo.html'), + Hyde::getSiteOutputPath('/foo.html/') + ); + } + + public function test_path_to_relative_helper_decodes_hyde_path_into_relative() + { + $s = DIRECTORY_SEPARATOR; + $this->assertEquals('foo', Hyde::pathToRelative(Hyde::path('foo'))); + $this->assertEquals('foo', Hyde::pathToRelative(Hyde::path('/foo/'))); + $this->assertEquals('foo.md', Hyde::pathToRelative(Hyde::path('foo.md'))); + $this->assertEquals("foo{$s}bar", Hyde::pathToRelative(Hyde::path("foo{$s}bar"))); + $this->assertEquals("foo{$s}bar.md", Hyde::pathToRelative(Hyde::path("foo{$s}bar.md"))); + } + + public function test_path_to_relative_helper_does_not_modify_already_relative_paths() + { + $this->assertEquals('foo', Hyde::pathToRelative('foo')); + $this->assertEquals('foo/', Hyde::pathToRelative('foo/')); + $this->assertEquals('../foo', Hyde::pathToRelative('../foo')); + $this->assertEquals('../foo/', Hyde::pathToRelative('../foo/')); + $this->assertEquals('foo.md', Hyde::pathToRelative('foo.md')); + $this->assertEquals('foo/bar', Hyde::pathToRelative('foo/bar')); + $this->assertEquals('foo/bar.md', Hyde::pathToRelative('foo/bar.md')); + } + + public function test_path_to_relative_helper_does_not_modify_non_project_paths() + { + $testStrings = [ + 'C:\Documents\Newsletters\Summer2018.pdf', + '\Program Files\Custom Utilities\StringFinder.exe', + '2018\January.xlsx', + '..\Publications\TravelBrochure.pdf', + 'C:\Projects\library\library.sln', + 'C:Projects\library\library.sln', + '/home/seth/Pictures/penguin.jpg', + '~/Pictures/penguin.jpg', + ]; + + foreach ($testStrings as $testString) { + $this->assertEquals( + $this->systemPath(($testString)), + Hyde::pathToRelative( + $this->systemPath($testString) + ) + ); + } + } + + protected function systemPath(string $path): string + { + return str_replace('/', DIRECTORY_SEPARATOR, $path); + } } diff --git a/packages/framework/tests/Unit/Foundation/FluentFilesystemModelPathHelpersTest.php b/packages/framework/tests/Unit/Foundation/FluentFilesystemModelPathHelpersTest.php deleted file mode 100644 index b1efe9b3b98..00000000000 --- a/packages/framework/tests/Unit/Foundation/FluentFilesystemModelPathHelpersTest.php +++ /dev/null @@ -1,178 +0,0 @@ -assertEquals( - Hyde::path('_posts'), - Hyde::getModelSourcePath(MarkdownPost::class) - ); - - $this->assertEquals( - Hyde::path('_pages'), - Hyde::getModelSourcePath(MarkdownPage::class) - ); - - $this->assertEquals( - Hyde::path('_docs'), - Hyde::getModelSourcePath(DocumentationPage::class) - ); - - $this->assertEquals( - Hyde::path('_pages'), - Hyde::getModelSourcePath(BladePage::class) - ); - } - - public function test_get_model_source_path_method_returns_path_to_file_for_model_classes() - { - $this->assertEquals( - Hyde::path('_posts'.DIRECTORY_SEPARATOR.'foo.md'), - Hyde::getModelSourcePath(MarkdownPost::class, 'foo.md') - ); - - $this->assertEquals( - Hyde::path('_pages'.DIRECTORY_SEPARATOR.'foo.md'), - Hyde::getModelSourcePath(MarkdownPage::class, 'foo.md') - ); - - $this->assertEquals( - Hyde::path('_docs'.DIRECTORY_SEPARATOR.'foo.md'), - Hyde::getModelSourcePath(DocumentationPage::class, 'foo.md') - ); - - $this->assertEquals( - Hyde::path('_pages'.DIRECTORY_SEPARATOR.'foo.md'), - Hyde::getModelSourcePath(BladePage::class, 'foo.md') - ); - } - - public function test_helper_for_blade_pages() - { - $this->assertEquals( - Hyde::path('_pages'), - Hyde::getBladePagePath() - ); - } - - public function test_helper_for_markdown_pages() - { - $this->assertEquals( - Hyde::path('_pages'), - Hyde::getMarkdownPagePath() - ); - } - - public function test_helper_for_markdown_posts() - { - $this->assertEquals( - Hyde::path('_posts'), - Hyde::getMarkdownPostPath() - ); - } - - public function test_helper_for_documentation_pages() - { - $this->assertEquals( - Hyde::path('_docs'), - Hyde::getDocumentationPagePath() - ); - } - - public function test_helper_for_site_output_path() - { - $this->assertEquals( - Hyde::path('_site'), - Hyde::getSiteOutputPath() - ); - } - - public function test_helper_for_site_output_path_returns_path_to_file_within_the_directory() - { - $this->assertEquals( - Hyde::path('_site'.DIRECTORY_SEPARATOR.'foo.html'), - Hyde::getSiteOutputPath('foo.html') - ); - } - - public function test_get_site_output_path_returns_absolute_path() - { - $this->assertEquals( - Hyde::path('_site'), - Hyde::getSiteOutputPath() - ); - } - - public function test_site_output_path_helper_ignores_trailing_slashes() - { - $this->assertEquals( - Hyde::path('_site'.DIRECTORY_SEPARATOR.'foo.html'), - Hyde::getSiteOutputPath('/foo.html/') - ); - } - - public function test_path_to_relative_helper_decodes_hyde_path_into_relative() - { - $s = DIRECTORY_SEPARATOR; - $this->assertEquals('foo', Hyde::pathToRelative(Hyde::path('foo'))); - $this->assertEquals('foo', Hyde::pathToRelative(Hyde::path('/foo/'))); - $this->assertEquals('foo.md', Hyde::pathToRelative(Hyde::path('foo.md'))); - $this->assertEquals("foo{$s}bar", Hyde::pathToRelative(Hyde::path("foo{$s}bar"))); - $this->assertEquals("foo{$s}bar.md", Hyde::pathToRelative(Hyde::path("foo{$s}bar.md"))); - } - - public function test_path_to_relative_helper_does_not_modify_already_relative_paths() - { - $this->assertEquals('foo', Hyde::pathToRelative('foo')); - $this->assertEquals('foo/', Hyde::pathToRelative('foo/')); - $this->assertEquals('../foo', Hyde::pathToRelative('../foo')); - $this->assertEquals('../foo/', Hyde::pathToRelative('../foo/')); - $this->assertEquals('foo.md', Hyde::pathToRelative('foo.md')); - $this->assertEquals('foo/bar', Hyde::pathToRelative('foo/bar')); - $this->assertEquals('foo/bar.md', Hyde::pathToRelative('foo/bar.md')); - } - - public function test_path_to_relative_helper_does_not_modify_non_project_paths() - { - $testStrings = [ - 'C:\Documents\Newsletters\Summer2018.pdf', - '\Program Files\Custom Utilities\StringFinder.exe', - '2018\January.xlsx', - '..\Publications\TravelBrochure.pdf', - 'C:\Projects\library\library.sln', - 'C:Projects\library\library.sln', - '/home/seth/Pictures/penguin.jpg', - '~/Pictures/penguin.jpg', - ]; - - foreach ($testStrings as $testString) { - $this->assertEquals( - $this->systemPath(($testString)), - Hyde::pathToRelative( - $this->systemPath($testString) - ) - ); - } - } - - protected function systemPath(string $path): string - { - return str_replace('/', DIRECTORY_SEPARATOR, $path); - } -} diff --git a/packages/realtime-compiler/src/Routing/PageRouter.php b/packages/realtime-compiler/src/Routing/PageRouter.php index 4b40a469b03..d107b65ca8c 100644 --- a/packages/realtime-compiler/src/Routing/PageRouter.php +++ b/packages/realtime-compiler/src/Routing/PageRouter.php @@ -57,7 +57,6 @@ protected function normalizePath(string $path): string protected function getHtml(PageContract $page): string { - // todo add caching as we don't need to recompile pages that have not changed return file_get_contents((new StaticPageBuilder($page))->__invoke()); }