nuxt-gin-tools 0.2.17 → 0.2.19

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/commands/pack.js CHANGED
@@ -45,7 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
45
45
  return (mod && mod.__esModule) ? mod : { "default": mod };
46
46
  };
47
47
  Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.FILES_TO_COPY = exports.PACKAGE_JSON_CONTENT = exports.SERVER_EXECUTABLE = exports.PACK_CONFIG_PATH = exports.ORIGINAL_DIST_PATH = exports.SERVER_PATH = exports.ZIP_PATH = void 0;
48
+ exports.FILES_TO_COPY = exports.PACKAGE_JSON_CONTENT = exports.SERVER_EXECUTABLE = exports.BUILD_EXECUTABLE = exports.PACK_CONFIG_MJS_PATH = exports.PACK_CONFIG_CJS_PATH = exports.PACK_CONFIG_JS_PATH = exports.PACK_CONFIG_TS_PATH = exports.PACK_CONFIG_PATH = exports.ORIGINAL_DIST_PATH = exports.SERVER_PATH = exports.ZIP_PATH = void 0;
49
49
  exports.builtPath = builtPath;
50
50
  exports.buildAndPack = buildAndPack;
51
51
  // 导入项目构建工具,用于执行 Nuxt 项目的构建流程
@@ -58,6 +58,7 @@ const FS = __importStar(require("fs-extra"));
58
58
  const Path = __importStar(require("path"));
59
59
  const os = __importStar(require("os"));
60
60
  const fast_glob_1 = __importDefault(require("fast-glob"));
61
+ const { createJiti } = require("jiti");
61
62
  /**
62
63
  * 生成相对于服务器构建目录的绝对路径
63
64
  * @param relativePath - 相对路径
@@ -73,22 +74,115 @@ exports.SERVER_PATH = Path.resolve(process.cwd(), ".build/production/server");
73
74
  // 定义原始 dist 目录路径,用于清理操作
74
75
  exports.ORIGINAL_DIST_PATH = Path.resolve(process.cwd(), "dist");
75
76
  exports.PACK_CONFIG_PATH = Path.resolve(process.cwd(), "pack.config.json");
77
+ exports.PACK_CONFIG_TS_PATH = Path.resolve(process.cwd(), "pack.config.ts");
78
+ exports.PACK_CONFIG_JS_PATH = Path.resolve(process.cwd(), "pack.config.js");
79
+ exports.PACK_CONFIG_CJS_PATH = Path.resolve(process.cwd(), "pack.config.cjs");
80
+ exports.PACK_CONFIG_MJS_PATH = Path.resolve(process.cwd(), "pack.config.mjs");
81
+ exports.BUILD_EXECUTABLE = os.platform() === "win32" ? "production.exe" : "production";
76
82
  exports.SERVER_EXECUTABLE = os.platform() === "win32" ? "server-production.exe" : "server-production"; // 根据操作系统选择可执行文件名
77
83
  // 定义打包后项目的 package.json 内容
78
84
  exports.PACKAGE_JSON_CONTENT = {
79
85
  private: true,
80
86
  scripts: {
81
- start: "./server-production.exe", // 定义启动命令
87
+ start: `./${exports.SERVER_EXECUTABLE}`, // 定义启动命令
82
88
  },
83
89
  };
84
90
  // 定义需要复制到构建目录的文件映射关系(目标为构建目录下的相对路径)
85
91
  const DEFAULT_FILES_TO_COPY = {
86
92
  "vue/.output": "vue/.output", // Vue 应用构建输出
87
- [`.build/.server/production.exe`]: "server-production.exe", // 生产环境可执行文件
93
+ [`.build/.server/${exports.BUILD_EXECUTABLE}`]: exports.SERVER_EXECUTABLE, // 生产环境可执行文件
88
94
  "server.config.json": "server.config.json", // 服务器配置文件
89
95
  };
90
96
  // 兼容旧导出:默认构建目录下的绝对目标路径
91
97
  exports.FILES_TO_COPY = Object.fromEntries(Object.entries(DEFAULT_FILES_TO_COPY).map(([src, dest]) => [src, builtPath(dest)]));
98
+ function warnPackConfig(message) {
99
+ console.warn(`[nuxt-gin-tools][pack] WARN: ${message}`);
100
+ }
101
+ function errorPackConfig(message) {
102
+ throw new Error(`[nuxt-gin-tools][pack] ${message}`);
103
+ }
104
+ function isPlainObject(value) {
105
+ return typeof value === "object" && value !== null && !Array.isArray(value);
106
+ }
107
+ function validateStringArray(fieldName, value, issues) {
108
+ if (value === undefined) {
109
+ return;
110
+ }
111
+ if (!Array.isArray(value)) {
112
+ issues.push({ level: "error", message: `${fieldName} must be an array of strings` });
113
+ return;
114
+ }
115
+ for (const item of value) {
116
+ if (typeof item !== "string") {
117
+ issues.push({ level: "error", message: `${fieldName} must contain only strings` });
118
+ return;
119
+ }
120
+ }
121
+ }
122
+ function validateStringRecord(fieldName, value, issues) {
123
+ if (value === undefined) {
124
+ return;
125
+ }
126
+ if (!isPlainObject(value)) {
127
+ issues.push({ level: "error", message: `${fieldName} must be an object of string to string` });
128
+ return;
129
+ }
130
+ for (const [key, item] of Object.entries(value)) {
131
+ if (typeof key !== "string" || typeof item !== "string") {
132
+ issues.push({ level: "error", message: `${fieldName} must be an object of string to string` });
133
+ return;
134
+ }
135
+ }
136
+ }
137
+ function validatePackConfig(config, sourcePath) {
138
+ if (!isPlainObject(config)) {
139
+ errorPackConfig(`${Path.basename(sourcePath)} must export an object`);
140
+ }
141
+ const issues = [];
142
+ const typedConfig = config;
143
+ const stringFields = ["binaryName", "zipName", "zipPath", "serverPath"];
144
+ for (const field of stringFields) {
145
+ const value = typedConfig[field];
146
+ if (value !== undefined && typeof value !== "string") {
147
+ issues.push({ level: "error", message: `${field} must be a string` });
148
+ }
149
+ }
150
+ const booleanFields = ["skipGo", "skipNuxt", "cleanDist", "writeScripts", "overwrite"];
151
+ for (const field of booleanFields) {
152
+ const value = typedConfig[field];
153
+ if (value !== undefined && typeof value !== "boolean") {
154
+ issues.push({ level: "error", message: `${field} must be a boolean` });
155
+ }
156
+ }
157
+ validateStringArray("extraFilesGlobs", typedConfig.extraFilesGlobs, issues);
158
+ validateStringArray("exclude", typedConfig.exclude, issues);
159
+ validateStringRecord("extraFiles", typedConfig.extraFiles, issues);
160
+ if (typedConfig.packageJson !== undefined && !isPlainObject(typedConfig.packageJson)) {
161
+ issues.push({ level: "error", message: `packageJson must be an object` });
162
+ }
163
+ if (typedConfig.beforePack !== undefined && typeof typedConfig.beforePack !== "function") {
164
+ issues.push({ level: "error", message: `beforePack must be a function` });
165
+ }
166
+ if (typedConfig.afterPack !== undefined && typeof typedConfig.afterPack !== "function") {
167
+ issues.push({ level: "error", message: `afterPack must be a function` });
168
+ }
169
+ if (typedConfig.zipName !== undefined && typedConfig.zipPath !== undefined) {
170
+ issues.push({ level: "warn", message: `zipPath and zipName are both set; zipPath takes precedence` });
171
+ }
172
+ if (typedConfig.skipGo === true && typedConfig.skipNuxt === true) {
173
+ issues.push({ level: "warn", message: `skipGo and skipNuxt are both true; build step will be skipped` });
174
+ }
175
+ for (const issue of issues) {
176
+ if (issue.level === "warn") {
177
+ warnPackConfig(`${Path.basename(sourcePath)}: ${issue.message}`);
178
+ }
179
+ }
180
+ const errors = issues.filter((issue) => issue.level === "error");
181
+ if (errors.length > 0) {
182
+ errorPackConfig(`${Path.basename(sourcePath)} is invalid:\n- ${errors.map((item) => item.message).join("\n- ")}`);
183
+ }
184
+ return config;
185
+ }
92
186
  /**
93
187
  * 写入启动脚本和 package.json 文件到构建目录
94
188
  */
@@ -96,9 +190,9 @@ function writeScriptFiles(serverPath, config) {
96
190
  // 写入 Windows 批处理启动脚本
97
191
  FS.outputFileSync(Path.resolve(serverPath, "start.bat"), `powershell -ExecutionPolicy ByPass -File ./start.ps1`);
98
192
  // 写入 PowerShell 启动脚本
99
- FS.outputFileSync(Path.resolve(serverPath, "start.ps1"), `./server-production.exe`);
193
+ FS.outputFileSync(Path.resolve(serverPath, "start.ps1"), `./${exports.SERVER_EXECUTABLE}`);
100
194
  // 写入 Linux/macOS 启动脚本
101
- FS.outputFileSync(Path.resolve(serverPath, "start.sh"), `./server-production.exe`);
195
+ FS.outputFileSync(Path.resolve(serverPath, "start.sh"), `./${exports.SERVER_EXECUTABLE}`);
102
196
  // 写入 package.json 文件,使用 2 个空格缩进
103
197
  const mergedPackageJson = mergePackageJson(exports.PACKAGE_JSON_CONTENT, config === null || config === void 0 ? void 0 : config.packageJson);
104
198
  FS.outputJSONSync(Path.resolve(serverPath, "package.json"), mergedPackageJson, { spaces: 2 });
@@ -147,10 +241,32 @@ function mergePackageJson(base, override) {
147
241
  return Object.assign(Object.assign(Object.assign({}, base), override), { scripts: Object.assign(Object.assign({}, baseScripts), overrideScripts) });
148
242
  }
149
243
  function readPackConfigFromCwd() {
150
- if (!FS.existsSync(exports.PACK_CONFIG_PATH)) {
244
+ const candidates = [
245
+ exports.PACK_CONFIG_TS_PATH,
246
+ exports.PACK_CONFIG_JS_PATH,
247
+ exports.PACK_CONFIG_CJS_PATH,
248
+ exports.PACK_CONFIG_MJS_PATH,
249
+ exports.PACK_CONFIG_PATH,
250
+ ].filter((configPath) => FS.existsSync(configPath));
251
+ if (candidates.length === 0) {
151
252
  return undefined;
152
253
  }
153
- return FS.readJSONSync(exports.PACK_CONFIG_PATH);
254
+ if (candidates.length > 1) {
255
+ warnPackConfig(`multiple pack config files found (${candidates.map((item) => Path.basename(item)).join(", ")}); using ${Path.basename(candidates[0])}`);
256
+ }
257
+ const selectedPath = candidates[0];
258
+ let loadedConfig;
259
+ if (selectedPath.endsWith(".json")) {
260
+ loadedConfig = FS.readJSONSync(selectedPath);
261
+ }
262
+ else {
263
+ const jiti = createJiti(__filename, { moduleCache: false, interopDefault: true });
264
+ loadedConfig = jiti(selectedPath);
265
+ }
266
+ const normalizedConfig = isPlainObject(loadedConfig) && "default" in loadedConfig
267
+ ? loadedConfig.default
268
+ : loadedConfig;
269
+ return validatePackConfig(normalizedConfig, selectedPath);
154
270
  }
155
271
  function resolveServerPath(config) {
156
272
  if (!(config === null || config === void 0 ? void 0 : config.serverPath)) {
@@ -212,7 +328,7 @@ function buildAndPack(config) {
212
328
  const resolvedConfig = config !== null && config !== void 0 ? config : readPackConfigFromCwd();
213
329
  const serverPath = resolveServerPath(resolvedConfig);
214
330
  const zipPath = resolveZipPath(resolvedConfig);
215
- yield (0, builder_1.default)(); // 执行项目构建
331
+ yield (0, builder_1.default)(resolvedConfig); // 执行项目构建
216
332
  if (resolvedConfig === null || resolvedConfig === void 0 ? void 0 : resolvedConfig.beforePack) {
217
333
  yield resolvedConfig.beforePack();
218
334
  }
@@ -1,2 +1,7 @@
1
- export declare function update(): void;
1
+ export type UpdateOptions = {
2
+ latest?: boolean;
3
+ skipGo?: boolean;
4
+ skipNode?: boolean;
5
+ };
6
+ export declare function update(options?: UpdateOptions): Promise<void> | Promise<import("concurrently").CloseEvent[]>;
2
7
  export default update;
@@ -5,18 +5,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.update = update;
7
7
  const concurrently_1 = __importDefault(require("concurrently"));
8
- function update() {
9
- (0, concurrently_1.default)([
10
- {
11
- command: "pnpm update --latest",
8
+ function update(options = {}) {
9
+ const commands = [];
10
+ if (!options.skipNode) {
11
+ commands.push({
12
+ command: options.latest ? "pnpm update --latest" : "pnpm update",
12
13
  name: "pnpm",
13
14
  prefixColor: "magenta",
14
- },
15
- {
16
- command: "go get -u && go mod tidy",
15
+ });
16
+ }
17
+ if (!options.skipGo) {
18
+ commands.push({
19
+ command: options.latest ? "go get -u ./... && go mod tidy" : "go get -u=patch ./... && go mod tidy",
17
20
  name: "go",
18
21
  prefixColor: "green",
19
- },
20
- ]);
22
+ });
23
+ }
24
+ if (commands.length === 0) {
25
+ return Promise.resolve();
26
+ }
27
+ return (0, concurrently_1.default)(commands).result;
21
28
  }
22
29
  exports.default = update;
package/index.js CHANGED
@@ -33,6 +33,15 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  return result;
34
34
  };
35
35
  })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
36
45
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
46
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
47
  };
@@ -50,6 +59,7 @@ const postinstall_1 = __importDefault(require("./commands/postinstall"));
50
59
  const cleanup_1 = __importDefault(require("./commands/cleanup"));
51
60
  // 导入更新功能
52
61
  const update_1 = __importDefault(require("./commands/update"));
62
+ const cli_options_1 = require("./src/cli-options");
53
63
  // 获取命令行参数(去除前两个默认参数)
54
64
  const args = process.argv.slice(2);
55
65
  // 检查是否提供了命令
@@ -57,41 +67,62 @@ if (args.length === 0) {
57
67
  console.error("未提供命令。请指定要运行的命令。");
58
68
  process.exit(1);
59
69
  }
60
- // 根据第一个参数执行对应的命令
61
- switch (args[0]) {
62
- case "dev":
63
- // 启动开发模式
64
- (0, develop_1.default)();
65
- break;
66
- case "dev:nuxt":
67
- // 仅启动 Nuxt 开发模式
68
- (0, develop_1.developNuxt)();
69
- break;
70
- case "dev:go":
71
- // 仅启动 Go 开发模式
72
- (0, develop_1.developGo)();
73
- break;
74
- case "build":
75
- // 执行构建和打包操作
76
- (0, pack_1.default)();
77
- break;
78
- case "gen":
79
- // 生成API代码(注:此处命令可能拼写错误,应为generate)
80
- (0, api_generate_1.default)();
81
- break;
82
- case "install":
83
- // 执行安装后的初始化操作
84
- (0, postinstall_1.default)();
85
- break;
86
- case "cleanup":
87
- // 执行清理操作
88
- (0, cleanup_1.default)();
89
- break;
90
- case "update":
91
- // 更新依赖
92
- (0, update_1.default)();
93
- break;
94
- default:
95
- console.error(`未知命令: ${args[0]}`);
96
- process.exit(1);
70
+ function main() {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ const command = args[0];
73
+ const options = (0, cli_options_1.parseCLIOptions)(args.slice(1));
74
+ switch (command) {
75
+ case "dev":
76
+ yield (0, develop_1.default)({
77
+ noCleanup: (0, cli_options_1.hasFlag)(options, "no-cleanup"),
78
+ skipGo: (0, cli_options_1.hasFlag)(options, "skip-go"),
79
+ skipNuxt: (0, cli_options_1.hasFlag)(options, "skip-nuxt"),
80
+ });
81
+ break;
82
+ case "dev:nuxt":
83
+ yield (0, develop_1.developNuxt)({
84
+ noCleanup: (0, cli_options_1.hasFlag)(options, "no-cleanup"),
85
+ });
86
+ break;
87
+ case "dev:go":
88
+ yield (0, develop_1.developGo)({
89
+ noCleanup: (0, cli_options_1.hasFlag)(options, "no-cleanup"),
90
+ });
91
+ break;
92
+ case "build":
93
+ yield (0, pack_1.default)({
94
+ binaryName: (0, cli_options_1.getOption)(options, "binary-name"),
95
+ skipGo: (0, cli_options_1.hasFlag)(options, "skip-go"),
96
+ skipNuxt: (0, cli_options_1.hasFlag)(options, "skip-nuxt"),
97
+ });
98
+ break;
99
+ case "gen":
100
+ // 生成API代码(注:此处命令可能拼写错误,应为generate)
101
+ yield (0, api_generate_1.default)();
102
+ break;
103
+ case "install":
104
+ // 执行安装后的初始化操作
105
+ yield (0, postinstall_1.default)();
106
+ break;
107
+ case "cleanup":
108
+ // 执行清理操作
109
+ yield (0, cleanup_1.default)();
110
+ break;
111
+ case "update":
112
+ // 更新依赖
113
+ yield (0, update_1.default)({
114
+ latest: (0, cli_options_1.hasFlag)(options, "latest"),
115
+ skipGo: (0, cli_options_1.hasFlag)(options, "skip-go"),
116
+ skipNode: (0, cli_options_1.hasFlag)(options, "skip-node"),
117
+ });
118
+ break;
119
+ default:
120
+ console.error(`未知命令: ${command}`);
121
+ process.exit(1);
122
+ }
123
+ });
97
124
  }
125
+ void main().catch((error) => {
126
+ console.error(error);
127
+ process.exit(1);
128
+ });
package/package.json CHANGED
@@ -1,30 +1,31 @@
1
- {
2
- "name": "nuxt-gin-tools",
3
- "version": "0.2.17",
4
- "description": "This project is used as a dependency for [nuxt-gin-starter](https://github.com/RapboyGao/nuxt-gin-starter.git)",
5
- "bin": {
6
- "nuxt-gin": "index.js"
7
- },
8
- "keywords": [],
9
- "author": "",
10
- "license": "MIT",
11
- "scripts": {
12
- "build": "ts-node build.ts",
13
- "publish": "npm publish --access public"
14
- },
15
- "dependencies": {
16
- "7zip-min": "^2.1.0",
17
- "chalk": "^5.4.1",
18
- "chokidar": "^3.6.0",
19
- "concurrently": "^9.2.0",
20
- "fast-glob": "^3.3.3",
21
- "fs-extra": "^11.3.0"
22
- },
23
- "devDependencies": {
24
- "@types/fs-extra": "^11.0.4",
25
- "@types/node": "^24.0.15",
26
- "nuxt": "^4.0.1",
27
- "ts-node": "^10.9.2",
28
- "typescript": "^5.8.3"
29
- }
30
- }
1
+ {
2
+ "name": "nuxt-gin-tools",
3
+ "version": "0.2.19",
4
+ "description": "This project is used as a dependency for [nuxt-gin-starter](https://github.com/RapboyGao/nuxt-gin-starter.git)",
5
+ "bin": {
6
+ "nuxt-gin": "index.js"
7
+ },
8
+ "keywords": [],
9
+ "author": "",
10
+ "license": "MIT",
11
+ "scripts": {
12
+ "build": "ts-node build.ts",
13
+ "publish": "npm publish --access public"
14
+ },
15
+ "dependencies": {
16
+ "7zip-min": "^2.1.0",
17
+ "chalk": "^5.4.1",
18
+ "chokidar": "^3.6.0",
19
+ "concurrently": "^9.2.0",
20
+ "fast-glob": "^3.3.3",
21
+ "fs-extra": "^11.3.0",
22
+ "jiti": "^2.6.1"
23
+ },
24
+ "devDependencies": {
25
+ "@types/fs-extra": "^11.0.4",
26
+ "@types/node": "^24.0.15",
27
+ "nuxt": "^4.0.1",
28
+ "ts-node": "^10.9.2",
29
+ "typescript": "^5.8.3"
30
+ }
31
+ }
@@ -0,0 +1,8 @@
1
+ export type CLIOptions = {
2
+ flags: Set<string>;
3
+ values: Map<string, string>;
4
+ positionals: string[];
5
+ };
6
+ export declare function parseCLIOptions(args: string[]): CLIOptions;
7
+ export declare function hasFlag(options: CLIOptions, key: string): boolean;
8
+ export declare function getOption(options: CLIOptions, key: string): string | undefined;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseCLIOptions = parseCLIOptions;
4
+ exports.hasFlag = hasFlag;
5
+ exports.getOption = getOption;
6
+ function normalizeKey(key) {
7
+ return key.replace(/^-+/, "").trim();
8
+ }
9
+ function parseCLIOptions(args) {
10
+ var _a, _b, _c, _d;
11
+ const flags = new Set();
12
+ const values = new Map();
13
+ const positionals = [];
14
+ for (let i = 0; i < args.length; i += 1) {
15
+ const current = (_b = (_a = args[i]) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : "";
16
+ if (!current)
17
+ continue;
18
+ if (!current.startsWith("-")) {
19
+ positionals.push(current);
20
+ continue;
21
+ }
22
+ const eqIndex = current.indexOf("=");
23
+ if (eqIndex >= 0) {
24
+ values.set(normalizeKey(current.slice(0, eqIndex)), current.slice(eqIndex + 1));
25
+ continue;
26
+ }
27
+ const key = normalizeKey(current);
28
+ const next = (_d = (_c = args[i + 1]) === null || _c === void 0 ? void 0 : _c.trim()) !== null && _d !== void 0 ? _d : "";
29
+ if (next && !next.startsWith("-")) {
30
+ values.set(key, next);
31
+ i += 1;
32
+ continue;
33
+ }
34
+ flags.add(key);
35
+ }
36
+ return { flags, values, positionals };
37
+ }
38
+ function hasFlag(options, key) {
39
+ return options.flags.has(normalizeKey(key));
40
+ }
41
+ function getOption(options, key) {
42
+ return options.values.get(normalizeKey(key));
43
+ }
@@ -1,5 +1,5 @@
1
- {
2
- "apiPath": "server/api",
3
- "packageName": "api",
4
- "serverPort": "8099"
1
+ {
2
+ "apiPath": "server/api",
3
+ "packageName": "api",
4
+ "serverPort": "8099"
5
5
  }
@@ -1,62 +1,62 @@
1
- {
2
- "title": "Nuxt Gin Tools Pack Config",
3
- "type": "object",
4
- "additionalProperties": false,
5
- "properties": {
6
- "extraFiles": {
7
- "type": "object",
8
- "description": "额外需要打包的文件映射(key: 源文件路径,value: 打包后对应位置)",
9
- "additionalProperties": {
10
- "type": "string"
11
- }
12
- },
13
- "extraFilesGlobs": {
14
- "type": "array",
15
- "description": "额外需要打包的文件 Glob(相对于项目根目录)",
16
- "items": {
17
- "type": "string"
18
- }
19
- },
20
- "exclude": {
21
- "type": "array",
22
- "description": "排除文件/目录 Glob(相对于项目根目录)",
23
- "items": {
24
- "type": "string"
25
- }
26
- },
27
- "zipName": {
28
- "type": "string",
29
- "description": "打包输出 zip 名称(相对于默认 zip 目录)"
30
- },
31
- "zipPath": {
32
- "type": "string",
33
- "description": "打包输出 zip 路径(相对于项目根目录或绝对路径)"
34
- },
35
- "serverPath": {
36
- "type": "string",
37
- "description": "服务器构建输出目录(相对于项目根目录或绝对路径)"
38
- },
39
- "beforePack": {
40
- "description": "打包前钩子(仅在代码调用传入时生效)"
41
- },
42
- "afterPack": {
43
- "description": "打包后钩子(仅在代码调用传入时生效)"
44
- },
45
- "cleanDist": {
46
- "type": "boolean",
47
- "description": "是否清理 dist"
48
- },
49
- "writeScripts": {
50
- "type": "boolean",
51
- "description": "是否写入启动脚本和 package.json"
52
- },
53
- "packageJson": {
54
- "type": "object",
55
- "description": "写入/覆盖 package.json 内容"
56
- },
57
- "overwrite": {
58
- "type": "boolean",
59
- "description": "复制时是否覆盖同名文件"
60
- }
61
- }
62
- }
1
+ {
2
+ "title": "Nuxt Gin Tools Pack Config",
3
+ "type": "object",
4
+ "additionalProperties": false,
5
+ "properties": {
6
+ "extraFiles": {
7
+ "type": "object",
8
+ "description": "额外需要打包的文件映射(key: 源文件路径,value: 打包后对应位置)",
9
+ "additionalProperties": {
10
+ "type": "string"
11
+ }
12
+ },
13
+ "extraFilesGlobs": {
14
+ "type": "array",
15
+ "description": "额外需要打包的文件 Glob(相对于项目根目录)",
16
+ "items": {
17
+ "type": "string"
18
+ }
19
+ },
20
+ "exclude": {
21
+ "type": "array",
22
+ "description": "排除文件/目录 Glob(相对于项目根目录)",
23
+ "items": {
24
+ "type": "string"
25
+ }
26
+ },
27
+ "zipName": {
28
+ "type": "string",
29
+ "description": "打包输出 zip 名称(相对于默认 zip 目录)"
30
+ },
31
+ "zipPath": {
32
+ "type": "string",
33
+ "description": "打包输出 zip 路径(相对于项目根目录或绝对路径)"
34
+ },
35
+ "serverPath": {
36
+ "type": "string",
37
+ "description": "服务器构建输出目录(相对于项目根目录或绝对路径)"
38
+ },
39
+ "beforePack": {
40
+ "description": "打包前钩子(仅在代码调用传入时生效)"
41
+ },
42
+ "afterPack": {
43
+ "description": "打包后钩子(仅在代码调用传入时生效)"
44
+ },
45
+ "cleanDist": {
46
+ "type": "boolean",
47
+ "description": "是否清理 dist"
48
+ },
49
+ "writeScripts": {
50
+ "type": "boolean",
51
+ "description": "是否写入启动脚本和 package.json"
52
+ },
53
+ "packageJson": {
54
+ "type": "object",
55
+ "description": "写入/覆盖 package.json 内容"
56
+ },
57
+ "overwrite": {
58
+ "type": "boolean",
59
+ "description": "复制时是否覆盖同名文件"
60
+ }
61
+ }
62
+ }