Skip to content

Commit 198cf1b

Browse files
authored
ci: lint pr title, move lint/format to ci and rm husky (#27)
* ci: add lint pr workflow * chore: make first mention of tRPC and Koa links * chore: manual trigger for test * Revert "chore: manual trigger for test" This reverts commit bb5efac. * chore: attempt to trigger on pr * Revert "chore: attempt to trigger on pr" This reverts commit a8a192d. * chore: switch trigger - should work with forks and avoids potential secutity issue? amannn/action-semantic-pull-request#219 * ci: run tests against node version 16, 18, 20 * ci: fix node 16 tests * chore: rm commit msg lint linting in PR title. individual commits technically dont matter because they are squash/merged. * chore: rm typo item for unused pkg manager file * chore: make eslint stricter, apply to test * ci: add lint, format to gh workflow * chore: rm husky hooks * fix: gh action lint, install order * chore: update package lock
1 parent 84e4f97 commit 198cf1b

12 files changed

+52
-702
lines changed

.eslintrc

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
},
77
"plugins": ["@typescript-eslint"],
88
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
9-
"rules": {
10-
11-
},
9+
"rules": {},
1210
"env": {
1311
"jest": true,
1412
"node": true,
1513
"es2022": true
1614
}
17-
}
15+
}

.github/workflows/ci.yaml

+11-3
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,22 @@ on: [push]
55
jobs:
66
build-and-test:
77
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
node-version: ['16.x', '18.x', '20.x']
12+
813
steps:
914
- uses: actions/checkout@v4
10-
- uses: actions/setup-node@v4
15+
- name: Use Node.js ${{ matrix.node-version }}
16+
uses: actions/setup-node@v4
1117
with:
12-
node-version: '18.x'
18+
node-version: ${{ matrix.node-version }}
1319
- uses: pnpm/action-setup@v3
1420
- name: Install Dependencies
15-
run: pnpm install
21+
run: pnpm install --frozen-lockfile
22+
- name: Lint
23+
run: pnpm check:format
1624
- name: Build
1725
run: pnpm build
1826
- name: Test

.github/workflows/lint-pr.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 'Lint PR'
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
pull-requests: read
8+
9+
jobs:
10+
main:
11+
name: Validate PR title
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: amannn/action-semantic-pull-request@v5
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ jobs:
1515
persist-credentials: false
1616
- uses: actions/setup-node@v3
1717
with:
18-
node-version: "18.x"
18+
node-version: '18.x'
1919
- uses: pnpm/action-setup@v2
20-
- run: pnpm ci-install
20+
- run: pnpm install --frozen-lockfile
2121
- run: pnpm build
2222
- run: pnpm test
2323
- run: npx semantic-release
2424
env:
2525
GH_TOKEN: ${{ secrets.GH_TOKEN_SEMANTIC_RELEASE }}
2626
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
27+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
node_modules
33
dist
44
coverage
5-
notes.md
6-
yaen-error.log
5+
notes.md

.husky/commit-msg

-4
This file was deleted.

.husky/pre-commit

-4
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# trpc-koa-adapter
22

3-
This is an adapter which allows you to mount tRPC onto a Koa server. This is similar to the [trpc/packages/server/src/adapters/express.ts](https://github.com/trpc/trpc/blob/next/packages/server/src/adapters/express.ts) adapter.
3+
This is an adapter which allows you to mount [tRPC](https://github.com/trpc/trpc) onto a [Koa](https://github.com/koajs/koa) server. This is similar to the [trpc/packages/server/src/adapters/express.ts](https://github.com/trpc/trpc/blob/next/packages/server/src/adapters/express.ts) adapter.
44

55
# How to Add tRPC to a Koa Server
66

commitlint.config.js

-1
This file was deleted.

package.json

+6-20
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
"main": "dist/index.js",
1111
"types": "dist/index.d.ts",
1212
"scripts": {
13-
"ci-install": "HUSKY=0 pnpm install",
1413
"build": "rm -rf ./dist && tsc",
1514
"test": "jest",
16-
"lint": "eslint --fix \"src/**/*.{js,ts}\"",
17-
"format": "prettier --config --ignore-path .gitignore --write \"**/*.+(js|ts|json)\"",
18-
"prepare": "husky install",
15+
"prettier": "prettier --write --config --ignore-path .gitignore \"**/*.+(js|ts|json)\"",
16+
"lint": "eslint --fix --max-warnings=0 src/**/*.ts test/**/*.ts",
17+
"format": "pnpm prettier && pnpm lint",
18+
"check:prettier": "prettier --check --config --ignore-path .gitignore \"**/*.+(js|ts|json)\"",
19+
"check:lint": "eslint --max-warnings=0 src/**/*.ts test/**/*.ts",
20+
"check:format": "pnpm prettier && pnpm lint",
1921
"semantic-release": "semantic-release"
2022
},
2123
"files": [
@@ -30,8 +32,6 @@
3032
],
3133
"packageManager": "pnpm@8.15.4",
3234
"devDependencies": {
33-
"@commitlint/cli": "^17.6.6",
34-
"@commitlint/config-conventional": "^17.6.6",
3535
"@koa/bodyparser": "^5.0.0",
3636
"@semantic-release/changelog": "^6.0.3",
3737
"@semantic-release/git": "^10.0.1",
@@ -45,11 +45,9 @@
4545
"conventional-changelog-conventionalcommits": "^6.1.0",
4646
"eslint": "^8.44.0",
4747
"eslint-config-prettier": "^8.8.0",
48-
"husky": "^8.0.3",
4948
"jest": "^29.5.0",
5049
"koa": "^2.14.2",
5150
"koa-bodyparser": "^4.4.1",
52-
"lint-staged": "^13.2.3",
5351
"prettier": "^2.8.8",
5452
"semantic-release": "^21.0.6",
5553
"supertest": "^6.3.3",
@@ -59,17 +57,5 @@
5957
"peerDependencies": {
6058
"@trpc/server": "^10.0.0-rc.4",
6159
"koa": ">=2.13.0"
62-
},
63-
"husky": {
64-
"hooks": {
65-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
66-
"pre-commit": "pnpm lint-staged && pnpm test"
67-
}
68-
},
69-
"lint-staged": {
70-
"*.{ts,js}": [
71-
"prettier --write --config ./.prettierrc",
72-
"eslint --fix --max-warnings=0"
73-
]
7460
}
7561
}

0 commit comments

Comments
 (0)