Skip to content

Commit 87eb9ea

Browse files
committed
perf: memory usage optimize
Signed-off-by: BobDu <[email protected]>
1 parent f4c3d0c commit 87eb9ea

File tree

11 files changed

+1203
-1450
lines changed

11 files changed

+1203
-1450
lines changed

.eslintrc.cjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
module.exports = {
22
root: true,
33
extends: ['@antfu'],
4+
rules: {
5+
'antfu/top-level-function': 'off',
6+
'@typescript-eslint/consistent-type-imports': 'off',
7+
'@stylistic/ts/member-delimiter-style': 'off',
8+
'@stylistic/ts/indent': 'off',
9+
'@stylistic/js/no-tabs': 'off',
10+
'vue/no-unused-refs': 'off',
11+
'import/newline-after-import': 'off',
12+
'unicorn/prefer-number-properties': 'off',
13+
},
14+
ignorePatterns: [
15+
'vite.config.ts',
16+
'tsconfig.json',
17+
],
418
}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ COPY --from=backend /app/src/utils/templates /app/build/templates
5959

6060
EXPOSE 3002
6161

62-
CMD ["sh", "-c", "./replace-title.sh && pnpm run prod"]
62+
CMD ["sh", "-c", "./replace-title.sh && node --import tsx/esm ./build/index.js"]

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"vue-router": "^4.1.6"
4242
},
4343
"devDependencies": {
44-
"@antfu/eslint-config": "^0.35.3",
44+
"@antfu/eslint-config": "^0.43.1",
4545
"@commitlint/cli": "^17.4.4",
4646
"@commitlint/config-conventional": "^17.4.4",
4747
"@iconify/vue": "^4.1.0",
@@ -55,7 +55,7 @@
5555
"autoprefixer": "^10.4.13",
5656
"axios": "^1.3.4",
5757
"crypto-js": "^4.1.1",
58-
"eslint": "^8.35.0",
58+
"eslint": "^8.56.0",
5959
"husky": "^8.0.3",
6060
"less": "^4.1.3",
6161
"lint-staged": "^13.1.2",

pnpm-lock.yaml

Lines changed: 535 additions & 320 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

service/.eslintrc.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
{
22
"root": true,
3-
"ignorePatterns": ["build"],
4-
"extends": ["@antfu"]
3+
"ignorePatterns": ["build", "tsconfig.json"],
4+
"extends": ["@antfu"],
5+
"rules": {
6+
"antfu/top-level-function": "off",
7+
"n/prefer-global/process": "off",
8+
"no-restricted-globals": "off",
9+
"unicorn/prefer-node-protocol": "off",
10+
"unicorn/prefer-number-properties": "off"
11+
}
512
}

service/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ coverage
2929
*.sw?
3030

3131
build
32+
public

service/package.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "chatgpt-web-service",
3+
"type": "module",
34
"version": "1.0.0",
45
"private": false,
56
"description": "ChatGPT Web Service",
@@ -14,10 +15,11 @@
1415
"node": "^16 || ^18 || ^20 || ^21"
1516
},
1617
"scripts": {
17-
"start": "esno ./src/index.ts",
18-
"dev": "esno watch ./src/index.ts",
19-
"prod": "esno ./build/index.js",
20-
"build": "pnpm clean && tsup",
18+
"start": "tsx ./src/index.ts",
19+
"dev": "tsx watch ./src/index.ts",
20+
"prod": "node --import tsx/esm ./build/index.js",
21+
"prod-node18": "node --loader tsx/esm ./build/index.js",
22+
"build": "pnpm clean && tsc",
2123
"clean": "rimraf build",
2224
"lint": "eslint .",
2325
"lint:fix": "eslint . --fix",
@@ -28,28 +30,27 @@
2830
"chatgpt": "^5.2.4",
2931
"dayjs": "^1.11.7",
3032
"dotenv": "^16.0.3",
31-
"esno": "^0.16.3",
3233
"express": "^4.18.2",
3334
"express-rate-limit": "^6.7.0",
3435
"gpt-token": "^0.0.5",
3536
"https-proxy-agent": "^5.0.1",
3637
"isomorphic-fetch": "^3.0.0",
3738
"jwt-decode": "^3.1.2",
39+
"jsonwebtoken": "^9.0.0",
3840
"mongodb": "^5.9.2",
3941
"node-fetch": "^3.3.0",
4042
"nodemailer": "^6.9.1",
4143
"request-ip": "^3.3.0",
42-
"socks-proxy-agent": "^7.0.0"
44+
"socks-proxy-agent": "^7.0.0",
45+
"speakeasy": "^2.0.0",
46+
"tsx": "^4.7.0"
4347
},
4448
"devDependencies": {
45-
"@antfu/eslint-config": "^0.35.3",
49+
"@antfu/eslint-config": "^0.43.1",
4650
"@types/express": "^4.17.17",
4751
"@types/node": "^18.14.6",
48-
"eslint": "^8.35.0",
49-
"jsonwebtoken": "^9.0.0",
52+
"eslint": "^8.56.0",
5053
"rimraf": "^4.3.0",
51-
"speakeasy": "^2.0.0",
52-
"tsup": "^6.6.3",
53-
"typescript": "^4.9.5"
54+
"typescript": "^5.3.3"
5455
}
5556
}

0 commit comments

Comments
 (0)