mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-13 10:15:22 +00:00
refactor: rename modules and update migration docs
BREAKING CHANGE Module paths moved to `github.com/HugoBlox/kit` with new names: - core `blox-tailwind` → `blox` - analytics → `analytics` - netlify → `integrations/netlify` - slides (reveal) → `slides` Update go.mod, module.yaml/params, scripts, tests, and v0.11 migration guide accordingly.
This commit is contained in:
1 parent
e7e0c714d3
commit
f4280ddb1c
566 files changed
+134
-151
No files matched your search
@@ -9,7 +9,7 @@
|
||||
import yaml
|
||||
from pathlib import Path
|
||||
|
||||
LANG_PATH = Path(__file__).resolve().parent.parent.joinpath('blox-tailwind').joinpath('data').joinpath('i18n')
|
||||
LANG_PATH = Path(__file__).resolve().parent.parent.joinpath('modules').joinpath('blox').joinpath('data').joinpath('i18n')
|
||||
LANG_YAML = LANG_PATH.joinpath('languages.yaml')
|
||||
|
||||
|
||||
|
||||
+12
-14
@@ -4,9 +4,9 @@
|
||||
Release management for HugoBlox modules.
|
||||
|
||||
Features:
|
||||
- Detects changes per module since last path-prefixed tag (e.g., modules/blox-tailwind/v0.4.3)
|
||||
- Detects changes per module since last path-prefixed tag (e.g., modules/blox/v0.4.3)
|
||||
- Determines next semantic version per module (conventional commits heuristics, default to patch)
|
||||
- Updates special module metadata (blox-tailwind data/hugoblox.yaml version)
|
||||
- Updates special module metadata (blox data/hugoblox.yaml version)
|
||||
- Updates dependent modules' go.mod "require" versions when a dependency is released
|
||||
- Tags changed modules with annotated tags and pushes tags
|
||||
- Updates templates' go.mod to latest released module versions and bumps Hugo version in template configs (hugoblox.yaml, Netlify, devcontainer)
|
||||
@@ -172,17 +172,15 @@ def update_devcontainer_hugo(starter_dir: Path, latest_hugo: Optional[str], upda
|
||||
|
||||
@dataclass
|
||||
class Module:
|
||||
name: str # e.g., blox-tailwind
|
||||
rel_dir: Path # e.g., modules/blox-tailwind
|
||||
module_path: (
|
||||
str # go module path e.g., github.com/HugoBlox/kit/modules/blox-tailwind
|
||||
)
|
||||
name: str # e.g., blox
|
||||
rel_dir: Path # e.g., modules/blox
|
||||
module_path: str
|
||||
major: int # 0,1,2,... (derived from module_path suffix /vN if any)
|
||||
requires: Set[str] = field(default_factory=set) # module paths this module requires
|
||||
dependents: Set[str] = field(default_factory=set) # reverse edge, filled later
|
||||
|
||||
def tag_prefix(self) -> str:
|
||||
# tags must be like: modules/blox-tailwind/vX.Y.Z
|
||||
# tags must be like: modules/blox/vX.Y.Z
|
||||
return f"{self.rel_dir.as_posix()}/v"
|
||||
|
||||
def current_version_tag(self) -> Optional[str]:
|
||||
@@ -223,7 +221,7 @@ def _extract_requires_from_go_mod(content: str) -> Set[str]:
|
||||
|
||||
def discover_modules() -> Dict[str, Module]:
|
||||
modules: Dict[str, Module] = {}
|
||||
for go_mod in MODULES_DIR.glob("*/go.mod"):
|
||||
for go_mod in MODULES_DIR.glob("**/go.mod"):
|
||||
rel_dir = go_mod.parent.relative_to(REPO_ROOT)
|
||||
if rel_dir.name in EXCLUDED_MODULE_DIRS:
|
||||
continue
|
||||
@@ -337,8 +335,8 @@ def bump_semver(version: Optional[str], bump: str, enforced_major: Optional[int]
|
||||
|
||||
def write_blox_tailwind_theme_version(module: Module, version: str) -> List[Path]:
|
||||
updated: List[Path] = []
|
||||
# Update modules/blox-tailwind/data/hugoblox.yaml version: "X.Y.Z"
|
||||
if module.name != "blox-tailwind":
|
||||
# Update modules/blox/data/hugoblox.yaml version: "X.Y.Z"
|
||||
if module.name != "blox":
|
||||
return updated
|
||||
data_file = module.rel_dir / "data" / "hugoblox.yaml"
|
||||
if not data_file.exists():
|
||||
@@ -356,8 +354,8 @@ def write_blox_tailwind_theme_version(module: Module, version: str) -> List[Path
|
||||
|
||||
|
||||
def update_citation_release_info(module: Module, version: str) -> List[Path]:
|
||||
"""Update the public citation metadata to the latest blox-tailwind release."""
|
||||
if module.name != "blox-tailwind":
|
||||
"""Update the public citation metadata to the latest blox release."""
|
||||
if module.name != "blox":
|
||||
return []
|
||||
|
||||
citation = REPO_ROOT / "CITATION.cff"
|
||||
@@ -761,7 +759,7 @@ def main() -> None:
|
||||
go_mod_synced = update_module_requirements_to_latest(m, modules, latest_versions)
|
||||
if go_mod_synced:
|
||||
touched_files.append(go_mod_synced)
|
||||
# Special-case blox-tailwind theme version bump and citation metadata
|
||||
# Special-case blox theme version bump and citation metadata
|
||||
touched_files.extend(write_blox_tailwind_theme_version(m, next_version))
|
||||
touched_files.extend(update_citation_release_info(m, next_version))
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ from pathlib import Path
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
I18N_PATH = Path(__file__).resolve().parents[1].joinpath(
|
||||
'modules', 'blox-tailwind', 'i18n')
|
||||
'modules', 'blox', 'i18n')
|
||||
MASTER_PACK = I18N_PATH.joinpath('en.yaml')
|
||||
|
||||
yaml = YAML()
|
||||
|
||||
@@ -90,7 +90,7 @@ class UpdateCitationReleaseInfoTests(unittest.TestCase):
|
||||
release_modules.REPO_ROOT = repo_root
|
||||
return repo_root
|
||||
|
||||
def test_updates_version_and_date_for_blox_tailwind(self) -> None:
|
||||
def test_updates_version_and_date_for_blox(self) -> None:
|
||||
repo_root = self._patch_repo_root_with_citation(
|
||||
'version: "0.10.0"\ndate-released: 2024-01-01\n',
|
||||
)
|
||||
@@ -105,9 +105,9 @@ class UpdateCitationReleaseInfoTests(unittest.TestCase):
|
||||
release_modules.datetime = FixedDatetime
|
||||
|
||||
module = release_modules.Module(
|
||||
name="blox-tailwind",
|
||||
rel_dir=Path("modules/blox-tailwind"),
|
||||
module_path="modules/blox-tailwind",
|
||||
name="blox",
|
||||
rel_dir=Path("modules/blox"),
|
||||
module_path="modules/blox",
|
||||
major=0,
|
||||
)
|
||||
|
||||
|
||||
@@ -74,10 +74,10 @@ export HUGO_BLOX_MONOREPO=true
|
||||
|
||||
# Link local modules for development (Hugo module replacements)
|
||||
export HUGO_MODULE_REPLACEMENTS="\
|
||||
github.com/HugoBlox/kit/modules/blox-tailwind -> ../../../modules/blox-tailwind,\
|
||||
github.com/HugoBlox/kit/modules/blox-analytics -> ../../../modules/blox-analytics,\
|
||||
github.com/HugoBlox/kit/modules/blox-plugin-netlify -> ../../../modules/blox-plugin-netlify,\
|
||||
github.com/HugoBlox/kit/modules/blox-plugin-reveal -> ../../../modules/blox-plugin-reveal"
|
||||
github.com/HugoBlox/kit/modules/blox -> ../../../modules/blox,\
|
||||
github.com/HugoBlox/kit/modules/analytics -> ../../../modules/analytics,\
|
||||
github.com/HugoBlox/kit/modules/integrations/netlify -> ../../../modules/integrations/netlify,\
|
||||
github.com/HugoBlox/kit/modules/slides -> ../../../modules/slides"
|
||||
|
||||
# Optionally pre-build and generate Pagefind index for local search
|
||||
if [ "$PAGEFIND" = true ]; then
|
||||
|
||||
Reference in new issue
Block a user