gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.46k stars 7.5k forks source link

theme.toml: Add max version to prevent Hugo breaking user's websites #5342

Closed gcushen closed 5 years ago

gcushen commented 6 years ago

Problem

Hugo sometimes has breaking changes, for example GetPage.

Themes for Hugo, such as Academic, have received a large number of issues/complaints from users who have updated Hugo and then discovered that their website is broken due to breaking changes in Hugo, such as GetPage, which have not had a chance to be integrated into themes. (Note that this specific breaking change is an example, and is integrated into Academic now.)

It's best practice for dependencies (e.g. themes) of a software project (e.g. Hugo) to be able to specify the min and max versions that are compatible, in order to prevent breaking things.

Solution

Support a max_version option in theme.toml and update Hugo's code which checks for min version to also check for max version.

This relatively simple change would help prevent breaking changes in Hugo from breaking user's websites.

bep commented 6 years ago

It's best practice for dependencies (e.g. themes) of a software project (e.g. Hugo) to be able to specify the min and max versions that are compatible, in order to prevent breaking things.

What "best practice" are you talking about now? This is an extremely complex area with many opinions and implementation. Just look at the recent debate around Go Modules and their "minimal version selection algorithm" -- which I really like, but I would never label it "best practice". But I suspect that would fit Hugo's case better -- but there are many pieces missing in the puzzle before we're getting there. But I'm not putting a "max_version" into the mix until this is carefully thought through.

gcushen commented 6 years ago

My perspective on dependency best practice is based on really popular languages like Python, JS (Node), and Rust - all of which support min/max version ranges. I appreciate not all languages are the same and Go devs generally think pretty outside the box with an open mind when considering a solution rather than following in another language's footsteps. At the end of the day, each approach to dependency management has its pros and cons.

My main point though is that currently Hugo is breaking user's websites.

A short-term fix to prevent breaking user's sites could be for Hugo to only build if the binary is exactly the same version (with exception to bug patches) as the min_version defined in theme.toml. Or at least provide a warning message at the top of console output if the Hugo version differs to theme.toml.

Otherwise, many users are getting broken sites without any explanation...

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help. If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open. If this is a feature request, and you feel that it is still relevant and valuable, please tell us why. This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.