Skip to content

Commit

Permalink
ci: lint pr title, move lint/format to ci and rm husky (#27)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
BlairCurrey committed Mar 20, 2024
1 parent 84e4f97 commit 198cf1b
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 702 deletions.
6 changes: 2 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
},
"plugins": ["@typescript-eslint"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"rules": {

},
"rules": {},
"env": {
"jest": true,
"node": true,
"es2022": true
}
}
}
14 changes: 11 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,22 @@ on: [push]
jobs:
build-and-test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: ['16.x', '18.x', '20.x']

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: ${{ matrix.node-version }}
- uses: pnpm/action-setup@v3
- name: Install Dependencies
run: pnpm install
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm check:format
- name: Build
run: pnpm build
- name: Test
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/lint-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Lint PR'

on:
pull_request:

permissions:
pull-requests: read

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@v3
with:
node-version: "18.x"
node-version: '18.x'
- uses: pnpm/action-setup@v2
- run: pnpm ci-install
- run: pnpm install --frozen-lockfile
- run: pnpm build
- run: pnpm test
- run: npx semantic-release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN_SEMANTIC_RELEASE }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
node_modules
dist
coverage
notes.md
yaen-error.log
notes.md
4 changes: 0 additions & 4 deletions .husky/commit-msg

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# trpc-koa-adapter

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.
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.

# How to Add tRPC to a Koa Server

Expand Down
1 change: 0 additions & 1 deletion commitlint.config.js

This file was deleted.

26 changes: 6 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"ci-install": "HUSKY=0 pnpm install",
"build": "rm -rf ./dist && tsc",
"test": "jest",
"lint": "eslint --fix \"src/**/*.{js,ts}\"",
"format": "prettier --config --ignore-path .gitignore --write \"**/*.+(js|ts|json)\"",
"prepare": "husky install",
"prettier": "prettier --write --config --ignore-path .gitignore \"**/*.+(js|ts|json)\"",
"lint": "eslint --fix --max-warnings=0 src/**/*.ts test/**/*.ts",
"format": "pnpm prettier && pnpm lint",
"check:prettier": "prettier --check --config --ignore-path .gitignore \"**/*.+(js|ts|json)\"",
"check:lint": "eslint --max-warnings=0 src/**/*.ts test/**/*.ts",
"check:format": "pnpm prettier && pnpm lint",
"semantic-release": "semantic-release"
},
"files": [
Expand All @@ -30,8 +32,6 @@
],
"packageManager": "pnpm@8.15.4",
"devDependencies": {
"@commitlint/cli": "^17.6.6",
"@commitlint/config-conventional": "^17.6.6",
"@koa/bodyparser": "^5.0.0",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
Expand All @@ -45,11 +45,9 @@
"conventional-changelog-conventionalcommits": "^6.1.0",
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
"husky": "^8.0.3",
"jest": "^29.5.0",
"koa": "^2.14.2",
"koa-bodyparser": "^4.4.1",
"lint-staged": "^13.2.3",
"prettier": "^2.8.8",
"semantic-release": "^21.0.6",
"supertest": "^6.3.3",
Expand All @@ -59,17 +57,5 @@
"peerDependencies": {
"@trpc/server": "^10.0.0-rc.4",
"koa": ">=2.13.0"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "pnpm lint-staged && pnpm test"
}
},
"lint-staged": {
"*.{ts,js}": [
"prettier --write --config ./.prettierrc",
"eslint --fix --max-warnings=0"
]
}
}

0 comments on commit 198cf1b

Please sign in to comment.