Skip to content

Commit

Permalink
feat: install knip, create gh workflow, add knip to workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
buckhalt committed Jun 5, 2024
1 parent b8ff543 commit 139d84c
Show file tree
Hide file tree
Showing 3 changed files with 424 additions and 1 deletion.
51 changes: 51 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Lint

on:
pull_request:
branches:
- "*"

jobs:
build:
runs-on: ubuntu-latest

env:
DATABASE_URL: postgresql://username:password@host:port/database

steps:
- uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable

- name: Use Node 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup next cache
with:
path: |
${{ env.STORE_PATH }}
${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
- name: Run build
run: pnpm lint

- name: Run knip
run: pnpm knip
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
"start": "next start",
"lint": "next lint",
"db:push": "drizzle-kit push --config=drizzle.config.ts",
"db:studio": "drizzle-kit studio --config=drizzle.config.ts"
"db:studio": "drizzle-kit studio --config=drizzle.config.ts",
"knip": "knip"
},
"dependencies": {
"@t3-oss/env-nextjs": "^0.10.1",
"drizzle-orm": "^0.31.1",
"knip": "^5.17.4",
"next": "14.2.3",
"postgres": "^3.4.4",
"react": "^18",
Expand Down
Loading

0 comments on commit 139d84c

Please sign in to comment.