create-pubinfo 0.5.0 → 0.6.3
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/dist/index.cjs +19 -10
- package/dist/index.js +19 -9
- package/package.json +5 -2
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -31,7 +30,7 @@ var import_consola6 = __toESM(require("consola"), 1);
|
|
|
31
30
|
var package_default = {
|
|
32
31
|
name: "create-pubinfo",
|
|
33
32
|
type: "module",
|
|
34
|
-
version: "0.
|
|
33
|
+
version: "0.6.3",
|
|
35
34
|
description: "\u521D\u59CB\u5316\u9879\u76EE\u6846\u67B6",
|
|
36
35
|
author: "Werheng <werheng.zhang@gmail.com>",
|
|
37
36
|
license: "MIT",
|
|
@@ -49,7 +48,10 @@ var package_default = {
|
|
|
49
48
|
dev: "tsup --watch src",
|
|
50
49
|
build: "tsup",
|
|
51
50
|
cli: "tsx src/index.ts",
|
|
52
|
-
"cli:clean": "rimraf ./my-app"
|
|
51
|
+
"cli:clean": "rimraf ./my-app",
|
|
52
|
+
clean: "pnpm rimraf node_modules && pnpm rimraf dist && pnpm rimraf .turbo",
|
|
53
|
+
stub: "unbuild --stub",
|
|
54
|
+
lint: "eslint . --cache --fix"
|
|
53
55
|
},
|
|
54
56
|
dependencies: {
|
|
55
57
|
"@inquirer/prompts": "^4.3.3",
|
|
@@ -109,8 +111,9 @@ async function download(options) {
|
|
|
109
111
|
dir: options.dir
|
|
110
112
|
});
|
|
111
113
|
} catch (error) {
|
|
112
|
-
if (error.message.includes(REMOTE_URL))
|
|
114
|
+
if (error.message.includes(REMOTE_URL)) {
|
|
113
115
|
error.message = error.message.replace(REMOTE_URL, "[REMOTE_URL]");
|
|
116
|
+
}
|
|
114
117
|
import_consola.default.error(`\u4E0B\u8F7D\u5931\u8D25: ${error.message}`);
|
|
115
118
|
import_node_process.default.exit(1);
|
|
116
119
|
} finally {
|
|
@@ -169,8 +172,9 @@ async function writeJSON(path, json) {
|
|
|
169
172
|
await (0, import_promises.writeFile)(path, (0, import_confbox.stringifyJSON)(json));
|
|
170
173
|
}
|
|
171
174
|
function assignValues(target, source) {
|
|
172
|
-
for (const [key, value] of Object.entries(source))
|
|
175
|
+
for (const [key, value] of Object.entries(source)) {
|
|
173
176
|
target[key] = value;
|
|
177
|
+
}
|
|
174
178
|
}
|
|
175
179
|
|
|
176
180
|
// src/rewrite.ts
|
|
@@ -279,8 +283,9 @@ async function fetchData() {
|
|
|
279
283
|
version
|
|
280
284
|
};
|
|
281
285
|
} catch (error) {
|
|
282
|
-
if (error.message.includes(REMOTE_URL))
|
|
286
|
+
if (error.message.includes(REMOTE_URL)) {
|
|
283
287
|
error.message = error.message.replace(REMOTE_URL, "[REMOTE_URL]");
|
|
288
|
+
}
|
|
284
289
|
import_consola4.default.error(`\u7F51\u7EDC\u8FDE\u63A5\u5F02\u5E38: ${error.message}`);
|
|
285
290
|
import_node_process3.default.exit(1);
|
|
286
291
|
} finally {
|
|
@@ -297,15 +302,17 @@ async function init() {
|
|
|
297
302
|
answer.key = await (0, import_prompts.input)({ message: "\u9879\u76EE\u6807\u8BC6\uFF08key\uFF09", default: answer.dir });
|
|
298
303
|
if ((0, import_node_fs3.existsSync)(answer.dir)) {
|
|
299
304
|
const overwrite = await (0, import_prompts.confirm)({ message: `\u76EE\u5F55 ${import_ansi_colors2.default.cyan(answer.dir)} \u5DF2\u5B58\u5728\uFF0C\u662F\u5426\u8986\u76D6\uFF1F` });
|
|
300
|
-
if (!overwrite)
|
|
305
|
+
if (!overwrite) {
|
|
301
306
|
throw Error;
|
|
307
|
+
}
|
|
302
308
|
}
|
|
303
309
|
answer.version = await (0, import_prompts.input)({
|
|
304
310
|
message: "\u6846\u67B6\u7248\u672C\u53F7\uFF08version\uFF09",
|
|
305
311
|
default: version.latest,
|
|
306
312
|
validate: (input2) => {
|
|
307
|
-
if (!version.list.includes(input2))
|
|
313
|
+
if (!version.list.includes(input2)) {
|
|
308
314
|
return `\u7248\u672C\u53F7: ${import_ansi_colors2.default.bold(input2)} \u4E0D\u5B58\u5728, \u5F53\u524D\u6700\u65B0\u7248\u672C\u53F7: ${import_ansi_colors2.default.bold(version.latest)}.`;
|
|
315
|
+
}
|
|
309
316
|
return true;
|
|
310
317
|
}
|
|
311
318
|
});
|
|
@@ -313,13 +320,15 @@ async function init() {
|
|
|
313
320
|
message: "\u9009\u62E9\u5E94\u7528\u6A21\u5757\uFF08apps\uFF09",
|
|
314
321
|
choices: APPS,
|
|
315
322
|
validate: (input2) => {
|
|
316
|
-
if (input2.length === 0)
|
|
323
|
+
if (input2.length === 0) {
|
|
317
324
|
return "\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u5E94\u7528";
|
|
325
|
+
}
|
|
318
326
|
return true;
|
|
319
327
|
}
|
|
320
328
|
});
|
|
321
329
|
answer.openapi = await (0, import_prompts.confirm)({
|
|
322
|
-
message: "\u8FD0\u884C\u65F6\u81EA\u52A8\u751F\u6210\u63A5\u53E3\u5BF9\u63A5\u6587\u4EF6\uFF0C\u82E5\u5173\u95ED\u53EF\u901A\u8FC7\u6307\u4EE4\u751F\u6210\uFF08openapi\uFF09"
|
|
330
|
+
message: "\u8FD0\u884C\u65F6\u81EA\u52A8\u751F\u6210\u63A5\u53E3\u5BF9\u63A5\u6587\u4EF6\uFF0C\u82E5\u5173\u95ED\u53EF\u901A\u8FC7\u6307\u4EE4\u751F\u6210\uFF08openapi\uFF09",
|
|
331
|
+
default: false
|
|
323
332
|
});
|
|
324
333
|
return answer;
|
|
325
334
|
} catch (error) {
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import consola6 from "consola";
|
|
|
8
8
|
var package_default = {
|
|
9
9
|
name: "create-pubinfo",
|
|
10
10
|
type: "module",
|
|
11
|
-
version: "0.
|
|
11
|
+
version: "0.6.3",
|
|
12
12
|
description: "\u521D\u59CB\u5316\u9879\u76EE\u6846\u67B6",
|
|
13
13
|
author: "Werheng <werheng.zhang@gmail.com>",
|
|
14
14
|
license: "MIT",
|
|
@@ -26,7 +26,10 @@ var package_default = {
|
|
|
26
26
|
dev: "tsup --watch src",
|
|
27
27
|
build: "tsup",
|
|
28
28
|
cli: "tsx src/index.ts",
|
|
29
|
-
"cli:clean": "rimraf ./my-app"
|
|
29
|
+
"cli:clean": "rimraf ./my-app",
|
|
30
|
+
clean: "pnpm rimraf node_modules && pnpm rimraf dist && pnpm rimraf .turbo",
|
|
31
|
+
stub: "unbuild --stub",
|
|
32
|
+
lint: "eslint . --cache --fix"
|
|
30
33
|
},
|
|
31
34
|
dependencies: {
|
|
32
35
|
"@inquirer/prompts": "^4.3.3",
|
|
@@ -86,8 +89,9 @@ async function download(options) {
|
|
|
86
89
|
dir: options.dir
|
|
87
90
|
});
|
|
88
91
|
} catch (error) {
|
|
89
|
-
if (error.message.includes(REMOTE_URL))
|
|
92
|
+
if (error.message.includes(REMOTE_URL)) {
|
|
90
93
|
error.message = error.message.replace(REMOTE_URL, "[REMOTE_URL]");
|
|
94
|
+
}
|
|
91
95
|
consola.error(`\u4E0B\u8F7D\u5931\u8D25: ${error.message}`);
|
|
92
96
|
process.exit(1);
|
|
93
97
|
} finally {
|
|
@@ -146,8 +150,9 @@ async function writeJSON(path, json) {
|
|
|
146
150
|
await writeFile(path, stringifyJSON(json));
|
|
147
151
|
}
|
|
148
152
|
function assignValues(target, source) {
|
|
149
|
-
for (const [key, value] of Object.entries(source))
|
|
153
|
+
for (const [key, value] of Object.entries(source)) {
|
|
150
154
|
target[key] = value;
|
|
155
|
+
}
|
|
151
156
|
}
|
|
152
157
|
|
|
153
158
|
// src/rewrite.ts
|
|
@@ -256,8 +261,9 @@ async function fetchData() {
|
|
|
256
261
|
version
|
|
257
262
|
};
|
|
258
263
|
} catch (error) {
|
|
259
|
-
if (error.message.includes(REMOTE_URL))
|
|
264
|
+
if (error.message.includes(REMOTE_URL)) {
|
|
260
265
|
error.message = error.message.replace(REMOTE_URL, "[REMOTE_URL]");
|
|
266
|
+
}
|
|
261
267
|
consola4.error(`\u7F51\u7EDC\u8FDE\u63A5\u5F02\u5E38: ${error.message}`);
|
|
262
268
|
process3.exit(1);
|
|
263
269
|
} finally {
|
|
@@ -274,15 +280,17 @@ async function init() {
|
|
|
274
280
|
answer.key = await input({ message: "\u9879\u76EE\u6807\u8BC6\uFF08key\uFF09", default: answer.dir });
|
|
275
281
|
if (existsSync3(answer.dir)) {
|
|
276
282
|
const overwrite = await confirm({ message: `\u76EE\u5F55 ${colors2.cyan(answer.dir)} \u5DF2\u5B58\u5728\uFF0C\u662F\u5426\u8986\u76D6\uFF1F` });
|
|
277
|
-
if (!overwrite)
|
|
283
|
+
if (!overwrite) {
|
|
278
284
|
throw Error;
|
|
285
|
+
}
|
|
279
286
|
}
|
|
280
287
|
answer.version = await input({
|
|
281
288
|
message: "\u6846\u67B6\u7248\u672C\u53F7\uFF08version\uFF09",
|
|
282
289
|
default: version.latest,
|
|
283
290
|
validate: (input2) => {
|
|
284
|
-
if (!version.list.includes(input2))
|
|
291
|
+
if (!version.list.includes(input2)) {
|
|
285
292
|
return `\u7248\u672C\u53F7: ${colors2.bold(input2)} \u4E0D\u5B58\u5728, \u5F53\u524D\u6700\u65B0\u7248\u672C\u53F7: ${colors2.bold(version.latest)}.`;
|
|
293
|
+
}
|
|
286
294
|
return true;
|
|
287
295
|
}
|
|
288
296
|
});
|
|
@@ -290,13 +298,15 @@ async function init() {
|
|
|
290
298
|
message: "\u9009\u62E9\u5E94\u7528\u6A21\u5757\uFF08apps\uFF09",
|
|
291
299
|
choices: APPS,
|
|
292
300
|
validate: (input2) => {
|
|
293
|
-
if (input2.length === 0)
|
|
301
|
+
if (input2.length === 0) {
|
|
294
302
|
return "\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u5E94\u7528";
|
|
303
|
+
}
|
|
295
304
|
return true;
|
|
296
305
|
}
|
|
297
306
|
});
|
|
298
307
|
answer.openapi = await confirm({
|
|
299
|
-
message: "\u8FD0\u884C\u65F6\u81EA\u52A8\u751F\u6210\u63A5\u53E3\u5BF9\u63A5\u6587\u4EF6\uFF0C\u82E5\u5173\u95ED\u53EF\u901A\u8FC7\u6307\u4EE4\u751F\u6210\uFF08openapi\uFF09"
|
|
308
|
+
message: "\u8FD0\u884C\u65F6\u81EA\u52A8\u751F\u6210\u63A5\u53E3\u5BF9\u63A5\u6587\u4EF6\uFF0C\u82E5\u5173\u95ED\u53EF\u901A\u8FC7\u6307\u4EE4\u751F\u6210\uFF08openapi\uFF09",
|
|
309
|
+
default: false
|
|
300
310
|
});
|
|
301
311
|
return answer;
|
|
302
312
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pubinfo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.3",
|
|
5
5
|
"description": "初始化项目框架",
|
|
6
6
|
"author": "Werheng <werheng.zhang@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
"dev": "tsup --watch src",
|
|
33
33
|
"build": "tsup",
|
|
34
34
|
"cli": "tsx src/index.ts",
|
|
35
|
-
"cli:clean": "rimraf ./my-app"
|
|
35
|
+
"cli:clean": "rimraf ./my-app",
|
|
36
|
+
"clean": "pnpm rimraf node_modules && pnpm rimraf dist && pnpm rimraf .turbo",
|
|
37
|
+
"stub": "unbuild --stub",
|
|
38
|
+
"lint": "eslint . --cache --fix"
|
|
36
39
|
}
|
|
37
40
|
}
|