Skip to content

Commit c2bcb14

Browse files
committed
chore: setup lintcommit, git-cliff and prettier
1 parent ede04c4 commit c2bcb14

File tree

14 files changed

+1556
-11
lines changed

14 files changed

+1556
-11
lines changed

.github/workflows/lint.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Linting
2+
3+
on: [push, pull_request]
4+
permissions:
5+
contents: write
6+
pull-requests: write
7+
8+
jobs:
9+
# Example file at
10+
# https://commitlint.js.org/guides/ci-setup.html
11+
# doest work. Found a solution at
12+
# https://github.com/conventional-changelog/commitlint/pull/4132
13+
commitlint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Use Node.js
18+
uses: actions/setup-node@v4
19+
- name: Print versions
20+
run: |
21+
git --version
22+
node --version
23+
npm --version
24+
npx commitlint --version
25+
- name: Install commitlint
26+
run: |
27+
npm install conventional-changelog-conventionalcommits
28+
npm install commitlint@latest
29+
30+
- name: Validate current commit (last commit) with commitlint
31+
if: github.event_name == 'push'
32+
run: npx commitlint --last --verbose
33+
34+
- name: Validate PR commits with commitlint
35+
if: github.event_name == 'pull_request'
36+
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no -- commitlint --edit $1

.husky/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
npm run format:check
2+
npm run changelog

.prettierignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Prettier ignore list
2+
# (everything from .gitignore is already excluded)
3+
4+
tests/test_bake
5+
template/.prettierrc
6+
7+
# Ugly preventing pass Prettier but just copy from Sphinx Basic theme
8+
template/src/{{ project_slug }}/domainindex.html
9+
template/src/{{ project_slug }}/genindex.html
10+
template/src/{{ project_slug }}/static/doctools.js
11+
template/src/{{ project_slug }}/static/documentation_options.js.jinja
12+
template/src/{{ project_slug }}/static/language_data.js.jinja
13+
template/src/{{ project_slug }}/static/searchtools.js
14+
template/src/{{ project_slug }}/static/sphinx_highlight.js

.prettierrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"plugins": ["prettier-plugin-jinja-template", "prettier-plugin-tailwindcss"],
3+
4+
"overrides": [
5+
{
6+
"files": ["*.html"],
7+
"options": {
8+
"parser": "jinja-template"
9+
}
10+
}
11+
]
12+
}

CHANGELOG.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,44 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Improve VS Code experience. Enabling Tailwind intellisense in Jinja templates
13+
1014
## [0.1.1] - 2025-03-11
1115

12-
- feat: add VS Code support files to template
16+
### Added
17+
18+
- Add VS Code support files to template.
1319

1420
## [0.1.0] - 2025-03-09
1521

16-
Initial release.
22+
### Added
23+
24+
- Add minimal docs.
25+
- Add CHANGELOG.md, LICENCE, favicon and hero images.
26+
27+
### Changed
28+
29+
- Release v0.1.0.
30+
- Run tests in GH Actions.
31+
- Associate jinja modes for vscode.
32+
- Convert to copier template.
33+
- Initial (template theme).
34+
35+
### Fixed
36+
37+
- Dark/ligh mode icon.
38+
- Default template bake and nox -s build.
39+
- Package names is in snake_case.
40+
- Crash with sphinx theme static templates. Because Sphinx static template uses .jinja suffix too, Copier thinks they are its templates and crash. To prevent collision, we changed Copier template suffix to .copier.
41+
42+
[unreleased]: https://github.com/documatt/sphinx-theme-template/compare/v0.1.1..HEAD
43+
[0.1.1]: https://github.com/documatt/sphinx-theme-template/compare/v0.1.0..v0.1.1
44+
45+
<!-- generated by git-cliff -->

cliff.toml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# git-cliff ~ configuration file
2+
# https://git-cliff.org/docs/configuration
3+
4+
[changelog]
5+
# template for the changelog header
6+
header = """
7+
# Changelog\n
8+
All notable changes to this project will be documented in this file.
9+
10+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
11+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n
12+
"""
13+
# template for the changelog body
14+
# https://keats.github.io/tera/docs/#introduction
15+
body = """
16+
{% if version -%}
17+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
18+
{% else -%}
19+
## [Unreleased]
20+
{% endif -%}
21+
{% for group, commits in commits | group_by(attribute="group") %}
22+
### {{ group | upper_first }}
23+
{% for commit in commits %}
24+
- {{ commit.message | split(pat="\n") | first | upper_first | trim }}.{% if commit.body %} {{ commit.body }}{% endif %}\
25+
{% endfor %}
26+
{% endfor %}\n
27+
"""
28+
# template for the changelog footer
29+
footer = """
30+
{% for release in releases -%}
31+
{% if release.version -%}
32+
{% if release.previous.version -%}
33+
[{{ release.version | trim_start_matches(pat="v") }}]: \
34+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
35+
/compare/{{ release.previous.version }}..{{ release.version }}
36+
{% endif -%}
37+
{% else -%}
38+
[unreleased]: https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
39+
/compare/{{ release.previous.version }}..HEAD
40+
{% endif -%}
41+
{% endfor %}
42+
<!-- generated by git-cliff -->
43+
"""
44+
# remove the leading and trailing whitespace from the templates
45+
trim = true
46+
47+
[git]
48+
# parse the commits based on https://www.conventionalcommits.org
49+
conventional_commits = true
50+
# filter out the commits that are not conventional
51+
filter_unconventional = false
52+
# regex for parsing and grouping commits
53+
commit_parsers = [
54+
{ message = "^[a|A]dd", group = "Added" },
55+
{ message = "^[s|S]upport", group = "Added" },
56+
{ message = "^[r|R]emove", group = "Removed" },
57+
{ message = "^.*: add", group = "Added" },
58+
{ message = "^.*: support", group = "Added" },
59+
{ message = "^.*: remove", group = "Removed" },
60+
{ message = "^.*: delete", group = "Removed" },
61+
{ message = "^test", group = "Fixed" },
62+
{ message = "^fix", group = "Fixed" },
63+
{ message = "^.*: fix", group = "Fixed" },
64+
{ message = "^.*", group = "Changed" },
65+
]
66+
# filter out the commits that are not matched by commit parsers
67+
filter_commits = false
68+
# sort the tags topologically
69+
topo_order = false
70+
# sort the commits inside sections by oldest/newest order
71+
sort_commits = "newest"

commitlint.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { UserConfig } from "@commitlint/types";
2+
3+
const Configuration: UserConfig = {
4+
extends: ["@commitlint/config-conventional"],
5+
};
6+
7+
export default Configuration;

docs/source/usage.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,30 @@ npm i -D ...
1010

1111
## Update sample docs
1212

13-
sample_docs/pyproject.toml
13+
In preview mode, Python (Sphinx) and Node.js (Tailwind) part runs in parallel. To distinct the terminal output, both are prefixed with their names.
14+
15+
Since they run in parallel, they are independent. It means:
16+
17+
- One may crash and other will continue to run. You must inspect failure yourself.
18+
- Output is mixed. For convenience, processes have different colors.
19+
20+
![](_static/preview-mixed-output.png)
21+
22+
## package.json tasks
23+
24+
The `package.json` must contain the following `scripts` tasks. They are called by Nox tasks. However, you can add your own additional tasks.
25+
26+
```json
27+
{
28+
"scripts": {
29+
"theme:build": "...",
30+
"theme:watch": "..."
31+
}
32+
}
33+
```
34+
35+
For example, if you want to build just Node.js assets, call `npm run theme:build`.
36+
37+
### theme:build
38+
39+
### theme:watch

0 commit comments

Comments
 (0)