Skip to content

Commit 570e1a9

Browse files
committed
chore: apply best practices from @echecs/elo
- Update dependabot to use pnpm ecosystem - Add version output and GitHub Release step to release workflow - Add Codecov coverage upload to test workflow - Add docs workflow for GitHub Pages deployment - Add GitHub issue templates (bug report, feature request) and PR template - Update eslint config: add unicorn, vitest plugins, curly/eqeqeq rules, explicit-module-boundary-types - Update lint-staged to use explicit extension glob - Replace npx lint-staged with pnpm lint-staged in pre-commit hook; remove pre-push hook - Add bugs, engines, exports, homepage, repository fields to package.json - Add CHANGELOG.md to published files - Update format:ci script to use extension-explicit prettier pattern - Add CHANGELOG.md, CONTRIBUTING.md, SECURITY.md community files - Fix unicorn lint violations: node: prefix imports, for-of over forEach, replaceAll, inline flatMap callback
1 parent 128bcd1 commit 570e1a9

24 files changed

+850
-75
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Bug Report
2+
description: Report an incorrect calculation or unexpected behaviour
3+
labels: ['bug']
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for taking the time to report a bug. Please fill in as much detail as possible.
9+
10+
- type: textarea
11+
id: description
12+
attributes:
13+
label: Description
14+
description: A clear and concise description of the bug.
15+
validations:
16+
required: true
17+
18+
- type: textarea
19+
id: reproduction
20+
attributes:
21+
label: Minimal reproducible example
22+
description: A short code snippet that demonstrates the issue.
23+
render: typescript
24+
validations:
25+
required: true
26+
27+
- type: textarea
28+
id: expected
29+
attributes:
30+
label: Expected behaviour
31+
description: What did you expect to happen?
32+
validations:
33+
required: true
34+
35+
- type: textarea
36+
id: actual
37+
attributes:
38+
label: Actual behaviour
39+
description: What actually happened?
40+
validations:
41+
required: true
42+
43+
- type: input
44+
id: version
45+
attributes:
46+
label: Package version
47+
placeholder: 'e.g. 1.0.7'
48+
validations:
49+
required: true
50+
51+
- type: input
52+
id: node
53+
attributes:
54+
label: Node.js version
55+
placeholder: 'e.g. 20.11.0'
56+
validations:
57+
required: true

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Discussions
4+
url: https://github.com/mormubis/pgn/discussions
5+
about: Ask questions or share ideas
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Feature Request
2+
description: Suggest a new feature or improvement
3+
labels: ['enhancement']
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for suggesting an improvement. Please describe your idea in as much detail as possible.
9+
10+
- type: textarea
11+
id: problem
12+
attributes:
13+
label: Problem or motivation
14+
description: What problem does this feature solve? Why is it needed?
15+
validations:
16+
required: true
17+
18+
- type: textarea
19+
id: solution
20+
attributes:
21+
label: Proposed solution
22+
description: Describe the feature or change you'd like to see.
23+
validations:
24+
required: true
25+
26+
- type: textarea
27+
id: alternatives
28+
attributes:
29+
label: Alternatives considered
30+
description: Any alternative approaches you've thought of?
31+
validations:
32+
required: false
33+
34+
- type: textarea
35+
id: context
36+
attributes:
37+
label: Additional context
38+
description: Any other context, references, or examples that might help.
39+
validations:
40+
required: false

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## Description
2+
3+
<!-- What does this PR change and why? -->
4+
5+
## Type of change
6+
7+
- [ ] Bug fix
8+
- [ ] New feature
9+
- [ ] Refactor / internal improvement
10+
- [ ] Documentation update
11+
- [ ] Dependency update
12+
13+
## Checklist
14+
15+
- [ ] Tests added or updated for all changed behaviour
16+
- [ ] All checks pass (`pnpm lint && pnpm test && pnpm build`)
17+
- [ ] `CHANGELOG.md` updated (for bug fixes and new features)

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: 2
22
updates:
3-
- package-ecosystem: npm
3+
- package-ecosystem: pnpm
44
directory: '/'
55
schedule:
66
interval: daily

.github/workflows/docs.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: 📚 Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: docs-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
deploy:
15+
name: 📚 Deploy docs
16+
permissions:
17+
contents: write
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: ⬇️ Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: 📦 Setup pnpm
24+
uses: pnpm/action-setup@v4
25+
with:
26+
version: latest
27+
28+
- name: ⎔ Setup node
29+
uses: actions/setup-node@v4
30+
with:
31+
cache: 'pnpm'
32+
node-version: 'node'
33+
34+
- name: 📥 Install dependencies
35+
run: pnpm install --frozen-lockfile
36+
37+
- name: 📚 Generate docs
38+
run: pnpm run docs
39+
40+
- name: 🚀 Deploy to GitHub Pages
41+
uses: peaceiris/actions-gh-pages@v4
42+
with:
43+
github_token: ${{ secrets.GITHUB_TOKEN }}
44+
publish_dir: ./docs

.github/workflows/release.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
name: ✅ Check version
1111
outputs:
1212
changed: ${{ steps.check.outputs.changed }}
13+
version: ${{ steps.check.outputs.version }}
1314
runs-on: ubuntu-latest
1415
steps:
1516
- name: ⬇️ Checkout code
@@ -36,7 +37,7 @@ jobs:
3637
name: 🚀 Release
3738
permissions:
3839
id-token: write
39-
contents: read
40+
contents: write
4041
runs-on: ubuntu-latest
4142
needs: [check, format, lint, test]
4243
if: needs.check.outputs.changed == 'true'
@@ -60,7 +61,13 @@ jobs:
6061
- name: 📥 Install dependencies
6162
run: pnpm install --frozen-lockfile
6263

63-
- name: 🗂️ Release to NPM
64+
- name: Release to NPM
6465
run: pnpm publish --access public --provenance
6566
env:
6667
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
68+
69+
- name: 🏷️ Create GitHub Release
70+
uses: softprops/action-gh-release@v2
71+
with:
72+
tag_name: v${{ needs.check.outputs.version }}
73+
generate_release_notes: true

.github/workflows/test.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,10 @@ jobs:
3131
run: pnpm install --frozen-lockfile
3232

3333
- name: 🧪 Test
34-
run: pnpm run test
34+
run: pnpm run test:coverage
35+
36+
- name: 📊 Upload coverage
37+
uses: codecov/codecov-action@v5
38+
with:
39+
token: ${{ secrets.CODECOV_TOKEN }}
40+
fail_ci_if_error: false

.husky/pre-commit

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
#!/usr/bin/env sh
2-
npx lint-staged
1+
pnpm lint-staged

.husky/pre-push

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)