Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract publications package #826

Merged
merged 25 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2b688e7
Create composer.json
caendesilva Jan 9, 2023
0c589a9
Create README.md
caendesilva Jan 9, 2023
836665b
Create LICENSE.md
caendesilva Jan 9, 2023
3bb56ab
Create PublicationsServiceProvider.php
caendesilva Jan 9, 2023
4ca1e90
Move classes in publications feature namespace to publications package
caendesilva Jan 9, 2023
d454f77
Move validation package requirement to publications composer
caendesilva Jan 9, 2023
9fa8214
Composer require hyde/publications
caendesilva Jan 9, 2023
9a398fc
Register the publication views
caendesilva Jan 10, 2023
236bbfe
Move publication views to the publications package
caendesilva Jan 10, 2023
e38f278
Move publication actions to the publications package
caendesilva Jan 10, 2023
5d9a16f
Move publication commands to the publications package
caendesilva Jan 10, 2023
e061ca4
Move publication command registrations to the publications provider
caendesilva Jan 10, 2023
12970c6
Move validation language file to the publications package
caendesilva Jan 10, 2023
3070914
Move TranslationServiceProvider to the publications package
caendesilva Jan 10, 2023
b091f6c
Create provider method to register additional service providers requi…
caendesilva Jan 10, 2023
c29f0f4
Register TranslationServiceProvider via provider instead of config
caendesilva Jan 10, 2023
aaee21c
Register ValidationServiceProvider via provider instead of config
caendesilva Jan 10, 2023
84bfcd8
Replace qualifiers with imports
caendesilva Jan 10, 2023
7182d3f
Move the PublicationPage class to the publications package
caendesilva Jan 10, 2023
8b054f1
Create .gitattributes
caendesilva Jan 10, 2023
bafca30
Configure monorepo test runner to run publication tests
caendesilva Jan 10, 2023
1fa85f5
Enable monorepo test coverage for publications
caendesilva Jan 10, 2023
366dbd5
Move publication tests to the publications package
caendesilva Jan 10, 2023
cc1a314
Move back paginator class to framework package
caendesilva Jan 11, 2023
f0e5a5b
Apply fixes from StyleCI
StyleCIBot Jan 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"require": {
"php": "^8.1",
"hyde/framework": "dev-master",
"hyde/publications": "dev-master",
"hyde/ui-kit": "dev-master",
"laravel-zero/framework": "^9.1",
"illuminate/validation": "^9.0.0"
"laravel-zero/framework": "^9.1"
},
"require-dev": {
"driftingly/rector-laravel": "^0.14.1",
Expand Down
50 changes: 49 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@
'providers' => [
App\Providers\AppServiceProvider::class,
Hyde\Framework\HydeServiceProvider::class,
Hyde\Framework\Providers\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
],

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@php/** @var \Hyde\Framework\Features\Publications\Paginator $paginator */@endphp
@php/** @var \Hyde\Framework\Features\Paginator $paginator */@endphp
<nav class="flex justify-between mt-4">
@if($paginator->previous())
<x-link :href="$paginator->previous()">Prev</x-link>
Expand Down
6 changes: 0 additions & 6 deletions packages/framework/src/Console/HydeConsoleServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ public function register(): void

Commands\MakePageCommand::class,
Commands\MakePostCommand::class,
Commands\MakePublicationTagCommand::class,
Commands\MakePublicationTypeCommand::class,
Commands\MakePublicationCommand::class,

Commands\PublishHomepageCommand::class,
Commands\PublishViewsCommand::class,
Expand All @@ -39,9 +36,6 @@ public function register(): void
Commands\ValidateCommand::class,
Commands\ServeCommand::class,
Commands\DebugCommand::class,

Commands\ValidatePublicationsCommand::class,
Commands\SeedPublicationCommand::class,
]
);
}
Expand Down
8 changes: 4 additions & 4 deletions packages/framework/src/Foundation/PageCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
use Hyde\Facades\Features;
use Hyde\Foundation\Concerns\BaseFoundationCollection;
use Hyde\Framework\Exceptions\FileNotFoundException;
use Hyde\Framework\Features\Publications\Models\PublicationListPage;
use Hyde\Framework\Features\Publications\Models\PublicationType;
use Hyde\Framework\Features\Publications\PublicationService;
use Hyde\Pages\BladePage;
use Hyde\Pages\Concerns\HydePage;
use Hyde\Pages\DocumentationPage;
use Hyde\Pages\HtmlPage;
use Hyde\Pages\MarkdownPage;
use Hyde\Pages\MarkdownPost;
use Hyde\Pages\PublicationPage;
use Hyde\Pages\VirtualPage;
use Hyde\Publications\Models\PublicationListPage;
use Hyde\Publications\Models\PublicationPage;
use Hyde\Publications\Models\PublicationType;
use Hyde\Publications\PublicationService;
use Illuminate\Support\Collection;

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/framework/src/Framework/Actions/SourceFileParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
namespace Hyde\Framework\Actions;

use Hyde\Framework\Concerns\ValidatesExistence;
use Hyde\Framework\Features\Publications\Models\PublicationType;
use Hyde\Pages\BladePage;
use Hyde\Pages\Concerns\BaseMarkdownPage;
use Hyde\Pages\Concerns\HydePage;
use Hyde\Pages\PublicationPage;
use Hyde\Publications\Models\PublicationPage;
use Hyde\Publications\Models\PublicationType;
use Illuminate\Support\Str;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Hyde\Framework\Features\Publications;
namespace Hyde\Framework\Features;

use function collect;
use Hyde\Hyde;
Expand Down
4 changes: 2 additions & 2 deletions packages/framework/tests/Feature/PageCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
use function copy;
use Hyde\Foundation\HydeKernel;
use Hyde\Foundation\PageCollection;
use Hyde\Framework\Features\Publications\Models\PublicationListPage;
use Hyde\Hyde;
use Hyde\Pages\BladePage;
use Hyde\Pages\DocumentationPage;
use Hyde\Pages\HtmlPage;
use Hyde\Pages\MarkdownPage;
use Hyde\Pages\MarkdownPost;
use Hyde\Pages\PublicationPage;
use Hyde\Publications\Models\PublicationListPage;
use Hyde\Publications\Models\PublicationPage;
use Hyde\Testing\TestCase;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\File;
Expand Down
4 changes: 2 additions & 2 deletions packages/framework/tests/Feature/PaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

use function array_combine;
use function collect;
use Hyde\Framework\Features\Publications\Paginator;
use Hyde\Framework\Features\Paginator;
use Hyde\Hyde;
use Hyde\Pages\VirtualPage;
use Hyde\Testing\TestCase;
use InvalidArgumentException;
use function range;

/**
* @covers \Hyde\Framework\Features\Publications\Paginator
* @covers \Hyde\Framework\Features\Paginator
*/
class PaginatorTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/tests/Feature/SourceFileParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Hyde\Pages\HtmlPage;
use Hyde\Pages\MarkdownPage;
use Hyde\Pages\MarkdownPost;
use Hyde\Pages\PublicationPage;
use Hyde\Publications\Models\PublicationPage;
use Hyde\Testing\TestCase;

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/framework/tests/Unit/BooleanRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace Hyde\Framework\Testing\Unit;

use Hyde\Framework\Features\Publications\Validation\BooleanRule;
use Hyde\Publications\Validation\BooleanRule;
use Hyde\Testing\TestCase;
use Illuminate\Contracts\Validation\Factory;

/**
* @covers \Hyde\Framework\Features\Publications\Validation\BooleanRule
* @covers \Hyde\Publications\Validation\BooleanRule
*/
class BooleanRuleTest extends TestCase
{
Expand Down
16 changes: 8 additions & 8 deletions packages/framework/tests/Unit/Pages/PublicationPageUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
use Hyde\Foundation\PageCollection;
use Hyde\Framework\Factories\Concerns\CoreDataObject;
use Hyde\Framework\Features\Metadata\PageMetadataBag;
use Hyde\Framework\Features\Publications\Models\PublicationType;
use Hyde\Hyde;
use Hyde\Markdown\Models\FrontMatter;
use Hyde\Markdown\Models\Markdown;
use Hyde\Pages\PublicationPage;
use Hyde\Publications\Models\PublicationPage;
use Hyde\Publications\Models\PublicationType;
use Hyde\Support\Models\Route;

require_once __DIR__.'/BaseMarkdownPageUnitTest.php';

/**
* @covers \Hyde\Pages\PublicationPage
* @covers \Hyde\Publications\Models\PublicationPage
*/
class PublicationPageUnitTest extends BaseMarkdownPageUnitTest
{
Expand Down Expand Up @@ -65,7 +65,7 @@ public function testPath()
{
$this->assertSame(
Hyde::path('hello-world.md'),
PublicationPage::path('hello-world.md')
\Hyde\Publications\Models\PublicationPage::path('hello-world.md')
);
}

Expand Down Expand Up @@ -108,7 +108,7 @@ public function testMakeWithData()

public function testShowInNavigation()
{
$this->assertFalse((new PublicationPage('', [], '', $this->pubType()))->showInNavigation());
$this->assertFalse((new \Hyde\Publications\Models\PublicationPage('', [], '', $this->pubType()))->showInNavigation());
}

public function testNavigationMenuPriority()
Expand Down Expand Up @@ -145,15 +145,15 @@ public function testGet()
{
$page = new PublicationPage('foo', [], '', $this->pubType());
Hyde::pages()->put($page->getSourcePath(), $page);
$this->assertSame($page, PublicationPage::get('directory/foo'));
$this->assertSame($page, \Hyde\Publications\Models\PublicationPage::get('directory/foo'));
}

public function testParse()
{
$this->directory('directory');
$this->setupTestPublication('directory');

Hyde::touch(PublicationPage::sourcePath('directory/foo'));
Hyde::touch(\Hyde\Publications\Models\PublicationPage::sourcePath('directory/foo'));
$this->assertInstanceOf(PublicationPage::class, PublicationPage::parse('directory/foo'));
}

Expand Down Expand Up @@ -232,7 +232,7 @@ public function testSave()
{
$this->directory('directory');

$page = new PublicationPage('foo', type: $this->pubType());
$page = new \Hyde\Publications\Models\PublicationPage('foo', type: $this->pubType());
$this->assertSame($page, $page->save());
$this->assertFileExists(Hyde::path('directory/foo.md'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace Hyde\Framework\Testing\Unit;

use Hyde\Framework\Providers\TranslationServiceProvider;
use Hyde\Publications\Providers\TranslationServiceProvider;
use Hyde\Testing\TestCase;

/**
* @covers \Hyde\Framework\Providers\TranslationServiceProvider
* @covers \Hyde\Publications\Providers\TranslationServiceProvider
*/
class TranslationServiceProviderTest extends TestCase
{
Expand Down
18 changes: 18 additions & 0 deletions packages/publications/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
* text eol=lf

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.styleci.yml export-ignore
CHANGELOG.md export-ignore
CODE_OF_CONDUCT.md export-ignore
CONTRIBUTING.md export-ignore
phpunit.xml.dist export-ignore

tests/ export-ignore
21 changes: 21 additions & 0 deletions packages/publications/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Caen De Silva

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions packages/publications/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# hyde/publications
36 changes: 36 additions & 0 deletions packages/publications/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "hyde/publications",
"description": "HydePHP Publications",
"keywords": [
"hyde",
"hydephp",
"publications"
],
"homepage": "https://github.com/hyde/publications",
"license": "MIT",
"type": "library",
"authors": [
{
"name": "Caen De Silva",
"email": "caen@desilva.se",
"role": "Developer"
}
],
"require": {
"php": "^8.0",
"illuminate/support": "^9.5",
"illuminate/validation": "^9.0.0"
},
"autoload": {
"psr-4": {
"Hyde\\Publications\\": "src"
}
},
"extra": {
"laravel": {
"providers": [
"Hyde\\Publications\\PublicationsServiceProvider"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@section('content')
<main id="content" class="mx-auto max-w-7xl py-16 px-8">
<article class="prose dark:prose-invert">
@php/** @var \Hyde\Pages\PublicationPage $publication*/@endphp
@php/** @var \Hyde\Publications\Models\PublicationPage $publication*/@endphp
<h1>{{ $publication->title }}</h1>
<p>
{{ $publication->markdown }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@php/** @var \Hyde\Framework\Features\Publications\Models\PublicationType $publicationType*/@endphp
@php/** @var \Hyde\Publications\Models\PublicationType $publicationType*/@endphp
@extends('hyde::layouts.app')
@section('content')
<main id="content" class="mx-auto max-w-7xl py-16 px-8">
Expand Down
Loading