Skip to content
This repository was archived by the owner on Jan 18, 2025. It is now read-only.

Commit b5b2671

Browse files
committed
chore: better config and CI pipelines
1 parent 19d0ed6 commit b5b2671

16 files changed

+1105
-33
lines changed

.eslintignore

-1
This file was deleted.

.eslintrc.json

-14
This file was deleted.

.github/workflows/ci.yaml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out repository
16+
uses: actions/checkout@v4
17+
18+
- name: Install pnpm
19+
uses: pnpm/action-setup@v3
20+
with:
21+
version: latest
22+
23+
- name: Set up Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: latest
27+
cache: pnpm
28+
29+
- name: Install dependencies
30+
run: pnpm install
31+
32+
- name: Lint error
33+
run: pnpm exec eslint .
34+
35+
- name: Lint format
36+
run: pnpm exec prettier . --check
37+
38+
- name: Lint commit message
39+
run: pnpm exec commitlint --last
40+
41+
test:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Check out repository
45+
uses: actions/checkout@v4
46+
47+
- name: Install pnpm
48+
uses: pnpm/action-setup@v3
49+
with:
50+
version: latest
51+
52+
- name: Set up Node.js
53+
uses: actions/setup-node@v4
54+
with:
55+
node-version: latest
56+
cache: pnpm
57+
58+
- name: Install dependencies
59+
run: pnpm install
60+
61+
- name: Run tests
62+
run: pnpm run test

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
node_modules
21
dist
2+
node_modules
3+
*.tgz

.husky/commit-msg

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm exec commitlint --edit $1

.husky/pre-commit

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm exec lint-staged

.husky/pre-push

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm run test --run

.prettierrc.json

-1
This file was deleted.

commitlint.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
extends: ["@commitlint/config-conventional"],
3+
};

eslint.config.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import js from "@eslint/js";
2+
import prettier from "eslint-config-prettier";
3+
import ts from "typescript-eslint";
4+
5+
export default ts.config(
6+
js.configs.recommended,
7+
...ts.configs.strictTypeChecked,
8+
...ts.configs.stylisticTypeChecked,
9+
prettier,
10+
{
11+
languageOptions: {
12+
parserOptions: {
13+
project: true,
14+
tsconfigRootDir: import.meta.dirname,
15+
},
16+
},
17+
},
18+
{ ignores: ["dist"] },
19+
);

lint-staged.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
"*.{js,ts}": [
3+
"eslint --fix --cache --cache-location ./node_modules/.cache/eslint/.eslint-cache",
4+
"prettier --write --cache",
5+
],
6+
"*.{json,md}": "prettier --write --cache",
7+
};

package.json

+10-3
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,22 @@
3737
"url": "https://github.com/mrcaidev/http-errors.git"
3838
},
3939
"scripts": {
40-
"build": "vite build"
40+
"build": "vite build",
41+
"test": "vitest",
42+
"prepare": "husky"
4143
},
4244
"devDependencies": {
43-
"@typescript-eslint/eslint-plugin": "^7.11.0",
44-
"@typescript-eslint/parser": "^7.11.0",
45+
"@commitlint/cli": "^19.3.0",
46+
"@commitlint/config-conventional": "^19.2.2",
47+
"@types/eslint-config-prettier": "^6.11.3",
48+
"@types/eslint__js": "^8.42.3",
4549
"eslint": "^9.3.0",
4650
"eslint-config-prettier": "^9.1.0",
51+
"husky": "^9.0.11",
52+
"lint-staged": "^15.2.5",
4753
"prettier": "^3.2.5",
4854
"typescript": "^5.4.5",
55+
"typescript-eslint": "^7.11.0",
4956
"vite": "^5.2.12",
5057
"vite-plugin-dts": "^3.9.1",
5158
"vitest": "^1.6.0"

0 commit comments

Comments
 (0)