Skip to content

Commit f9d7bb2

Browse files
committed
refactor: use Bun, Biome.js; upgrade packages
1 parent cc382a4 commit f9d7bb2

40 files changed

+791
-6747
lines changed

.eslintrc.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/nodejs.yml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,21 @@ on:
1515
- '!**README*'
1616

1717
jobs:
18-
nodejs:
18+
bun:
1919
runs-on: ubuntu-latest
2020

21-
strategy:
22-
matrix:
23-
node-version: [20, 18]
24-
2521
steps:
2622
- uses: actions/checkout@v3
2723

28-
- name: Use Node.js ${{ matrix.node-version }}
29-
uses: actions/setup-node@v3
24+
- name: Setup Bun
25+
uses: oven-sh/setup-bun@v1
3026
with:
31-
cache: 'npm'
32-
node-version: ${{ matrix.node-version }}
27+
bun-version: 1.3.0
3328

34-
- name: NPM install
35-
run: npm install --prefer-offline --no-audit
36-
env:
37-
CI: true
29+
- name: Install dependencies
30+
run: bun install --frozen-lockfile
3831

3932
- name: Build & Test
40-
# Runs lint, build & tests
41-
run: npm run ci
33+
run: bun run ci
4234
env:
4335
CI: true

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33

44
# IDE
55
.idea
6-
*.lock
76

87
coverage
9-
.eslintcache
108
.phpunit.cache
119
.turbo
1210

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
npx lint-staged
4+
bunx lint-staged

.prettierrc.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

AGENTS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Agent Instructions
2+
3+
## Commands
4+
5+
- Build: `bun run build` (builds all packages via turbo)
6+
- Lint: `bun run lint` (runs biome check)
7+
- Lint fix: `bun run lint:fix` (runs biome check --write)
8+
- Format: `bun run format` (runs biome format --write)
9+
- Test: `bun run test` (runs all tests)
10+
- Single test: `cd packages/test-node && bun test <test-file.test.ts>` (Bun test runner)
11+
- CI: `bun run ci` (lint + build + test)
12+
13+
## Code Style
14+
15+
- Use Biome for linting and formatting: 100 char width, single quotes, no semicolons, 2 spaces, trailing commas (ES5)
16+
- TypeScript: Avoid `any` (warn level), use explicit types for exports
17+
- Imports: Use `.ts` extensions in import paths (e.g., `from './types.ts'`)
18+
- Naming: camelCase for functions/variables, PascalCase for types/interfaces (prefix `I` for interfaces, `T` for type aliases)
19+
- Error handling: TypeScript strict mode, no explicit any unless necessary
20+
- Exports: Named exports only (no default exports)
21+
- Files: One primary export per file matching filename (e.g., `getCountryData.ts` exports `getCountryData`)
22+
- Format: Run `bun run format` before committing (enforced by husky pre-commit hook)
23+
- Do not write any documentation unless it was asked for
24+
- Do not write unnecessary comments in code, unless: code is not obvious, URLs should be linked to the issue, docs etc

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Everything is strongly typed so you can easily use data with auto-complete in yo
2424

2525
Package is available via:
2626

27+
- **Bun** `bun add countries-list`
2728
- **NPM** `npm install countries-list`
2829
- **Composer / Packagist** `composer require annexare/countries-list`
2930

@@ -113,7 +114,7 @@ Everything is generated from strongly typed files in `packages/countries/src`, i
113114

114115
Everything in `dist` is generated,
115116
so please make data related changes **ONLY** to files from `packages/countries`, commit them.
116-
Use `npm run build` (or `turbo build`, `turbo test`) command to build/test generated files.
117+
Use `bun run build` (or `turbo build`, `turbo test`) command to build/test generated files.
117118

118119
## Credits
119120

biome.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.2.6/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": true,
10+
"experimentalScannerIgnores": ["**/dist", "**/node_modules", "!**/*.min.*"],
11+
"includes": [
12+
"**",
13+
"!**/dist",
14+
"!**/node_modules",
15+
"!**/*.min.*",
16+
"!**/*.config.ts",
17+
"!**/*.d.ts",
18+
"!**/version.ts"
19+
]
20+
},
21+
"formatter": {
22+
"enabled": true,
23+
"indentStyle": "space",
24+
"indentWidth": 2,
25+
"lineWidth": 100,
26+
"lineEnding": "lf"
27+
},
28+
"javascript": {
29+
"formatter": {
30+
"quoteStyle": "single",
31+
"trailingCommas": "es5",
32+
"semicolons": "asNeeded",
33+
"arrowParentheses": "always"
34+
}
35+
},
36+
"linter": {
37+
"enabled": true,
38+
"rules": {
39+
"recommended": true,
40+
"suspicious": {
41+
"noExplicitAny": "warn"
42+
}
43+
}
44+
}
45+
}

0 commit comments

Comments
 (0)