外观
package.json
在项目根目录存在一份 package.json 文件,所有前后端项目都共用一份 package.json 文件来统一进行依赖管理。
package.json 文件完整内容
json
{
"name": "tech",
"version": "0.0.2",
"private": true,
"type": "module",
"main": "src/bin/www.mts",
"imports": {
"#websockets/*": "./src/websockets/*.mts",
"#middlewares/*": "./src/middlewares/*.mts",
"#routes/*": "./src/routes/*.mts",
"#utils/*": "./src/utils/*.mts",
"#models/*": "./src/models/*.mts",
"#controllers/*": "./src/controllers/*.mts",
"#services/*": "./src/services/*.mts",
"#src/*": "./src/*.mts",
"#scripts/*": "./scripts/*.mts",
"#hosts/*": "./hosts/*.mts",
"#schedules/*": "./schedules/*.mts",
"#consumers/*": "./consumers/*.mts",
"#root/*": "./*.mts"
},
"scripts": {
"database:job": "cross-env NODE_ENV=production MODE=int DEBUG=1 node ./database/init-article-categories.mts",
"schedule:job": "cross-env NODE_ENV=production MODE=int DEBUG=1 node ./schedules/article-crawler.mts",
"ready": "npm i",
"postinstall": "patch-package",
"check:vulnerability": "npx snyk test",
"clean:files": "node ./scripts/clean-built-files.mts",
"dev": "cross-env NODE_ENV=development MODE=production node ./scripts/dev.mts",
"dev:ssg": "cross-env TASKS=ssg:systems node --run dev",
"build": "cross-env NODE_ENV=production MODE=production node ./scripts/build.mts",
"deploy": "cross-env NODE_ENV=production MODE=production node ./scripts/deploy.mts",
"logs": "cross-env NODE_ENV=production MODE=production node ./scripts/watch-server-logs.mts",
"buildAndDeploy": "node --run build && node --run deploy",
"buildAndDeploy:static": "node --run lint && cross-env TASKS=public:static node --run deploy",
"buildAndDeploy:spa": "node --run lint && cross-env TASKS=spa:* node --run buildAndDeploy",
"buildAndDeploy:ssg": "node --run lint && cross-env TASKS=ssg:systems node --run buildAndDeploy",
"buildAndDeploy:server": "node --run lint && cross-env TASKS=public:build node --run build && cross-env TASKS=server:* node --run deploy",
"lint": "node ./scripts/lint.mts",
"ssl": "cross-env MODE=production NODE_ENV=production node ./scripts/job-ssl-cert-renewal.mts",
"deploy:nginx:shanghai:ali": "cross-env NODE_ENV=production MODE=production node hosts/Shanghai/nginx/scripts/deploy.mts",
"deploy:rabbitmq:shanghai:ali": "cross-env NODE_ENV=production MODE=production node hosts/Shanghai/rabbitmq/scripts/deploy.mts",
"deploy:docker:shanghai:ali": "cross-env NODE_ENV=production MODE=production node hosts/Shanghai/docker/scripts/deploy.mts",
"deploy:nginx:silicon-valley": "cross-env NODE_ENV=production MODE=production node hosts/SiliconValley/nginx/scripts/deploy.mts"
},
"dependencies": {
"@alicloud/dysmsapi20170525": "3.1.2",
"@alicloud/openapi-client": "0.4.13",
"@alicloud/tea-util": "1.4.10",
"@coze/api": "1.3.5",
"@element-plus/icons-vue": "2.3.2",
"@monaco-editor/loader": "1.7.0",
"@vueuse/core": "13.5.0",
"@wangeditor/editor": "5.1.23",
"@wangeditor/editor-for-vue": "5.1.12",
"acme-client": "5.4.0",
"adm-zip": "0.5.16",
"aedes": "0.51.3",
"amqplib": "0.10.9",
"archiver": "7.0.1",
"async": "3.2.6",
"axios": "1.7.9",
"bcryptjs": "3.0.2",
"better-monitor": "0.1.10",
"bignumber.js": "9.3.1",
"body-parser": "1.20.3",
"body-parser-xml": "2.0.5",
"bufferutil": "4.1.0",
"cheerio": "1.1.2",
"clipboard": "2.0.11",
"co-body": "6.2.0",
"codemirror": "6.0.2",
"compression": "1.7.5",
"connect-session-knex": "5.0.0",
"cookie-parser": "1.4.7",
"cors": "2.8.5",
"countup.js": "2.9.0",
"crypto-js": "4.2.0",
"dayjs": "1.11.13",
"domhandler": "5.0.3",
"dotenv": "16.4.7",
"echarts": "5.6.0",
"echarts-wordcloud": "2.1.0",
"ejs": "3.1.10",
"element-plus": "2.10.4",
"express": "4.21.2",
"express-rate-limit": "7.5.0",
"express-session": "1.18.1",
"fabric": "6.7.1",
"fast-xml-parser": "5.5.9",
"fs-extra": "11.3.0",
"helmet": "8.1.0",
"html-minifier-terser": "7.2.0",
"http-proxy-middleware": "3.0.3",
"https-proxy-agent": "7.0.6",
"image-size": "2.0.2",
"jsonwebtoken": "9.0.2",
"knex": "3.1.0",
"lunar-javascript": "1.7.7",
"markdown-it-mathjax3": "4.3.2",
"md-editor-v3": "6.3.1",
"md5": "2.3.0",
"mime": "4.0.6",
"monaco-editor": "0.55.1",
"multer": "2.0.2",
"mysql2": "3.12.0",
"node-fetch": "3.3.2",
"node-schedule": "2.1.1",
"nodemailer": "6.10.0",
"nprogress": "0.2.0",
"nsuite": "0.2.7",
"object-inspect": "1.13.4",
"openai": "5.11.0",
"patch-package": "8.0.1",
"path-browserify": "1.0.1",
"path-to-regexp": "8.2.0",
"pdf-lib": "1.17.1",
"pdf-parse": "2.4.5",
"pinia": "3.0.4",
"pinia-plugin-persistedstate": "4.3.0",
"pinyin-pro": "3.28.0",
"qiniu": "7.14.0",
"qiniu-js": "3.4.3",
"qrcode": "1.5.4",
"qs": "6.14.0",
"semver": "7.7.3",
"serve-favicon": "2.5.0",
"sharp": "0.34.5",
"striptags": "3.2.0",
"three": "0.160.0",
"tls": "0.0.1",
"uuid": "11.1.0",
"vue": "3.5.35",
"vue-cropper": "1.1.4",
"vue-echarts": "7.0.3",
"vue-i18n": "11.1.9",
"vue-router": "4.6.4",
"vuedraggable": "4.1.0",
"winston": "3.17.0",
"winston-daily-rotate-file": "5.0.0",
"ws": "8.19.0",
"xlsx": "0.18.5",
"xss": "1.0.15",
"zod": "3.25.76"
},
"devDependencies": {
"@babel/core": "7.26.7",
"@babel/preset-env": "7.26.7",
"@rollup/plugin-terser": "0.4.4",
"@tsconfig/node20": "20.1.6",
"@types/acme-client": "3.0.0",
"@types/adm-zip": "0.5.8",
"@types/ali-oss": "6.16.11",
"@types/amqplib": "0.10.8",
"@types/archiver": "7.0.0",
"@types/babel__core": "7.20.5",
"@types/bignumber.js": "4.0.3",
"@types/body-parser-xml": "2.0.5",
"@types/browser-sync": "2.29.0",
"@types/co-body": "6.1.3",
"@types/compression": "1.8.1",
"@types/cookie-parser": "1.4.9",
"@types/crypto-js": "4.2.2",
"@types/ejs": "3.1.5",
"@types/express": "4.17.23",
"@types/express-session": "1.18.2",
"@types/fs-extra": "11.0.4",
"@types/gulp": "4.0.17",
"@types/html-minifier-terser": "7.0.2",
"@types/jquery": "3.5.16",
"@types/jsdom": "21.1.7",
"@types/jsonwebtoken": "9.0.10",
"@types/md5": "2.3.5",
"@types/multer": "2.0.0",
"@types/node": "22.18.13",
"@types/node-schedule": "2.1.8",
"@types/nodemailer": "6.4.17",
"@types/nprogress": "0.2.3",
"@types/object-inspect": "1.13.0",
"@types/qrcode": "1.5.6",
"@types/semver": "7.7.1",
"@types/serve-favicon": "2.5.7",
"@types/ssh2": "1.15.5",
"@types/striptags": "0.0.5",
"@types/three": "0.160.0",
"@types/uuid": "10.0.0",
"@types/ws": "8.18.1",
"@vitejs/plugin-vue": "5.2.4",
"@vitejs/plugin-vue-jsx": "4.2.0",
"@vue/tsconfig": "0.7.0",
"browser-sync": "3.0.3",
"cli-table3": "0.6.5",
"concurrently": "9.1.2",
"cross-env": "7.0.3",
"glob": "11.0.1",
"globals": "15.14.0",
"npm-run-all": "4.1.5",
"nuxt": "4.3.1",
"open": "10.2.0",
"oxfmt": "0.59.0",
"oxlint": "1.74.0",
"oxlint-tsgolint": "0.25.0",
"pg": "8.16.1",
"pm2": "6.0.13",
"prettier": "3.4.2",
"prettier-plugin-ejs": "1.0.3",
"sass": "1.83.4",
"turndown": "7.2.4",
"typescript": "5.8.3",
"vite": "6.4.3",
"vitepress": "2.0.0-alpha.9",
"vitepress2-plugin-mermaid": "1.0.2",
"vue-tsc": "2.2.10",
"xml2js": "0.6.2"
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
路径别名
在 package.json 文件里,我们通过 imports 字段定义了 # 开头路径别名,以避免在项目里引用文件时书写大量的相对路径。
在该框架里几乎所有可以写 Node.js 代码的地方,都可以使用这套路径别名,比如前端编译部署脚本、服务端代码、定时任务脚本等。但是有一个例外,在前端代码里不能使用这套路径别名,前端代码里有一套自己的路径别名。