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

(GH-608) Fix package url for v0.102.0 & v0.103.0 #609

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

michaeltlombardi
Copy link

Prior to this change, the URL building for versions of hugo was deterministic as the URLs for the packages were set to a project-specific standard. That URL creation began to fail for macOS in 0.102.0 and for Windows in 0.103.0. It does not fail for Linux because the hugo releases for Linux continue to include the old package naming as an alias.

This change:

Prior to this change, the URL building for versions of hugo was
deterministic as the URLs for the packages were set to a
project-specific standard. That URL creation began to fail for macOS in
[0.102.0] and for Windows in [0.103.0]. It does not fail for Linux
because the hugo releases for Linux continue to include the old package
naming as an alias.

This change:

- Updates the `get-os` function to take the hugo version as additional
  input, altering the return value based on the version.
- Updates the `get-arch` function to take the operating system name and
  hugo version as additional input, altering the return value based on
  both. Including the OS name is required for handling macOS.
- Fixes peaceiris#608
- Fixes peaceiris#605

[0.102.0]: https://github.com/gohugoio/hugo/releases/tag/v0.102.0
[0.103.0]: https://github.com/gohugoio/hugo/releases/tag/v0.103.0
__tests__/get-arch.test.ts Outdated Show resolved Hide resolved
__tests__/get-arch.test.ts Outdated Show resolved Hide resolved
__tests__/get-arch.test.ts Outdated Show resolved Hide resolved
src/get-os.ts Outdated Show resolved Hide resolved
src/get-arch.ts Outdated Show resolved Hide resolved
@michaeltlombardi
Copy link
Author

I took a quick stab at solving for the broken builds, but this is an extremely naive implementation without adding any packages for version comparisons and is certainly non-optimal, but I wanted to take a poke at it to lay something down that someone who actually knows typescript could run with or I could otherwise fix up.

This commit introduces the getConventions function, which does a one-time calculation
for the changes in packaging conventions to propagate to the getArch and getOS
functions.

It updates those functions and the installer code to leverage the conventions.

Finally, it updates the test arrangement for getArch and getOS to use test cases
instead of repeating the same test over and over and adds unit tests for the new
getConventions function.
__tests__/get-conventions.test.ts Show resolved Hide resolved
__tests__/get-conventions.test.ts Show resolved Hide resolved
__tests__/get-arch.test.ts Show resolved Hide resolved
__tests__/get-arch.test.ts Show resolved Hide resolved
__tests__/get-os.test.ts Show resolved Hide resolved
@nealkruis
Copy link

@peaceiris any update on this PR or addressing these issues?

@willfaught
Copy link

@peaceiris Windows is currently broken. Any plans to fix this soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants