Skip to content

Commit 6fad3f9

Browse files
committed
feat: migrate project to TypeScript
🤖 Generated with [OpenCode](https://opencode.ai) (Smart-router)
1 parent f044975 commit 6fad3f9

17 files changed

Lines changed: 731 additions & 289 deletions

‎.github/workflows/release.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ jobs:
4949
name=$(node -p "require('./package.json').name")
5050
version=$(node -p "require('./package.json').version")
5151
pnpm add --global pkg
52-
pkg --out-path build .
52+
pnpm build
53+
pkg --out-path build dist/index.js
54+
5355
gh release create "v$version" \
5456
--title "Release v$version" \
5557
--notes "Release v$version" \

‎.gitignore‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# MacOS
22
.DS_STORE
33

4-
# Node, npm & CI
4+
# Node
55
node_modules
6-
coverage
7-
.nyc_output
6+
build
7+
dist
8+
*.tsbuildinfo
89

9-
# Build
10-
build
10+
# Test-generated certificate directories
11+
test/custom-folder/
12+
test/custom\ folder/

‎.oxfmtrc.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"$schema": "./node_modules/oxfmt/configuration_schema.json",
33
"semi": false,
44
"arrowParens": "avoid",
5-
"singleQuote": false
5+
"singleQuote": false,
6+
"sortImports": true
67
}

‎index.js‎

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

‎oxlint.json‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"rules": {
4+
"eslint/no-unused-vars": [
5+
"error",
6+
{
7+
"args": "none",
8+
"caughtErrors": "none",
9+
"fix": {
10+
"imports": "fix"
11+
}
12+
}
13+
]
14+
},
15+
"plugins": ["eslint"]
16+
}

‎package.json‎

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,52 @@
2020
"url": "git+https://github.com/daquinoaldo/https-localhost.git"
2121
},
2222
"bin": {
23-
"serve": "index.js"
23+
"serve": "src/cli.ts"
24+
},
25+
"files": [
26+
"dist"
27+
],
28+
"type": "module",
29+
"main": "src/index.ts",
30+
"types": "src/index.ts",
31+
"exports": {
32+
".": {
33+
"types": "./src/index.ts",
34+
"import": "./src/index.ts",
35+
"default": "./src/index.ts"
36+
},
37+
"./certs": {
38+
"types": "./src/certs.ts",
39+
"import": "./src/certs.ts",
40+
"default": "./src/certs.ts"
41+
}
42+
},
43+
"publishConfig": {
44+
"main": "dist/cjs/index.js",
45+
"module": "dist/esm/index.js",
46+
"types": "dist/esm/index.d.ts",
47+
"exports": {
48+
".": {
49+
"types": "./dist/esm/index.d.ts",
50+
"import": "./dist/esm/index.js",
51+
"require": "./dist/cjs/index.js",
52+
"default": "./dist/esm/index.js"
53+
},
54+
"./certs": {
55+
"types": "./dist/esm/certs.d.ts",
56+
"import": "./dist/esm/certs.js",
57+
"require": "./dist/cjs/certs.js",
58+
"default": "./dist/esm/certs.js"
59+
}
60+
}
2461
},
25-
"main": "index.js",
2662
"scripts": {
27-
"lint": "oxfmt && oxlint --fix",
28-
"test": "node --test",
29-
"preuninstall": "node certs.js -u",
30-
"start": "node index.js"
63+
"build": "rm -rf dist && tsc --project tsconfig.build.esm.json && tsc --project tsconfig.build.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
64+
"lint": "oxfmt && oxlint --fix && tsc --noEmit",
65+
"test": "node --test test/*.ts",
66+
"prepack": "pnpm build",
67+
"preuninstall": "node dist/esm/certs-cli.js -u",
68+
"start": "node src/cli.ts"
3169
},
3270
"dependencies": {
3371
"appdata-path": "^1.0.0",
@@ -37,8 +75,14 @@
3775
"uglify-js": "^3.19.3"
3876
},
3977
"devDependencies": {
78+
"@types/compression": "^1.8.1",
79+
"@types/cors": "^2.8.19",
80+
"@types/express": "^5.0.6",
81+
"@types/node": "^26.4.1",
82+
"@types/uglify-js": "^3.17.5",
4083
"oxfmt": "^0.66.0",
41-
"oxlint": "^1.81.0"
84+
"oxlint": "^1.81.0",
85+
"typescript": "^7.0.2"
4286
},
4387
"devEngines": {
4488
"packageManager": {

0 commit comments

Comments
 (0)