Skip to content

Commit a2a4768

Browse files
committed
feat: move to bun and tsc, drop ms as dep
1 parent d01b18d commit a2a4768

File tree

15 files changed

+166
-2716
lines changed

15 files changed

+166
-2716
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
{
2+
"root": true,
3+
"extends": ["prettier", "plugin:prettier/recommended", "plugin:@typescript-eslint/recommended"],
4+
"plugins": ["@typescript-eslint", "prettier"],
25
"parser": "@typescript-eslint/parser",
3-
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
4-
"plugins": ["@typescript-eslint"],
56
"parserOptions": {
6-
"ecmaVersion": 2020,
7-
"sourceType": "module"
8-
},
9-
"env": {
10-
"node": true,
11-
"es6": true
7+
"project": "./tsconfig.eslint.json"
128
},
9+
"ignorePatterns": ["dist/", "node_modules/"],
10+
"overrides": [
11+
{
12+
"files": ["src/**/*.ts", "tests/**/*.ts"]
13+
}
14+
],
1315
"rules": {
14-
"@typescript-eslint/explicit-function-return-type": "off",
15-
"@typescript-eslint/no-explicit-any": "off",
16-
"@typescript-eslint/no-unused-vars": "off",
1716
"@typescript-eslint/explicit-module-boundary-types": "off",
18-
"@typescript-eslint/ban-ts-comment": "off",
19-
"no-unused-vars": "off",
20-
"no-console": "off",
21-
"no-undef": "off"
17+
"@typescript-eslint/no-explicit-any": "off"
2218
}
2319
}

.github/workflows/ci.yml

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,27 @@
1-
# This is a basic workflow to help you get started with Actions
1+
on: [push]
22

3-
name: CI
4-
5-
# Controls when the action will run. Triggers the workflow on push or pull request
6-
# events but only for the master branch
7-
on:
8-
push:
9-
branches: [master]
10-
pull_request:
11-
branches: [master]
12-
13-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
143
jobs:
15-
# This workflow contains a single job called "test"
164
test:
17-
# The type of runner that the job will run on
185
runs-on: ubuntu-latest
19-
20-
# Steps represent a sequence of tasks that will be executed as part of the job
216
steps:
22-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
23-
- uses: actions/checkout@v2
24-
- uses: actions/setup-node@v2-beta
25-
with:
26-
node-version: '14.16.1'
27-
- name: install pnpm
28-
uses: pnpm/[email protected]
7+
- uses: actions/checkout@v3
8+
- uses: oven-sh/setup-bun@v1
299
with:
30-
version: 6.2.5
31-
- run: pnpm install
32-
- run: pnpm test:coverage
33-
- run: pnpm test:report
10+
bun-version: latest
11+
- run: bun install
12+
- run: bun test:coverage
13+
- run: bun test:report
3414
- name: Coveralls
3515
uses: coverallsapp/github-action@master
3616
with:
3717
github-token: ${{ secrets.GITHUB_TOKEN }}
38-
path-to-lcov: ./coverage.lcov
18+
path-to-lcov: ./lcov.info
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
- uses: oven-sh/setup-bun@v1
24+
with:
25+
bun-version: latest
26+
- run: bun install
27+
- run: bun run build

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
dist
3-
coverage
3+
coverage
4+
lcov.info

.husky/_/husky.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
#!/bin/sh
1+
#!/usr/bin/env sh
22
if [ -z "$husky_skip_init" ]; then
33
debug () {
4-
[ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1"
4+
if [ "$HUSKY_DEBUG" = "1" ]; then
5+
echo "husky (debug) - $1"
6+
fi
57
}
68

7-
readonly hook_name="$(basename "$0")"
9+
readonly hook_name="$(basename -- "$0")"
810
debug "starting $hook_name..."
911

1012
if [ "$HUSKY" = "0" ]; then
@@ -17,13 +19,18 @@ if [ -z "$husky_skip_init" ]; then
1719
. ~/.huskyrc
1820
fi
1921

20-
export readonly husky_skip_init=1
22+
readonly husky_skip_init=1
23+
export husky_skip_init
2124
sh -e "$0" "$@"
2225
exitCode="$?"
2326

2427
if [ $exitCode != 0 ]; then
2528
echo "husky - $hook_name hook exited with code $exitCode (error)"
2629
fi
2730

31+
if [ $exitCode = 127 ]; then
32+
echo "husky - command not found in PATH=$PATH"
33+
fi
34+
2835
exit $exitCode
2936
fi

.prettierignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ Sets `Cache-Control: maxAge=` header, optional. Default is one year. Passed with
3838

3939
```js
4040
import { favicon } from '@tinyhttp/favicon'
41-
import { createServer } from 'http'
42-
import path from 'path'
41+
import { createServer } from 'node:http'
42+
import path from 'node:path'
4343

4444
createServer(favicon(path.join(process.cwd(), 'public', 'favicon.ico')).listen(3000)
4545
```

bun.lockb

163 KB
Binary file not shown.

package.json

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"url": "https://github.com/tinyhttp/favicon.git"
1010
},
1111
"engines": {
12-
"node": ">=12.4 || 14.x || >=16"
12+
"node": ">=12.20 || >=14.18 || >=16"
1313
},
1414
"types": "./dist/index.d.ts",
1515
"exports": "./dist/index.js",
@@ -30,39 +30,34 @@
3030
"dependencies": {
3131
"@tinyhttp/etag": "^2.0.1",
3232
"@tinyhttp/url": "^2.0.2",
33-
"es-fresh": "^0.0.10",
34-
"ms": "^3.0.0-canary.1"
33+
"es-fresh": "^0.0.10"
3534
},
3635
"scripts": {
37-
"build": "rollup -c",
38-
"test": "node --experimental-loader esbuild-node-loader node_modules/uvu/bin.js tests",
39-
"test:coverage": "c8 --include=src pnpm test",
40-
"test:report": "c8 report --reporter=text-lcov > coverage.lcov",
36+
"build": "tsc",
37+
"test": "tsx tests/index.test.ts",
38+
"test:coverage": "c8 tsx --test tests/index.test.ts",
39+
"test:report": "c8 report --reporter=text-lcov > lcov.info",
4140
"lint": "eslint . --ext=ts",
4241
"format": "prettier --check \"./**/*.{ts,md}\"",
4342
"format:fix": "prettier --write \"./**/*.{ts,md}\"",
4443
"prepare": "husky install"
4544
},
4645
"devDependencies": {
47-
"@commitlint/cli": "13.1.0",
48-
"@commitlint/config-conventional": "13.1.0",
49-
"@rollup/plugin-typescript": "^8.2.5",
50-
"@tinyhttp/app": "2.0.4",
51-
"@types/ms": "^0.7.31",
52-
"@types/node": "^16.9.2",
53-
"@typescript-eslint/eslint-plugin": "^4.31.1",
54-
"@typescript-eslint/parser": "^4.31.1",
55-
"c8": "^7.9.0",
56-
"esbuild-node-loader": "^0.3.1",
57-
"eslint": "^7.32.0",
58-
"eslint-config-prettier": "^8.3.0",
59-
"eslint-plugin-prettier": "^4.0.0",
60-
"expect": "^27.2.0",
61-
"husky": "^7.0.2",
62-
"prettier": "^2.4.1",
63-
"rollup": "^2.56.3",
64-
"supertest-fetch": "^1.4.3",
65-
"typescript": "^4.4.3",
66-
"uvu": "^0.5.1"
46+
"@commitlint/cli": "^18.2.0",
47+
"@commitlint/config-conventional": "^18.1.0",
48+
"@types/node": "^20.8.9",
49+
"@typescript-eslint/eslint-plugin": "^6.9.0",
50+
"@typescript-eslint/parser": "^6.9.0",
51+
"bun-types": "^1.0.7",
52+
"c8": "^8.0.1",
53+
"eslint": "^8.52.0",
54+
"eslint-config-prettier": "^9.0.0",
55+
"eslint-plugin-prettier": "^5.0.1",
56+
"expect": "^29.7.0",
57+
"husky": "^8.0.3",
58+
"prettier": "^3.0.3",
59+
"supertest-fetch": "^1.5.0",
60+
"tsx": "^3.14.0",
61+
"typescript": "^5.2.2"
6762
}
6863
}

0 commit comments

Comments
 (0)