Skip to content

feat: PRSDM-10268 enforce imports#291

Merged
christopherbrunsdon merged 4 commits intodevelopfrom
feat/PRSDM-10268-enforce-imports
Apr 29, 2026
Merged

feat: PRSDM-10268 enforce imports#291
christopherbrunsdon merged 4 commits intodevelopfrom
feat/PRSDM-10268-enforce-imports

Conversation

@christopherbrunsdon
Copy link
Copy Markdown
Contributor

Description

Enforce imports in the correct order

How to Test

  1. Build the package

  2. In a Presidium module, set the order in reverse

  3. Run presidium hugo against this module (reference the absolute path from your module)

$ presidium hugo

ERRO[0000] invalid module import order: "github.com/spandigital/presidium-styling-base"
(index 1) must come before "github.com/spandigital/presidium-layouts-base" (index 0).

Fix config.yaml: list github.com/spandigital/presidium-styling-base before 
github.com/spandigital/presidium-layouts-base.  file="presidium/cmd/hugo.go:23"
  1. Correct the order: base before layouts

  2. Run presidium hugo against this module

$ presidium hugo

Start building sites …
...

Ticket

https://spandigital.atlassian.net/browse/PRSDM-9466

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a Hugo config validation step to enforce deterministic Hugo module import ordering (styling base before layouts base), along with supporting config parsing and tests.

Changes:

  • Add validateModuleImportOrder to the Hugo service and run it before invoking Hugo.
  • Introduce configtranslation.ReadHugoConfig to parse Hugo YAML config into HugoConfig.
  • Add unit tests for module import ordering validation and update README build/test prerequisites (submodules).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
pkg/domain/service/hugo/hugo.go Adds config discovery and import-order validation prior to running Hugo.
pkg/domain/service/hugo/hugo_test.go Adds unit tests for the new import-order validation behavior.
pkg/configtranslation/configfile.go Adds a ReadHugoConfig helper to read/unmarshal Hugo config YAML.
README.md Documents initializing git submodules before building/testing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/domain/service/hugo/hugo.go Outdated
Comment thread pkg/domain/service/hugo/hugo.go
Comment thread pkg/domain/service/hugo/hugo.go Outdated
Comment thread pkg/domain/service/hugo/hugo_test.go Outdated
Comment thread pkg/domain/service/hugo/hugo.go
Copy link
Copy Markdown
Contributor

@Zalaras Zalaras left a comment

Choose a reason for hiding this comment

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

LGTM, not tested locally

@christopherbrunsdon christopherbrunsdon merged commit 568d601 into develop Apr 29, 2026
6 checks passed
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.

4 participants