Contribution Guide
Project Structure
Version Compatibility
The main branch currently targets Halo 2.x.
Development Guide
Before you start, make sure your editor supports EditorConfig so formatting stays consistent across the project.
Setting Up the Development Environment
Install pnpm
First, install Node.js, then run:
npm install -g pnpmPreparation Before Development
Clone the Project Source Code and Navigate to the Root Directory
git clone https://github.com/HowieHz/halo-theme-higan-hz && cd halo-theme-higan-hz/Install Project Dependencies
In the project root, install dependencies:
pnpm installDeveloping the Theme
To run the theme in development mode with live updates, execute:
pnpm devUncompressed style files are generated in tmp/, which makes debugging easier.
Writing Documentation
For documentation development with live preview, run:
pnpm docs:devBuild production docs to docs/.vitepress/dist with:
pnpm docs:buildPreview the production build with:
pnpm docs:previewAfter Development
Linting
Run the following command and make sure there are no errors:
pnpm lintFormatting Code
Before committing, format the code with:
pnpm fmtBuilding the Theme
Build the theme with:
pnpm buildCI Checks
For every PR, CI (GitHub Actions) runs the following quality checks:
CI Linting Steps
CI automatically runs pnpm lint, including the following checks:
oxlint+eslint: Code style and type-aware checks- Scope: JavaScript files, TypeScript files, HTML files (inline
scriptblocks only), and Vue files (including inlinescriptblocks)
- Scope: JavaScript files, TypeScript files, HTML files (inline
stylelint: Stylesheet checks- Scope: CSS files, HTML files (inline
styleblocks only), and Vue files (inlinestyleblocks only) - Note: By default,
**/*.{css,html,vue}does not match dot-prefixed directories, so additional path globs are required.
- Scope: CSS files, HTML files (inline
markdownlint: Documentation style checks- Scope: Markdown files
autocorrect: Automated text corrections- Scope: Supported file formats
tsgo --noEmit: TypeScript type checks- Scope: TypeScript files
All lint steps run with auto-fix enabled. If fixes are applied, the changes are committed automatically.
CI Formatting Steps
CI automatically runs pnpm fmt, including the following formatting steps:
oxfmt: Formatting for JSON, JSONC, YAML, Markdown, CSS, JavaScript, TypeScript, HTML, Vue and Less files
Changes produced by formatting will be automatically committed.
Lighthouse CI
- Checks Lighthouse scores and outputs reports (all scores must be full marks).
- Compares page resource-size differences against the baseline version and outputs reports.
Visual Regression Testing
Playwright captures screenshots of key pages across desktop, tablet, and mobile viewports using Chromium, Firefox, and WebKit. Argos CI then compares those screenshots against the baseline version. To save CI quota, only Chromium screenshots are currently uploaded.
Release Guard Checks
- Verifies that
docs/maintenance/changelog.mdanddocs/en/maintenance/changelog.mdstill contain## [Unreleased](fails if missing). - Verifies that changelog compare-link definitions at the end of
docs/maintenance/changelog.mdanddocs/en/maintenance/changelog.mdare complete and match release headings (fails if missing or mismatched). - Ensures non-release PRs do not manually modify the
versionfield inpackage.json(fails if changed). - Ensures release PRs (with the
releaselabel) update theversionfield inpackage.json(fails if unchanged), use a valid semantic version matching/^\d+\.\d+\.\d+$/(fails if invalid), and set a version greater than the target branch's currentpackage.jsonversion (fails if not incremented). - Prevents manual changes to
spec.versionintheme.yamlandi18n-settings/theme.*.yamlin PRs (fails if changed).
Release Flow
Pre-release Checklist
Before releasing, confirm all of the following:
- Every branch or PR intended for the release has already been merged.
- The entries under
## [Unreleased]in bothdocs/maintenance/changelog.mdanddocs/en/maintenance/changelog.mdare complete, the## [Unreleased]heading has not been removed, and compare-link definitions at the end are retained (the release workflow will rebuild this section automatically). - In release PRs (with the
releaselabel), onlypackage.jsonversionshould be changed manually. That value becomes the target stable version. - Manually verify that the
requiresfield intheme.yamlandi18n-settings/theme.*.yamlstill matches the target Halo CMS compatibility range.
Stable Release Procedure
Stable releases are published automatically from a labeled PR:
- Create a PR for the release (or use an existing aggregation PR).
- Add the
releaselabel and changepackage.jsonversionto the target semantic version, such as1.57.6. - Wait for
release-guard.ymlto pass and confirm both the target version (frompackage.json) and the previous stable version shown in the workflow summary. - Merge the PR into
main.
After merge, the bot automatically:
- Promotes content under
## [Unreleased]into a new release section in both changelog files, creates the new stable-release heading, and keeps## [Unreleased]. - Rebuilds compare-link definitions at the end of both changelog files (
[Unreleased]and version links). - Updates
package.jsonversion,theme.yamlspec.version, andi18n-settings/theme.*.yamlspec.version, then pushes the bot commit tomain. - Builds the theme and produces multiple
howiehz-higan-*.zippackages. - Creates the GitHub Release and uploads all
howiehz-higan-*.zippackages to both GitHub Release and the Halo App Store (howiehz-higan-cn.zipfirst). - Uses the published release to trigger
page-audit-generate-json.yml, which creates the page-size audit PR. That PR includes thedeploy-docslabel and deploys docs automatically after merge.
Nightly Prerelease Procedure
Nightly prereleases do not require manual version changes or a manually pushed branch.
nightly-theme-prerelease.ymlruns automatically every day at 00:00 Asia/Shanghai.- A nightly prerelease is created only when all of the following are true:
- There are commits within the previous calendar-day window in Asia/Shanghai.
- There are commits after the latest stable or pre-release tag.
- Commits whose subject starts with
docs:are excluded.
- The prerelease version rule is “current patch version + 1”, then append
-alpha.yyyyMMddHHmmssSSS. - The workflow creates a temporary local branch in the runner, updates version fields, builds assets, creates a GitHub prerelease, and syncs to the Halo App Store without pushing that branch.
Pull Request Conventions
The following conventions are used to mark or trigger PR automation workflows.
Special Labels
deploy-docs: Automatically deploys the documentation site when merged.release: Triggers the stable release creation process. See the Release Flow section for details.
Special Comments
/audit: Triggers a page audit comparing the current branch against the latest stable release and generates a report.
How to Add a New Feature with Config Options
Update Form Files
Please update the following configuration form files in sync:
- Simplified Chinese:
settings.yaml - English:
i18n-settings/settings.en.yaml
Update Config Documentation
Please update the following configuration documentation in sync:
- Simplified Chinese:
docs/guide/theme-configuration.md - English:
docs/en/guide/theme-configuration.md
When writing docs, follow the format example at the beginning of the document, and keep the option order consistent with the order in the form files.
Update Changelog
Record your changes in the following changelog files:
- Simplified Chinese:
docs/maintenance/changelog.md - English:
docs/en/maintenance/changelog.md