Skip to content

Commit

Permalink
v0.58.0-beta - 2022-08-08
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Aug 8, 2022
1 parent 6948a39 commit ff1052d
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 77 deletions.
90 changes: 90 additions & 0 deletions CHANGELOG.md
Expand Up @@ -15,6 +15,96 @@ HydePHP consists of two primary components, Hyde/Hyde and Hyde/Framework. Develo

<!-- CHANGELOG_START -->

## [v0.58.0-beta](https://github.com/hydephp/develop/releases/tag/v0.58.0-beta) - 2022-08-08

### About

This update contains **breaking changes** to the internal API regarding page models. This should only affect you directly if you've written any code that interacts with the internal page models, such as constructing them using non-built-in Hyde helpers.

The update makes large changes to how dynamic data is constructed. Instead of generating page data at runtime, now the data is generated when constructing a page object. This gives the major benefit of being able to see all dynamic data right away, without having to render the page.

The way metadata tags are handled internally is also refactored. The rendered result should not be affected.

### Added
- Added `compile()` method to `Facades\Markdown`, replacing the `parse()` method of the same class
- Adds new actions to handle complex dynamic constructors
- Adds new front matter schema traits to define the public API for front matter and hold their data
- Adds new Meta::link() helper to create `<link>` tags
- Adds new Meta::get() helper to get the metadata array
- Adds a new system for creating and storing page metadata
- Adds several new metadata model classes

### Changed
- Breaking: Rename AbstractMarkdownPage constructor parameter `slug` to `identifier`
- Breaking: Rename AbstractPage property `slug` to `identifier`
- Breaking: Change `AbstractMarkdownPage` constructor argument positions, putting `identifier` first
- Breaking: Splits Markdown data from MarkdownDocument into new Markdown model class
- Breaking: The default `config/hyde.php` file now uses `Models\Author` instead of `Helpers\Author`
- Major: Restructure internal page data to use new front matter schema traits
- Begin changing references to slugs to identifiers, see motivation below
- Makes some helpers in SourceFileParser public static allowing them to be used outside the class
- Page metadata is now stored as a page property, making it easier to see and understand
- Page metadata is now generated at compile time instead of build time
- Page metadata types are now strongly typed, however all types are String able, so end usage is not affected

### Deprecated
- Deprecated `Facades\Markdown::parse()`, use `Facades\Markdown::render()` instead
- Deprecated `Facades\Markdown.php`, will be merged into `Models\Markdown.php`

### Removed
- Removed `Facades\Markdown.php`, merged into `Models\Markdown.php`
- Removed `body()` method from `MarkdownDocumentContract` interface and all its implementations. Use `markdown()->body()` (or cast to string) instead
- Removed `body` property from Markdown pages. Use `markdown()->body()` (or cast to string) instead
- Removed deprecated `Helpers\Author` (fully merged into `Models\Author`, simply swap namespace to upgrade)
- Removed metadata constructor helpers from the MarkdownPost class as it is now handled in the new metadata class
- Several internal single-use helper traits have been merged into their respective classes

### Fixed
- Fix Path property in Image model should be relative to media directory [#359](https://github.com/hydephp/develop/issues/359)
- Fix Add toString method to Image model to get the link [#370](https://github.com/hydephp/develop/issues/370)
- Fix Blog post OpenGraph images must be resolved relatively [#374](https://github.com/hydephp/develop/issues/374)
- Fix PageContract needs compile method [#366]((https://github.com/hydephp/develop/issues/366))


### Upgrade guide and extra information

#### Rename slugs to identifiers

Previously internally called `slug(s)`, are now called `identifier(s)`. In all honestly, this has 90% to do with the fact that I hate the word "slug".
I considered using `basename` as an alternative, but that does not fit with nested pages. Here instead is the definition of an `identifier` in the context of HydePHP:

> An identifier is a string that is in essence everything in the filepath between the source directory and the file extension.
So, for example, a page source file stored as `_pages/foo/bar.md` would have the identifier `foo/bar`. Each page type can only have one identifier of the same name.
But since you could have a file with the same identifier in the `_posts` directory, we internally always need to specify what source model we are using.

The identifier property is closely related to the page model's route key property, which consists of the site output directory followed by the identifier.

#### Heavily refactor constructors of Markdown-based page models

Adds a new interface to the Markdown page model constructors, that expects instantiated FrontMatter and MarkdownDocument objects. Normally you would use the SourceFileParser to create the object.

This means that the constructor for all Markdown-based pages is completely changed. To use a format matching the old behaviour, you can use the `MarkdownPageModel::make` method.

#### Title property has been removed from page model constructors

The following syntax has been removed: `new MarkdownPage(title: 'Foo Bar')`
Instead, you can add it with front matter: `MarkdownPage::make(matter: ['title' => 'Foo Bar'])`

#### Markdown pages now have front matter in an object instead of array

This means that instead of the following `$post->matter['title']`, you would use `$post->matter('title')`, which allows you to add a fallback like so: `$post->matter('title', 'Untitled')`

#### Author helper has been merged into the model

The deprecated `Helpers\Author` has been fully merged into `Models\Author`. Simply swap namespaces to upgrade.

```diff
-use Hyde\Framework\Helpers\Author;
+use Hyde\Framework\Models\Author;
```


## [v0.57.0-beta](https://github.com/hydephp/develop/releases/tag/v0.57.0-beta) - 2022-08-03

### About
Expand Down
81 changes: 9 additions & 72 deletions RELEASE_NOTES.md
Expand Up @@ -2,90 +2,27 @@

### About

This update contains **breaking changes** to the internal API regarding page models. This should only affect you directly if you've written any code that interacts with the internal page models, such as constructing them using non-built-in Hyde helpers.
Keep an Unreleased section at the top to track upcoming changes.

The update makes large changes to how dynamic data is constructed. Instead of generating page data at runtime, now the data is generated when constructing a page object. This gives the major benefit of being able to see all dynamic data right away, without having to render the page.
This serves two purposes:

The way metadata tags are handled internally is also refactored. The rendered result should not be affected.
1. People can see what changes they might expect in upcoming releases
2. At release time, you can move the Unreleased section changes into a new release version section.

### Added
- Added `compile()` method to `Facades\Markdown`, replacing the `parse()` method of the same class
- Adds new actions to handle complex dynamic constructors
- Adds new front matter schema traits to define the public API for front matter and hold their data
- Adds new Meta::link() helper to create `<link>` tags
- Adds new Meta::get() helper to get the metadata array
- Adds a new system for creating and storing page metadata
- Adds several new metadata model classes
- for new features.

### Changed
- Breaking: Rename AbstractMarkdownPage constructor parameter `slug` to `identifier`
- Breaking: Rename AbstractPage property `slug` to `identifier`
- Breaking: Change `AbstractMarkdownPage` constructor argument positions, putting `identifier` first
- Breaking: Splits Markdown data from MarkdownDocument into new Markdown model class
- Breaking: The default `config/hyde.php` file now uses `Models\Author` instead of `Helpers\Author`
- Major: Restructure internal page data to use new front matter schema traits
- Begin changing references to slugs to identifiers, see motivation below
- Makes some helpers in SourceFileParser public static allowing them to be used outside the class
- Page metadata is now stored as a page property, making it easier to see and understand
- Page metadata is now generated at compile time instead of build time
- Page metadata types are now strongly typed, however all types are String able, so end usage is not affected
- for changes in existing functionality.

### Deprecated
- Deprecated `Facades\Markdown::parse()`, use `Facades\Markdown::render()` instead
- Deprecated `Facades\Markdown.php`, will be merged into `Models\Markdown.php`
- for soon-to-be removed features.

### Removed
- Removed `Facades\Markdown.php`, merged into `Models\Markdown.php`
- Removed `body()` method from `MarkdownDocumentContract` interface and all its implementations. Use `markdown()->body()` (or cast to string) instead
- Removed `body` property from Markdown pages. Use `markdown()->body()` (or cast to string) instead
- Removed deprecated `Helpers\Author` (fully merged into `Models\Author`, simply swap namespace to upgrade)
- Removed metadata constructor helpers from the MarkdownPost class as it is now handled in the new metadata class
- Several internal single-use helper traits have been merged into their respective classes
- for now removed features.

### Fixed
- Fix Path property in Image model should be relative to media directory [#359](https://github.com/hydephp/develop/issues/359)
- Fix Add toString method to Image model to get the link [#370](https://github.com/hydephp/develop/issues/370)
- Fix Blog post OpenGraph images must be resolved relatively [#374](https://github.com/hydephp/develop/issues/374)
- Fix PageContract needs compile method [#366]((https://github.com/hydephp/develop/issues/366))

- for any bug fixes.

### Security
- in case of vulnerabilities.

### Upgrade guide and extra information

#### Rename slugs to identifiers

Previously internally called `slug(s)`, are now called `identifier(s)`. In all honestly, this has 90% to do with the fact that I hate the word "slug".
I considered using `basename` as an alternative, but that does not fit with nested pages. Here instead is the definition of an `identifier` in the context of HydePHP:

> An identifier is a string that is in essence everything in the filepath between the source directory and the file extension.
So, for example, a page source file stored as `_pages/foo/bar.md` would have the identifier `foo/bar`. Each page type can only have one identifier of the same name.
But since you could have a file with the same identifier in the `_posts` directory, we internally always need to specify what source model we are using.

The identifier property is closely related to the page model's route key property, which consists of the site output directory followed by the identifier.

#### Heavily refactor constructors of Markdown-based page models

Adds a new interface to the Markdown page model constructors, that expects instantiated FrontMatter and MarkdownDocument objects. Normally you would use the SourceFileParser to create the object.

This means that the constructor for all Markdown-based pages is completely changed. To use a format matching the old behaviour, you can use the `MarkdownPageModel::make` method.

#### Title property has been removed from page model constructors

The following syntax has been removed: `new MarkdownPage(title: 'Foo Bar')`
Instead, you can add it with front matter: `MarkdownPage::make(matter: ['title' => 'Foo Bar'])`

#### Markdown pages now have front matter in an object instead of array

This means that instead of the following `$post->matter['title']`, you would use `$post->matter('title')`, which allows you to add a fallback like so: `$post->matter('title', 'Untitled')`

#### Author helper has been merged into the model

The deprecated `Helpers\Author` has been fully merged into `Models\Author`. Simply swap namespaces to upgrade.

```diff
-use Hyde\Framework\Helpers\Author;
+use Hyde\Framework\Models\Author;
```
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -7,7 +7,7 @@
},
"name": "hyde",
"description": "Elegant and Powerful Static App Builder",
"version": "0.57.0",
"version": "0.58.0",
"main": "hyde",
"directories": {
"test": "tests"
Expand Down
4 changes: 2 additions & 2 deletions packages/hyde/composer.json
Expand Up @@ -21,7 +21,7 @@
],
"require": {
"php": "^8.0",
"hyde/framework": "dev-master",
"hyde/framework": "^0.58",
"laravel-zero/framework": "^9.1"
},
"require-dev": {
Expand Down Expand Up @@ -56,4 +56,4 @@
"bin": [
"hyde"
]
}
}

0 comments on commit ff1052d

Please sign in to comment.