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

Turn theme into a hugo module #134

Merged
merged 6 commits into from
Mar 3, 2023
Merged

Turn theme into a hugo module #134

merged 6 commits into from
Mar 3, 2023

Conversation

deining
Copy link
Contributor

@deining deining commented Mar 5, 2022

This PR turns hugo-fresh into a hugo module. This way, the theme can pull in dependency bulma as go module.

With this PR in place, setting up a new site based on hugo-fresh can be done via:

hugo new site my-site
cd my-site
hugo mod init github.com/me/my-site
hugo mod get github.com/StefMa/hugo-fresh #optional
echo 'theme = "github.com/StefMa/hugo-fresh" >> config.toml
hugo serve

Note: This PR is work in progress. The concept works: with this PR applied, you can preview the exampleSite simply via hugo server (no themesDir=../.. needed any more). If you like the idea, I'm willing to refine the implementation and add the documentation for the new route to install hugo-fresh.

@StefMa
Copy link
Owner

StefMa commented Mar 8, 2022 via email

@deining deining marked this pull request as draft March 8, 2022 07:36
@StefMa
Copy link
Owner

StefMa commented Feb 26, 2023

Hey @deining .
Are you still interested in this idea?
What are the to-do`s to finish this up?
Camn I help you with someting?

@deining deining force-pushed the module branch 2 times, most recently from bf574b7 to ea2b8bd Compare February 26, 2023 18:21
@deining
Copy link
Contributor Author

deining commented Feb 26, 2023

Hey @deining . Are you still interested in this idea?

Yes, I am. Sorry, this flew under my radar for a long time!

What are the to-do`s to finish this up?

I realized that bulma is at version 0.9.4 meanwhile (my original PR was for 0.9.3). I corrected my PR, it now targets bulma 0.9.4.
So implementation wise, everything is ready to be rolled out 😄 I just removed the draft status from this PR and would like to see this merged soon.

Camn I help you with someting?

Yes. CircleCi now fails with this message:

Error: we found a go.mod file in your project, but you need to install Go to use it.

Can you add go to the CI workflow, please?

Furthermore: With my PR in place, we have two installation approaches now: hugo module vs. git submodule. The problem with that is, that both approaches are out sync concerning bulma version: hugo module is at latest bulma version 0.9.4, while HEAD of repo is at 0.7.0. Both should be in sync however, as requested in #114 and addressed in #133 by me (unfortunately my PR is outdated now).

So we have two choices:

  • update HEAD of repo to latest bulma version 0.9.4 (if wanted, can you take that on, please?)
  • drop support for git submodule installations altogether and subsequently remove bulma files from repo

You are the repo owner, you have to decide which of the tweo proposed ways you want to go.

Two more notes:

  1. Documentation wise, I find it strange that install instructions in /docs/content/getstarted.md, but neither in the exampleSite nor in the https://hugo-fresh.vercel.app/ nor in README.md. This somehow hides away the whole documentation from the user. Was this done on purpose? If so, what was the motivation?
  2. I realized that the repo contains parts of the resource cache in resources folder. According to this comment, this is a good thing. If you update the bulma files inside this repo, the files inside this directory should be updated as well.

@deining deining marked this pull request as ready for review February 26, 2023 19:02
@StefMa
Copy link
Owner

StefMa commented Feb 27, 2023

Thanks @deining and thank you for all the information you provide here 🙏

Regarding CircleCI:
I would suggest we wait until we moved to GH Actions (#157 (comment)).

Regarding two versions (submodule and modules) I would go the "all-in hugo modules" way.
Let's drop submodules 🗑️.
Do you want to take care for this in this PR as well?

Documentation wise, I find it strange that install instructions in /docs/content/getstarted.md, but neither in the exampleSite nor in the https://hugo-fresh.vercel.app/ nor in README.md. This somehow hides away the whole documentation from the user. Was this done on purpose? If so, what was the motivation?

Yep, I also realized this and probably move the documentation more prominent to the README.
Thanks for the hint 👍 I will think about it ...

I realized that the repo contains parts of the resource cache in resources folder. According to this comment, this is a good thing. If you update the bulma files inside this repo, the files inside this directory should be updated as well.

You mean I should not be part of the repository, right? 🤔
If so, please don't hesitate to remove it in this PR as well 🙂

@StefMa
Copy link
Owner

StefMa commented Feb 27, 2023

Thanks @deining and thank you for all the information you provide here 🙏

Regarding CircleCI:
I would suggest we wait until we oved to GH Actions (#157 (comment)).

Regarding two versions (submodule and modules) I would go the "all-in hugo modules" way.
Let's drop submodules 🗑️.
Do you want to take care for this in this PR as well?

Documentation wise, I find it strange that install instructions in /docs/content/getstarted.md, but neither in the exampleSite nor in the https://hugo-fresh.vercel.app/ nor in README.md. This somehow hides away the whole documentation from the user. Was this done on purpose? If so, what was the motivation?

Yep, I also realized this and probably move the documentation more prominent to the README.
Thanks for the hint 👍 I will think about it ...

I realized that the repo contains parts of the resource cache in resources folder. According to this comment, this is a good thing. If you update the bulma files inside this repo, the files inside this directory should be updated as well.

You mean it should not be part of the repository, right? 🤔
If so, please don't hesitate to remove it in this PR as well 🙂

@deining
Copy link
Contributor Author

deining commented Feb 27, 2023

Regarding two versions (submodule and modules) I would go the "all-in hugo modules" way. Let's drop submodules 🗑️.

Wise decision!

Do you want to take care for this in this PR as well?

Yes, I will come back to this once migration to GitHub actions is done!

@deining
Copy link
Contributor Author

deining commented Feb 27, 2023

I removed all remnants of the git submodule + local bulma installation I could find.

Yep, I also realized this and probably move the documentation more prominent to the README.

That's a goo idea and would, go ahead with this.

I'm done here too, handing over to your for approval/finalization.

@StefMa StefMa force-pushed the master branch 11 times, most recently from 7c769b3 to 1907474 Compare February 28, 2023 13:22
@StefMa StefMa changed the title WIP: Turn theme into a hugo module Turn theme into a hugo module Mar 3, 2023
@StefMa StefMa force-pushed the module branch 3 times, most recently from 7aa10b3 to 34ca4a5 Compare March 3, 2023 09:16
Copy link
Owner

@StefMa StefMa left a comment

Choose a reason for hiding this comment

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

Finally, we did it 🚀
Thanks again @deining.
This moves the theme to the next level.

@StefMa StefMa merged commit 7987c63 into StefMa:master Mar 3, 2023
This was referenced Mar 3, 2023
# and mount points are declared
module:
imports:
- path: github.com/jgthms/bulma
Copy link
Owner

Choose a reason for hiding this comment

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

A follow-up question regarding this here @deining .

We now pull always the latest main/master branch from bulma right? 🤔
Can we also specify a git tag? 🤔
Like github.com/jgthms/[email protected]
I guess this is more stable than always pulling a develop branch?! 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We now pull always the latest main/master branch from bulma right?

No. we pull in 0.9.4 right now.

The bulma version used is defined in go.mod:

require github.com/jgthms/bulma v0.0.0-20220508134905-3e00a8e6d0d0 // indirect

To update bulma inside your theme use this command:

hugo mod get -u github.com/jgthms/bulma@9734c65c100   # commit hash

Instead of a commit, you can also use a version (the tag should have leading v though (e.g. v0.9.4)):

As an example, the command below can be used by users of your theme to update their theme version used:

hugo mod get -u github.com/StefMa/[email protected]

This only works of course if you start using tags like vn.n. What about tagging this first module version with v0.1 or so?

Hope that clarifies things!

Copy link
Owner

Choose a reason for hiding this comment

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

Thank you very much.
Yes, that helped quite a lot.
Its sad that the go.mod didn't show the git tag but the hash instead 😭

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its sad that the go.mod didn't show the git tag but the hash instead

If the name of the tag in the bulma repo were v0.9.4 instead of 0.9.4, you would see it.
So if you want that users of your theme see the tag instead of the hash, but better tag the inital module release with v1.0instead of 1.0.

Copy link
Owner

Choose a reason for hiding this comment

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

Thank you very much again 🙂
Here we are: https://github.com/StefMa/hugo-fresh/releases/tag/v1.0.0

With that I have a go.mod and go.sum client like that:

// go.mod
require github.com/StefMa/hugo-fresh v1.0.0 // indirect

// go.sum
github.com/StefMa/hugo-fresh v1.0.0 h1:Nxo9WtzfBlaFi1G8NEHQLReJQz+Dn4jRxec+lMrPG6k=
github.com/StefMa/hugo-fresh v1.0.0/go.mod h1:yRzHyco0bfnITjvq7rfAiOADfGMrDlM0kXeKBllUJEc=
github.com/jgthms/bulma v0.0.0-20220508134905-3e00a8e6d0d0/go.mod h1:89FLBKXYFKfOKAoDeUT26V0pHGwzr205cMXAEqtAVOI=

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.

2 participants