Skip to content

Commit

Permalink
feat: 使用fastify
Browse files Browse the repository at this point in the history
  • Loading branch information
XasYer committed Oct 11, 2024
1 parent e23a93c commit 30d0d9b
Show file tree
Hide file tree
Showing 17 changed files with 1,253 additions and 1,495 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"space-infix-ops": "error",
"@stylistic/ts/type-annotation-spacing": "error",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"comma-spacing": ["error", { "before": false, "after": true }]
}
}
4 changes: 4 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# TODO List

- [ ] file: `src/api/database/sqlite/index.ts` api: `/set-sqlite-table-data` add types
- [ ] file: `src/api/login/index.ts` api: `/get-async-routes` add types
2 changes: 0 additions & 2 deletions config/default_config/server.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# 端口
# 若是TRSS则会使用TRSS的端口 http://ip:TRSSProt/YePanel
# 否则就是 http://ip:port
port: 2877

# 密码
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,27 @@
"clean": "rm -rf dist"
},
"dependencies": {
"@fastify/auth": "^5.0.1",
"@fastify/cors": "^10.0.1",
"@fastify/multipart": "^9.0.1",
"@fastify/websocket": "^11.0.1",
"chokidar": "^4.0.1",
"express": "^4.21.0",
"fastify": "^5.0.0",
"iconv-lite": "^0.6.3",
"lodash": "^4.17.21",
"moment": "^2.30.1",
"multer": "1.4.5-lts.1",
"systeminformation": "^5.23.5",
"yaml": "^2.5.1"
},
"devDependencies": {
"@stylistic/eslint-plugin-ts": "^2.8.0",
"@types/express": "^5.0.0",
"@types/lodash": "^4.17.9",
"@types/multer": "^1.4.12",
"@types/node": "^20.11.19",
"@types/ws": "^8.5.10",
"@typescript-eslint/eslint-plugin": "^8.8.0",
"@typescript-eslint/parser": "^8.8.0",
"eslint": "^8.57.0",
"fastify-tsconfig": "^2.0.0",
"tsc-alias": "^1.8.8",
"tsx": "^4.19.1",
"typescript": "^5.6.2"
Expand Down
12 changes: 6 additions & 6 deletions path.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ function replacePaths (dir) {
replacePaths(filePath)
} else if (filePath.endsWith('.js')) {
let content = readFileSync(filePath, 'utf-8')
content = content.replace(/from ['"]((\.?\.\/)+.+?)['"]/g, (match, p1) => {
if (!p1.endsWith('.js')) {
if (existsSync(join(dir, p1, 'index.js'))) {
return `from '${p1}/index.js'`
content = content.replace(/(from|import) ['"]((\.?\.\/)+.+?)['"]/g, (match, target, name) => {
if (!name.endsWith('.js')) {
if (existsSync(join(dir, name, 'index.js'))) {
return `${target} '${name}/index.js'`
} else {
return `from '${p1}.js'`
return `${target} '${name}.js'`
}
}
return `from '${p1}'`
return `${target} '${name}'`
})
writeFileSync(filePath, content, 'utf-8')
}
Expand Down
Loading

0 comments on commit 30d0d9b

Please sign in to comment.