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

[2.x] Rewrite the Asset API #1904

Merged
merged 358 commits into from
Nov 5, 2024
Merged

[2.x] Rewrite the Asset API #1904

merged 358 commits into from
Nov 5, 2024

Conversation

caendesilva
Copy link
Member

@caendesilva caendesilva commented Jul 25, 2024

Abstract

Background

The Problem: The current system is confusing and unintuitive with multiple and inconsistent ways to access assets.
The Cause: This is due to multiple code locations have had overlapping code independently implemented, without thinking about the bigger picture.
The Solution: This PR rewrites the web of related code into a unified Asset API, designed to provide a consistent interface to interact with the project's media asset.

Scope

We create the new solution by thinking about how users will actually use these features, which can be summarized into the following scope:

  • End users will mainly interact with Media asset files from their pages. Commonly, this will be to do things like resolving links to images located in their media folder. Given our simplicity-first approach, this is our primary focus: to provide a convenient way to get links to assets.
  • A secondary role of the API is for the internal HydePHP codebase, package developers, and serious power users, to be used in parts of the static site generation to interact with the site assets.

Podcast

Overwhelmed by this massive changelog? Listen to this AI-generated podcast episode by NotebookLM by Google which was fed the commit logs. Improved version available here

output.mp4

Roadmap

Development

I don't think we'll be doing a v1 tie in here (normally we would backport the new feature and deprecate the old code to provide a migration path, but considering that v1 is in feature freeze #1877 I don't think this complexity would provide value, as there is too little of a time frame between when the next minor release comes out and the v2 release, so it's easier to just migrate to v2 directly)

Copy link

codecov bot commented Jul 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (0cacea4) to head (40cffc6).
Report is 359 commits behind head on 2.x-dev.

Additional details and impacted files
@@             Coverage Diff             @@
##             2.x-dev     #1904   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity      1876      1884    +8     
===========================================
  Files            192       193    +1     
  Lines           5011      5028   +17     
===========================================
+ Hits            5011      5028   +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@caendesilva caendesilva changed the title [2.x] Normalize the Asset API [2.x] Rewrite the Asset API Jul 26, 2024
caendesilva added a commit that referenced this pull request Jul 26, 2024
See #1904 for why we are skipping the normal deprecation process.
caendesilva added a commit that referenced this pull request Jul 26, 2024
See #1904 for why we are skipping the normal deprecation process.
@caendesilva caendesilva force-pushed the normalize-the-asset-api branch 2 times, most recently from e621f54 to 9ba410a Compare July 26, 2024 14:04
@@ -3,15 +3,15 @@

{{-- The compiled Tailwind/App styles --}}
@if(config('hyde.load_app_styles_from_cdn', false))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also have a wrapper like HydeFront::enabled()

@caendesilva caendesilva force-pushed the normalize-the-asset-api branch from a818a0e to 532e35f Compare October 5, 2024 12:17
This option is best because it:

1.  Maintains consistency with the rest of the configuration file.
2.  Aligns with the explanatory comment.
3.  Is clear and concise.

It is part of the HydePHP v2 Asset API refactors #1904
@caendesilva caendesilva force-pushed the normalize-the-asset-api branch from 720f3e0 to c936cbe Compare October 6, 2024 19:06
@caendesilva caendesilva force-pushed the normalize-the-asset-api branch from 43853d4 to 84672f1 Compare October 6, 2024 19:25
@caendesilva caendesilva marked this pull request as ready for review November 5, 2024 13:30
@caendesilva
Copy link
Member Author

Let's break down the changes in this Pull Request (PR) and ensure the release notes and upgrade guide accurately reflect them.

Key Changes and Affected Files

  • New Asset API: A consolidated API for media files, with changes spanning across multiple files.
    • MediaFile class enhancements (getLink, getLength, etc.).
    • New HydeFront facade for CDN and Tailwind.
    • New Asset::exists method.
    • New Hyde::assets method.
  • Navigation API: A complete rewrite of the navigation system.
  • Configuration Updates: Renaming and restructuring of config options.
  • Media File Handling: Improvements to media file transfer and MediaFile helpers.
  • Removals: Deprecated features and methods were removed.
  • Fixes and Performance: Various fixes and media file performance improvements.

Release Notes and Upgrade Guide Analysis

  • Completeness: The release notes seem to cover all the key changes, additions, and removals in the PR.
  • Accuracy: The upgrade guide provides detailed information on breaking changes and steps for upgrading.
  • Specific Sections: The sections on navigation changes, features configuration, and DataCollection API changes are particularly thorough.
  • Examples: The inclusion of code examples and upgrade paths is helpful for users.

Overall Assessment

Based on the information provided, the release notes and upgrade guide appear to be fully implemented and accurate in relation to the PR's changes. They comprehensively cover the key aspects of the update and provide clear guidance for users to upgrade their sites.

@caendesilva caendesilva merged commit 4622237 into 2.x-dev Nov 5, 2024
7 checks passed
@caendesilva caendesilva deleted the normalize-the-asset-api branch November 5, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant