Skip to content

Commit 396c747

Browse files
committed
chore: add project configuration files
Add CI, Git hooks, semantic release, and build orchestration: - GitHub Actions workflows for CI - Husky hooks for commit validation - Commitlint with conventional commit config - Semantic release configuration - Turbo for task orchestration
1 parent 5b11403 commit 396c747

7 files changed

Lines changed: 234 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
validate:
13+
name: Validate
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup pnpm
24+
uses: pnpm/action-setup@v4
25+
with:
26+
version: 10
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 22
32+
cache: pnpm
33+
34+
- name: Install dependencies
35+
run: pnpm install --frozen-lockfile
36+
37+
- name: Typecheck
38+
run: pnpm typecheck
39+
40+
- name: Lint
41+
run: pnpm lint
42+
43+
- name: Test
44+
run: pnpm test
45+
46+
- name: Build
47+
run: pnpm build
48+
49+
- name: Verify build
50+
run: |
51+
test -d dist
52+
test -f dist/index.js
53+
54+
release:
55+
name: Release
56+
needs: validate
57+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
58+
runs-on: ubuntu-latest
59+
permissions:
60+
contents: write
61+
issues: write
62+
pull-requests: write
63+
id-token: write
64+
attestations: write
65+
steps:
66+
- name: Checkout
67+
uses: actions/checkout@v4
68+
with:
69+
fetch-depth: 0
70+
71+
- name: Setup pnpm
72+
uses: pnpm/action-setup@v4
73+
with:
74+
version: 10
75+
76+
- name: Setup Node.js
77+
uses: actions/setup-node@v4
78+
with:
79+
node-version: 22
80+
cache: pnpm
81+
registry-url: https://registry.npmjs.org
82+
83+
- name: Install dependencies
84+
run: pnpm install --frozen-lockfile
85+
86+
- name: Build
87+
run: pnpm build
88+
89+
- name: Release
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
run: pnpm exec semantic-release

.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Dependencies
2+
node_modules/
3+
.pnpm-store/
4+
5+
# Build outputs
6+
dist/
7+
*.tsbuildinfo
8+
9+
# Test coverage
10+
coverage/
11+
.nyc_output/
12+
13+
# Turborepo cache
14+
.turbo/
15+
16+
# Editor directories and files
17+
.vscode/
18+
.idea/
19+
*.swp
20+
*.swo
21+
*~
22+
.DS_Store
23+
24+
# Logs
25+
logs/
26+
*.log
27+
npm-debug.log*
28+
yarn-debug.log*
29+
yarn-error.log*
30+
pnpm-debug.log*
31+
32+
# Environment files
33+
.env
34+
.env.local
35+
.env.*.local
36+
37+
# Temporary files
38+
*.tmp
39+
.cache/
40+
41+
# Lock file (single package, not workspace)
42+
pnpm-lock.yaml
43+
44+
data/

.husky/commit-msg

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

.husky/pre-commit

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

.releaserc.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
[
5+
"@semantic-release/commit-analyzer",
6+
{
7+
"releaseRules": [
8+
{ "type": "feat", "release": "minor" },
9+
{ "type": "fix", "release": "patch" },
10+
{ "type": "docs", "release": "patch" },
11+
{ "type": "style", "release": "patch" },
12+
{ "type": "refactor", "release": "patch" },
13+
{ "type": "perf", "release": "patch" },
14+
{ "type": "test", "release": "patch" },
15+
{ "type": "build", "release": "patch" },
16+
{ "type": "ci", "release": "patch" },
17+
{ "type": "chore", "release": "patch" },
18+
{ "type": "revert", "release": "patch" }
19+
]
20+
}
21+
],
22+
"@semantic-release/release-notes-generator",
23+
[
24+
"@semantic-release/changelog",
25+
{
26+
"changelogFile": "CHANGELOG.md"
27+
}
28+
],
29+
[
30+
"@semantic-release/npm",
31+
{
32+
"npmPublish": true,
33+
"provenance": true
34+
}
35+
],
36+
[
37+
"@semantic-release/git",
38+
{
39+
"assets": ["CHANGELOG.md", "package.json"],
40+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
41+
}
42+
],
43+
"@semantic-release/github"
44+
]
45+
}

commitlint.config.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
export default {
2+
extends: ["@commitlint/config-conventional"],
3+
rules: {
4+
"type-enum": [
5+
2,
6+
"always",
7+
[
8+
"feat", // New feature
9+
"fix", // Bug fix
10+
"docs", // Documentation
11+
"style", // Formatting, no code change
12+
"refactor", // Code change without feature/fix
13+
"perf", // Performance improvement
14+
"test", // Adding tests
15+
"build", // Build system or dependencies
16+
"ci", // CI configuration
17+
"chore", // Maintenance
18+
"revert", // Revert commit
19+
],
20+
],
21+
"subject-case": [2, "always", "lower-case"],
22+
"header-max-length": [2, "always", 100],
23+
},
24+
};

turbo.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"$schema": "https://turbo.build/schema.json",
3+
"tasks": {
4+
"typecheck": {
5+
"inputs": ["src/**/*.ts", "tsconfig.json"],
6+
"outputs": ["tsconfig.tsbuildinfo"]
7+
},
8+
"lint": {
9+
"dependsOn": ["typecheck"],
10+
"inputs": ["src/**/*.ts", "eslint.config.ts"],
11+
"outputs": []
12+
},
13+
"test": {
14+
"dependsOn": ["typecheck", "lint"],
15+
"inputs": ["src/**/*.ts", "vite.config.ts"],
16+
"outputs": ["coverage/**", "node_modules/.vitest/**"]
17+
},
18+
"build": {
19+
"dependsOn": ["test"],
20+
"inputs": ["src/**/*.ts", "vite.config.ts", "tsconfig.json", "package.json"],
21+
"outputs": ["dist/**"]
22+
},
23+
"validate": {
24+
"dependsOn": ["build"]
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)