Skip to content

Commit 16b75e8

Browse files
committed
Add typescript workflow
1 parent 8887d6a commit 16b75e8

File tree

5 files changed

+58
-2
lines changed

5 files changed

+58
-2
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ jobs:
4242
id: pnpm-install
4343
uses: pnpm/action-setup@v2
4444
with:
45-
version: 7
4645
run_install: false
4746

4847
- name: Get pnpm store directory

.github/workflows/eslint.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ jobs:
3535
id: pnpm-install
3636
uses: pnpm/action-setup@v2
3737
with:
38-
version: 7
3938
run_install: false
4039

4140
- name: Get pnpm store directory

.github/workflows/typescript.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: TypeScript Types
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "**.ts"
8+
- "package.json"
9+
- "pnpm-lock.yaml"
10+
- "tsconfig.json"
11+
- ".github/workflows/typescript.yml"
12+
pull_request:
13+
branches: [main]
14+
paths:
15+
- "**.ts"
16+
- "package.json"
17+
- "pnpm-lock.yaml"
18+
- "tsconfig.json"
19+
- ".github/workflows/typescript.yml"
20+
21+
jobs:
22+
typescript:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v3
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version: 18
31+
32+
- name: Setup pnpm
33+
uses: pnpm/action-setup@v2
34+
with:
35+
run_install: false
36+
37+
- name: Get pnpm store directory
38+
id: pnpm-cache
39+
shell: bash
40+
run: |
41+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
42+
43+
- uses: actions/cache@v3
44+
name: Setup pnpm cache
45+
with:
46+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
47+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
48+
restore-keys: |
49+
${{ runner.os }}-pnpm-store-
50+
51+
- name: Install dependencies
52+
run: pnpm i --frozen-lockfile
53+
54+
- name: Run TypeScript
55+
run: pnpm run lint:types

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
pnpm run staged
2+
pnpm run lint:types

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
"types": "./@type/index.d.ts",
3434
"scripts": {
3535
"eslint": "eslint src/**/*.ts",
36+
"lint:types": "tsc --noEmit",
37+
"lint": "pnpm eslint && pnpm lint:types",
3638
"staged": "lint-staged",
3739
"coverage": "c8 pnpm test",
3840
"ci": "c8 pnpm test && c8 report --reporter=json",

0 commit comments

Comments
 (0)