Skip to content

Commit 6f66882

Browse files
committed
feat: ✨ add testing and linting setup
* Introduced GitHub Actions workflow for automated testing on push and pull request events. * Added Husky hooks for pre-commit and pre-push to enforce linting and run tests. * Updated `package.json` with new scripts for `prepare` and `test`.
1 parent 52a47d7 commit 6f66882

File tree

5 files changed

+42
-11
lines changed

5 files changed

+42
-11
lines changed

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: 🧪 Tests
2+
3+
on:
4+
# https://blog.esciencecenter.nl/reduce-reuse-recycle-save-the-planet-one-github-action-at-a-time-4ab602255c3f
5+
push:
6+
paths:
7+
- src/*
8+
9+
pull_request:
10+
paths:
11+
- src/*
12+
13+
workflow_dispatch:
14+
15+
jobs:
16+
test:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: 📥 Checkout
21+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
23+
- name: 🔧 Setup Bun
24+
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
25+
26+
- name: 📦 Install dependencies
27+
run: bun install --frozen-lockfile
28+
29+
- name: 🧪 Run tests
30+
run: bun run test

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bunx lint-staged

.husky/pre-push

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bun run test

bun.lockb

14.9 KB
Binary file not shown.

package.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,24 @@
1616
},
1717
"license": "MIT",
1818
"description": "📊 Get information about a Node.js project in the terminal in the beautiful TUI",
19-
"keywords": [
20-
"cli",
21-
"nodejs",
22-
"terminal",
23-
"tui",
24-
"project-info"
25-
],
19+
"keywords": ["cli", "nodejs", "terminal", "tui", "project-info"],
2620
"repository": {
2721
"type": "git",
2822
"url": "git+https://github.com/cli-stuff/apr"
2923
},
3024
"homepage": "https://github.com/cli-stuff/apr",
3125
"scripts": {
3226
"lint": "biome check --fix",
27+
"prepare": "husky",
3328
"format": "biome format --write .",
29+
"test": "FORCE_COLOR=true bun test",
3430
"preversion": "bun run format && git add .",
3531
"build": "bun build ./src/index.tsx --minify --outdir ./dist --target node --footer '// Built with Bun! (https://bun.sh)' --external=yoga-wasm-web",
3632
"prepublishOnly": "bun run build"
3733
},
34+
"lint-staged": {
35+
"*": "bun run format"
36+
},
3837
"dependencies": {
3938
"@types/react": "^19.0.2",
4039
"ink": "^5.1.0",
@@ -45,12 +44,12 @@
4544
"@biomejs/biome": "^1.9.4",
4645
"@schemastore/package": "^0.0.10",
4746
"@types/bun": "^1.1.14",
48-
"ink-testing-library": "^4.0.0"
47+
"husky": "^9.1.7",
48+
"ink-testing-library": "^4.0.0",
49+
"lint-staged": "^15.2.11"
4950
},
5051
"patchedDependencies": {
5152
"ink@5.1.0": "patches/ink@5.1.0.patch"
5253
},
53-
"trustedDependencies": [
54-
"@biomejs/biome"
55-
]
54+
"trustedDependencies": ["@biomejs/biome"]
5655
}

0 commit comments

Comments
 (0)