nuxt-gin-tools 0.2.19 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +342 -95
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,101 +1,118 @@
|
|
|
1
|
-
# nuxt-gin-tools
|
|
1
|
+
# nuxt-gin-tools 🧰
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/nuxt-gin-tools)
|
|
4
|
+
[](https://www.npmjs.com/package/nuxt-gin-tools)
|
|
5
|
+
[](https://nodejs.org)
|
|
6
|
+
[](https://nuxt.com)
|
|
7
|
+
[](https://go.dev)
|
|
8
|
+
[](./LICENSE)
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
- 一条命令启动前后端开发环境
|
|
7
|
-
- 自动处理 Go 侧依赖和文件监听重启
|
|
8
|
-
- 提供 OpenAPI 代码生成与构建打包辅助
|
|
10
|
+
`nuxt-gin-tools` is the companion CLI for [`nuxt-gin-starter`](https://github.com/RapboyGao/nuxt-gin-starter.git), built to make **Nuxt + Gin** development feel like one coherent workflow instead of two separate toolchains.
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
Quick Jump:
|
|
11
13
|
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
- 启动 Go 文件监听(基于 `chokidar`)
|
|
15
|
-
- Go 文件变化后自动重启 `go run main.go`
|
|
16
|
-
- `nuxt-gin install`
|
|
17
|
-
- 执行 Nuxt prepare
|
|
18
|
-
- 如果检测到 Go,则执行 `go mod download && go mod tidy`
|
|
19
|
-
- `nuxt-gin gen`
|
|
20
|
-
- 基于 `openapi.yaml` 生成 Go / TS API 代码
|
|
21
|
-
- `nuxt-gin build`
|
|
22
|
-
- 执行项目构建与打包流程
|
|
23
|
-
- `nuxt-gin cleanup`
|
|
24
|
-
- 清理开发产物
|
|
25
|
-
- `nuxt-gin update`
|
|
26
|
-
- 执行依赖更新流程
|
|
14
|
+
- [English](#english)
|
|
15
|
+
- [中文](#中文)
|
|
27
16
|
|
|
28
|
-
##
|
|
17
|
+
## English
|
|
29
18
|
|
|
30
|
-
|
|
19
|
+
### ✨ Highlights
|
|
20
|
+
|
|
21
|
+
- 🚀 One command to run Nuxt dev + Go watcher together
|
|
22
|
+
- 🔁 Automatic Go restart on file changes with `chokidar`
|
|
23
|
+
- 📦 Build-and-pack workflow for deployment artifacts
|
|
24
|
+
- 🧩 `pack.config.ts` support with typed config helper
|
|
25
|
+
- 🛡️ Config validation with `warn` and `error` feedback
|
|
26
|
+
- 🔧 Useful CLI switches for partial workflows like `--skip-go`
|
|
27
|
+
|
|
28
|
+
### 📦 Install
|
|
31
29
|
|
|
32
30
|
```bash
|
|
33
|
-
pnpm add nuxt-gin-tools
|
|
31
|
+
pnpm add -D nuxt-gin-tools
|
|
34
32
|
```
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
### ⚡ Quick Start
|
|
37
35
|
|
|
38
36
|
```bash
|
|
39
|
-
#
|
|
37
|
+
# optional bootstrap
|
|
40
38
|
nuxt-gin install
|
|
41
39
|
|
|
42
|
-
#
|
|
40
|
+
# start Nuxt + Go together
|
|
43
41
|
nuxt-gin dev
|
|
44
42
|
```
|
|
45
43
|
|
|
46
|
-
|
|
44
|
+
Common variants:
|
|
47
45
|
|
|
48
46
|
```bash
|
|
49
|
-
#
|
|
47
|
+
# frontend only
|
|
50
48
|
nuxt-gin dev --skip-go
|
|
51
49
|
|
|
52
|
-
#
|
|
50
|
+
# go watcher only
|
|
53
51
|
nuxt-gin dev --skip-nuxt
|
|
54
52
|
|
|
55
|
-
#
|
|
53
|
+
# skip cleanup / bootstrap checks
|
|
56
54
|
nuxt-gin dev --no-cleanup
|
|
57
55
|
```
|
|
58
56
|
|
|
59
|
-
|
|
57
|
+
### 🗂️ Commands
|
|
60
58
|
|
|
61
|
-
|
|
59
|
+
#### `nuxt-gin dev`
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
- Nuxt:`npx nuxt dev --port=<nuxtPort> --host`
|
|
65
|
-
- Go:监听变更并运行 `go run main.go`
|
|
61
|
+
Runs the local development stack:
|
|
66
62
|
|
|
67
|
-
|
|
63
|
+
- Nuxt: `npx nuxt dev --port=<nuxtPort> --host`
|
|
64
|
+
- Go: watches files and restarts `go run main.go`
|
|
68
65
|
|
|
69
|
-
|
|
66
|
+
Flags:
|
|
70
67
|
|
|
71
|
-
- `--skip-go
|
|
72
|
-
- `--skip-nuxt
|
|
73
|
-
- `--no-cleanup
|
|
68
|
+
- `--skip-go`: start Nuxt only
|
|
69
|
+
- `--skip-nuxt`: start Go only
|
|
70
|
+
- `--no-cleanup`: skip pre-cleanup and bootstrap checks
|
|
74
71
|
|
|
75
|
-
|
|
72
|
+
#### `nuxt-gin install`
|
|
76
73
|
|
|
77
|
-
|
|
78
|
-
- 检测到 Go 时额外执行:`go mod download && go mod tidy`
|
|
74
|
+
Bootstraps the project:
|
|
79
75
|
|
|
80
|
-
|
|
76
|
+
- always runs `npx nuxt prepare`
|
|
77
|
+
- if Go is available, also runs `go mod download && go mod tidy`
|
|
81
78
|
|
|
82
|
-
|
|
83
|
-
- 生成 Go Gin server 相关代码
|
|
84
|
-
- 生成 TypeScript axios 客户端代码
|
|
79
|
+
#### `nuxt-gin gen`
|
|
85
80
|
|
|
86
|
-
|
|
81
|
+
Generates API code from `openapi.yaml`:
|
|
87
82
|
|
|
88
|
-
|
|
83
|
+
- Go Gin server code
|
|
84
|
+
- TypeScript axios client code
|
|
89
85
|
|
|
90
|
-
|
|
86
|
+
#### `nuxt-gin build`
|
|
91
87
|
|
|
92
|
-
|
|
93
|
-
- `--skip-nuxt`:跳过 Nuxt 静态构建
|
|
94
|
-
- `--binary-name <name>`:自定义 `.build/.server` 下的 Go 二进制名称
|
|
88
|
+
Runs the build-and-pack flow.
|
|
95
89
|
|
|
96
|
-
|
|
90
|
+
Flags:
|
|
97
91
|
|
|
98
|
-
|
|
92
|
+
- `--skip-go`: skip Go build
|
|
93
|
+
- `--skip-nuxt`: skip Nuxt static build
|
|
94
|
+
- `--binary-name <name>`: override the Go binary name under `.build/.server`
|
|
95
|
+
|
|
96
|
+
#### `nuxt-gin cleanup`
|
|
97
|
+
|
|
98
|
+
Removes generated temp files and build output.
|
|
99
|
+
|
|
100
|
+
#### `nuxt-gin update`
|
|
101
|
+
|
|
102
|
+
Updates project dependencies with a conservative default strategy:
|
|
103
|
+
|
|
104
|
+
- Node: `pnpm update`
|
|
105
|
+
- Go: `go get -u=patch ./... && go mod tidy`
|
|
106
|
+
|
|
107
|
+
Flags:
|
|
108
|
+
|
|
109
|
+
- `--latest`: switch to a more aggressive upgrade strategy
|
|
110
|
+
- `--skip-go`: skip Go dependency updates
|
|
111
|
+
- `--skip-node`: skip Node dependency updates
|
|
112
|
+
|
|
113
|
+
### 🧩 `pack.config.ts` / `pack.config.json`
|
|
114
|
+
|
|
115
|
+
`nuxt-gin build` can auto-load pack config from the project root with this priority:
|
|
99
116
|
|
|
100
117
|
1. `pack.config.ts`
|
|
101
118
|
2. `pack.config.js`
|
|
@@ -103,9 +120,9 @@ Go 监听规则来自 `.go-watch.json`(见下文)。
|
|
|
103
120
|
4. `pack.config.mjs`
|
|
104
121
|
5. `pack.config.json`
|
|
105
122
|
|
|
106
|
-
|
|
123
|
+
If multiple config files exist, the CLI prints a `warn` and uses the first one by priority.
|
|
107
124
|
|
|
108
|
-
|
|
125
|
+
Recommended TypeScript form:
|
|
109
126
|
|
|
110
127
|
```ts
|
|
111
128
|
import createPackConfig from 'nuxt-gin-tools/src/pack';
|
|
@@ -119,7 +136,7 @@ export default createPackConfig({
|
|
|
119
136
|
});
|
|
120
137
|
```
|
|
121
138
|
|
|
122
|
-
|
|
139
|
+
Legacy JSON is still supported:
|
|
123
140
|
|
|
124
141
|
```json
|
|
125
142
|
{
|
|
@@ -128,52 +145,282 @@ export default createPackConfig({
|
|
|
128
145
|
}
|
|
129
146
|
```
|
|
130
147
|
|
|
131
|
-
|
|
148
|
+
Validation behavior:
|
|
149
|
+
|
|
150
|
+
- ❌ obvious type problems produce an `error` and stop packing
|
|
151
|
+
- ⚠️ ambiguous but survivable cases produce a `warn`
|
|
152
|
+
- 📝 example: if both `zipPath` and `zipName` are present, `zipPath` wins and a warning is shown
|
|
153
|
+
|
|
154
|
+
### 🧱 `pack.config.ts` Helper
|
|
155
|
+
|
|
156
|
+
Use the helper from [`src/pack.ts`](./src/pack.ts):
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
import createPackConfig from 'nuxt-gin-tools/src/pack';
|
|
160
|
+
|
|
161
|
+
export default createPackConfig({
|
|
162
|
+
serverPath: '.build/production/server',
|
|
163
|
+
zipName: 'release.7z',
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
It provides:
|
|
168
|
+
|
|
169
|
+
- `PackConfig` type
|
|
170
|
+
- `createPackConfig(config)` helper
|
|
171
|
+
- default export as `createPackConfig`
|
|
172
|
+
|
|
173
|
+
### ⚙️ Runtime Config
|
|
174
|
+
|
|
175
|
+
#### `server.config.json`
|
|
176
|
+
|
|
177
|
+
`dev` reads this file for the main runtime wiring:
|
|
178
|
+
|
|
179
|
+
- `ginPort`: Gin server port
|
|
180
|
+
- `nuxtPort`: Nuxt dev port
|
|
181
|
+
- `baseUrl`: Nuxt base URL
|
|
182
|
+
- `killPortBeforeDevelop`: whether to free ports before dev, default `true`
|
|
183
|
+
- `cleanupBeforeDevelop`: whether to cleanup before dev, default `false`
|
|
184
|
+
|
|
185
|
+
#### Frontend Runtime Exposure
|
|
186
|
+
|
|
187
|
+
`createDefaultConfig` injects values into Nuxt `runtimeConfig.public`:
|
|
188
|
+
|
|
189
|
+
- `public.ginPort`: available in development, `null` in production
|
|
190
|
+
- `public.isDevelopment`: direct development flag
|
|
191
|
+
|
|
192
|
+
Example:
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
const config = useRuntimeConfig();
|
|
196
|
+
const ginPort = config.public.ginPort;
|
|
197
|
+
const isDevelopment = config.public.isDevelopment;
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
#### `.go-watch.json`
|
|
201
|
+
|
|
202
|
+
Go watcher rules come from `.go-watch.json`:
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"tmpDir": ".build/.server",
|
|
207
|
+
"testDataDir": "testdata",
|
|
208
|
+
"includeExt": ["go", "tpl", "html"],
|
|
209
|
+
"includeDir": [],
|
|
210
|
+
"includeFile": [],
|
|
211
|
+
"excludeDir": [
|
|
212
|
+
"assets",
|
|
213
|
+
".build/.server",
|
|
214
|
+
"vendor",
|
|
215
|
+
"testdata",
|
|
216
|
+
"node_modules",
|
|
217
|
+
"vue",
|
|
218
|
+
"api",
|
|
219
|
+
".vscode",
|
|
220
|
+
".git"
|
|
221
|
+
],
|
|
222
|
+
"excludeFile": [],
|
|
223
|
+
"excludeRegex": ["_test.go"]
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
You can also point to a custom watcher config:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
NUXT_GIN_WATCH_CONFIG=/path/to/.go-watch.json
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### 🖥️ Environment
|
|
234
|
+
|
|
235
|
+
- Node.js
|
|
236
|
+
- pnpm
|
|
237
|
+
- Go, if you need the Gin side to run
|
|
238
|
+
- `openapi-generator-cli`, only for `nuxt-gin gen`
|
|
239
|
+
|
|
240
|
+
### 📝 Notes
|
|
241
|
+
|
|
242
|
+
- 💨 Go hot reload no longer depends on Air
|
|
243
|
+
- 👀 The current watcher model is `chokidar` + restart `go run main.go`
|
|
244
|
+
- 🪟 Packaging uses platform-aware executable naming: Windows defaults to `.exe`, Linux/macOS defaults to no extension
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## 中文
|
|
249
|
+
|
|
250
|
+
### ✨ 功能亮点
|
|
251
|
+
|
|
252
|
+
- 🚀 一条命令同时启动 Nuxt 与 Go 开发环境
|
|
253
|
+
- 🔁 基于 `chokidar` 的 Go 文件监听与自动重启
|
|
254
|
+
- 📦 内置构建与打包流程,适合产物发布
|
|
255
|
+
- 🧩 支持 `pack.config.ts`,并提供类型化 helper
|
|
256
|
+
- 🛡️ 对打包配置做校验,区分 `warn` 和 `error`
|
|
257
|
+
- 🔧 支持 `--skip-go` 等局部开发参数
|
|
258
|
+
|
|
259
|
+
### 📦 安装
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
pnpm add -D nuxt-gin-tools
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### ⚡ 快速开始
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
# 可选:初始化依赖
|
|
269
|
+
nuxt-gin install
|
|
270
|
+
|
|
271
|
+
# 同时启动前后端开发环境
|
|
272
|
+
nuxt-gin dev
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
常见变体:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# 仅启动前端
|
|
279
|
+
nuxt-gin dev --skip-go
|
|
280
|
+
|
|
281
|
+
# 仅启动 Go 监听
|
|
282
|
+
nuxt-gin dev --skip-nuxt
|
|
283
|
+
|
|
284
|
+
# 跳过预清理 / 预安装检查
|
|
285
|
+
nuxt-gin dev --no-cleanup
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### 🗂️ 命令说明
|
|
132
289
|
|
|
133
|
-
-
|
|
134
|
-
- 可继续执行但可能有歧义的情况会输出 `warn`
|
|
135
|
-
- 例如 `zipPath` 与 `zipName` 同时出现时,会提示 `zipPath` 优先生效
|
|
290
|
+
#### `nuxt-gin dev`
|
|
136
291
|
|
|
137
|
-
|
|
292
|
+
启动本地开发环境:
|
|
138
293
|
|
|
139
|
-
|
|
294
|
+
- Nuxt:`npx nuxt dev --port=<nuxtPort> --host`
|
|
295
|
+
- Go:监听文件变化并重启 `go run main.go`
|
|
296
|
+
|
|
297
|
+
参数:
|
|
298
|
+
|
|
299
|
+
- `--skip-go`:只启动 Nuxt
|
|
300
|
+
- `--skip-nuxt`:只启动 Go
|
|
301
|
+
- `--no-cleanup`:跳过 develop 前的 cleanup / bootstrap 检查
|
|
302
|
+
|
|
303
|
+
#### `nuxt-gin install`
|
|
304
|
+
|
|
305
|
+
用于初始化项目:
|
|
306
|
+
|
|
307
|
+
- 总是执行 `npx nuxt prepare`
|
|
308
|
+
- 检测到 Go 后,额外执行 `go mod download && go mod tidy`
|
|
309
|
+
|
|
310
|
+
#### `nuxt-gin gen`
|
|
311
|
+
|
|
312
|
+
基于 `openapi.yaml` 生成 API 代码:
|
|
313
|
+
|
|
314
|
+
- Go Gin server 代码
|
|
315
|
+
- TypeScript axios 客户端代码
|
|
140
316
|
|
|
141
|
-
|
|
317
|
+
#### `nuxt-gin build`
|
|
142
318
|
|
|
143
|
-
|
|
319
|
+
执行构建与打包流程。
|
|
144
320
|
|
|
145
|
-
|
|
321
|
+
参数:
|
|
322
|
+
|
|
323
|
+
- `--skip-go`:跳过 Go 构建
|
|
324
|
+
- `--skip-nuxt`:跳过 Nuxt 静态构建
|
|
325
|
+
- `--binary-name <name>`:覆盖 `.build/.server` 下的 Go 二进制名称
|
|
326
|
+
|
|
327
|
+
#### `nuxt-gin cleanup`
|
|
328
|
+
|
|
329
|
+
清理临时文件与构建产物。
|
|
330
|
+
|
|
331
|
+
#### `nuxt-gin update`
|
|
332
|
+
|
|
333
|
+
按偏保守的默认策略更新依赖:
|
|
146
334
|
|
|
147
335
|
- Node:`pnpm update`
|
|
148
336
|
- Go:`go get -u=patch ./... && go mod tidy`
|
|
149
337
|
|
|
150
|
-
|
|
338
|
+
参数:
|
|
151
339
|
|
|
152
|
-
- `--latest
|
|
340
|
+
- `--latest`:切换成更激进的升级策略
|
|
153
341
|
- `--skip-go`:跳过 Go 依赖更新
|
|
154
342
|
- `--skip-node`:跳过 Node 依赖更新
|
|
155
343
|
|
|
156
|
-
|
|
344
|
+
### 🧩 `pack.config.ts` / `pack.config.json`
|
|
345
|
+
|
|
346
|
+
`nuxt-gin build` 会自动读取项目根目录中的打包配置,优先级如下:
|
|
347
|
+
|
|
348
|
+
1. `pack.config.ts`
|
|
349
|
+
2. `pack.config.js`
|
|
350
|
+
3. `pack.config.cjs`
|
|
351
|
+
4. `pack.config.mjs`
|
|
352
|
+
5. `pack.config.json`
|
|
353
|
+
|
|
354
|
+
如果同时存在多个配置文件,CLI 会输出 `warn`,并按优先级选择第一个。
|
|
355
|
+
|
|
356
|
+
推荐使用 TypeScript 写法:
|
|
357
|
+
|
|
358
|
+
```ts
|
|
359
|
+
import createPackConfig from 'nuxt-gin-tools/src/pack';
|
|
360
|
+
|
|
361
|
+
export default createPackConfig({
|
|
362
|
+
zipName: 'server.7z',
|
|
363
|
+
extraFilesGlobs: ['prisma/**'],
|
|
364
|
+
packageJson: {
|
|
365
|
+
private: true,
|
|
366
|
+
},
|
|
367
|
+
});
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
旧的 JSON 配置仍然兼容:
|
|
371
|
+
|
|
372
|
+
```json
|
|
373
|
+
{
|
|
374
|
+
"zipName": "server.7z",
|
|
375
|
+
"extraFilesGlobs": ["prisma/**"]
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
校验规则:
|
|
380
|
+
|
|
381
|
+
- ❌ 明显类型错误会直接 `error` 并终止打包
|
|
382
|
+
- ⚠️ 可继续执行但存在歧义的情况会输出 `warn`
|
|
383
|
+
- 📝 例如同时设置 `zipPath` 和 `zipName` 时,会提示 `zipPath` 优先生效
|
|
384
|
+
|
|
385
|
+
### 🧱 `pack.config.ts` Helper
|
|
386
|
+
|
|
387
|
+
可通过 [`src/pack.ts`](./src/pack.ts) 使用 helper:
|
|
388
|
+
|
|
389
|
+
```ts
|
|
390
|
+
import createPackConfig from 'nuxt-gin-tools/src/pack';
|
|
391
|
+
|
|
392
|
+
export default createPackConfig({
|
|
393
|
+
serverPath: '.build/production/server',
|
|
394
|
+
zipName: 'release.7z',
|
|
395
|
+
});
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
它提供:
|
|
399
|
+
|
|
400
|
+
- `PackConfig` 类型
|
|
401
|
+
- `createPackConfig(config)` 函数
|
|
402
|
+
- 默认导出即 `createPackConfig`
|
|
403
|
+
|
|
404
|
+
### ⚙️ 运行时配置
|
|
157
405
|
|
|
158
|
-
|
|
406
|
+
#### `server.config.json`
|
|
159
407
|
|
|
160
|
-
`dev`
|
|
408
|
+
`dev` 命令会读取这个文件来确定运行方式:
|
|
161
409
|
|
|
162
|
-
- `ginPort
|
|
163
|
-
- `nuxtPort
|
|
164
|
-
- `baseUrl
|
|
165
|
-
- `killPortBeforeDevelop
|
|
166
|
-
- `cleanupBeforeDevelop
|
|
410
|
+
- `ginPort`:Gin 服务端口
|
|
411
|
+
- `nuxtPort`:Nuxt 开发端口
|
|
412
|
+
- `baseUrl`:Nuxt 的 base URL
|
|
413
|
+
- `killPortBeforeDevelop`:开发前是否释放端口,默认 `true`
|
|
414
|
+
- `cleanupBeforeDevelop`:开发前是否执行 cleanup,默认 `false`
|
|
167
415
|
|
|
168
|
-
|
|
416
|
+
#### 前端运行时暴露
|
|
169
417
|
|
|
170
|
-
`createDefaultConfig`
|
|
418
|
+
`createDefaultConfig` 会把以下值注入 Nuxt `runtimeConfig.public`:
|
|
171
419
|
|
|
172
|
-
-
|
|
173
|
-
-
|
|
174
|
-
- 所有环境:`useRuntimeConfig().public.isDevelopment` 直接暴露当前是否开发环境
|
|
420
|
+
- `public.ginPort`:开发环境可读,生产环境为 `null`
|
|
421
|
+
- `public.isDevelopment`:当前是否为开发环境
|
|
175
422
|
|
|
176
|
-
|
|
423
|
+
示例:
|
|
177
424
|
|
|
178
425
|
```ts
|
|
179
426
|
const config = useRuntimeConfig();
|
|
@@ -181,9 +428,9 @@ const ginPort = config.public.ginPort;
|
|
|
181
428
|
const isDevelopment = config.public.isDevelopment;
|
|
182
429
|
```
|
|
183
430
|
|
|
184
|
-
|
|
431
|
+
#### `.go-watch.json`
|
|
185
432
|
|
|
186
|
-
Go
|
|
433
|
+
Go 监听规则来自 `.go-watch.json`:
|
|
187
434
|
|
|
188
435
|
```json
|
|
189
436
|
{
|
|
@@ -208,21 +455,21 @@ Go 监听配置文件,示例:
|
|
|
208
455
|
}
|
|
209
456
|
```
|
|
210
457
|
|
|
211
|
-
|
|
458
|
+
也支持通过环境变量指定:
|
|
212
459
|
|
|
213
460
|
```bash
|
|
214
461
|
NUXT_GIN_WATCH_CONFIG=/path/to/.go-watch.json
|
|
215
462
|
```
|
|
216
463
|
|
|
217
|
-
|
|
464
|
+
### 🖥️ 环境依赖
|
|
218
465
|
|
|
219
466
|
- Node.js
|
|
220
467
|
- pnpm
|
|
221
|
-
- Go
|
|
222
|
-
- `openapi-generator-cli
|
|
468
|
+
- Go,若需要运行 Gin 侧开发流程
|
|
469
|
+
- `openapi-generator-cli`,仅 `nuxt-gin gen` 需要
|
|
223
470
|
|
|
224
|
-
|
|
471
|
+
### 📝 说明
|
|
225
472
|
|
|
226
|
-
- Go
|
|
227
|
-
-
|
|
228
|
-
-
|
|
473
|
+
- 💨 Go 热更新不再依赖 Air
|
|
474
|
+
- 👀 当前 Go 开发监听方案为 `chokidar` + 重启 `go run main.go`
|
|
475
|
+
- 🪟 打包时会按平台生成可执行文件名:Windows 默认 `.exe`,Linux/macOS 默认无扩展名
|
package/package.json
CHANGED