create-pubinfo 0.5.1 → 0.6.4
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 +17 -13
- package/dist/index.js +17 -12
- package/package.json +5 -6
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,14 +30,10 @@ 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.4",
|
|
35
34
|
description: "\u521D\u59CB\u5316\u9879\u76EE\u6846\u67B6",
|
|
36
35
|
author: "Werheng <werheng.zhang@gmail.com>",
|
|
37
36
|
license: "MIT",
|
|
38
|
-
repository: "https://github.com/werheng/pubinfo-cli",
|
|
39
|
-
bugs: {
|
|
40
|
-
url: "https://github.com/werheng/pubinfo-cli/issues"
|
|
41
|
-
},
|
|
42
37
|
bin: {
|
|
43
38
|
pubinfo: "./dist/index.js"
|
|
44
39
|
},
|
|
@@ -49,7 +44,10 @@ var package_default = {
|
|
|
49
44
|
dev: "tsup --watch src",
|
|
50
45
|
build: "tsup",
|
|
51
46
|
cli: "tsx src/index.ts",
|
|
52
|
-
"cli:clean": "rimraf ./my-app"
|
|
47
|
+
"cli:clean": "rimraf ./my-app",
|
|
48
|
+
clean: "pnpm rimraf node_modules && pnpm rimraf dist && pnpm rimraf .turbo",
|
|
49
|
+
stub: "unbuild --stub",
|
|
50
|
+
lint: "eslint . --cache --fix"
|
|
53
51
|
},
|
|
54
52
|
dependencies: {
|
|
55
53
|
"@inquirer/prompts": "^4.3.3",
|
|
@@ -109,8 +107,9 @@ async function download(options) {
|
|
|
109
107
|
dir: options.dir
|
|
110
108
|
});
|
|
111
109
|
} catch (error) {
|
|
112
|
-
if (error.message.includes(REMOTE_URL))
|
|
110
|
+
if (error.message.includes(REMOTE_URL)) {
|
|
113
111
|
error.message = error.message.replace(REMOTE_URL, "[REMOTE_URL]");
|
|
112
|
+
}
|
|
114
113
|
import_consola.default.error(`\u4E0B\u8F7D\u5931\u8D25: ${error.message}`);
|
|
115
114
|
import_node_process.default.exit(1);
|
|
116
115
|
} finally {
|
|
@@ -169,8 +168,9 @@ async function writeJSON(path, json) {
|
|
|
169
168
|
await (0, import_promises.writeFile)(path, (0, import_confbox.stringifyJSON)(json));
|
|
170
169
|
}
|
|
171
170
|
function assignValues(target, source) {
|
|
172
|
-
for (const [key, value] of Object.entries(source))
|
|
171
|
+
for (const [key, value] of Object.entries(source)) {
|
|
173
172
|
target[key] = value;
|
|
173
|
+
}
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
// src/rewrite.ts
|
|
@@ -279,8 +279,9 @@ async function fetchData() {
|
|
|
279
279
|
version
|
|
280
280
|
};
|
|
281
281
|
} catch (error) {
|
|
282
|
-
if (error.message.includes(REMOTE_URL))
|
|
282
|
+
if (error.message.includes(REMOTE_URL)) {
|
|
283
283
|
error.message = error.message.replace(REMOTE_URL, "[REMOTE_URL]");
|
|
284
|
+
}
|
|
284
285
|
import_consola4.default.error(`\u7F51\u7EDC\u8FDE\u63A5\u5F02\u5E38: ${error.message}`);
|
|
285
286
|
import_node_process3.default.exit(1);
|
|
286
287
|
} finally {
|
|
@@ -297,15 +298,17 @@ async function init() {
|
|
|
297
298
|
answer.key = await (0, import_prompts.input)({ message: "\u9879\u76EE\u6807\u8BC6\uFF08key\uFF09", default: answer.dir });
|
|
298
299
|
if ((0, import_node_fs3.existsSync)(answer.dir)) {
|
|
299
300
|
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)
|
|
301
|
+
if (!overwrite) {
|
|
301
302
|
throw Error;
|
|
303
|
+
}
|
|
302
304
|
}
|
|
303
305
|
answer.version = await (0, import_prompts.input)({
|
|
304
306
|
message: "\u6846\u67B6\u7248\u672C\u53F7\uFF08version\uFF09",
|
|
305
307
|
default: version.latest,
|
|
306
308
|
validate: (input2) => {
|
|
307
|
-
if (!version.list.includes(input2))
|
|
309
|
+
if (!version.list.includes(input2)) {
|
|
308
310
|
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)}.`;
|
|
311
|
+
}
|
|
309
312
|
return true;
|
|
310
313
|
}
|
|
311
314
|
});
|
|
@@ -313,8 +316,9 @@ async function init() {
|
|
|
313
316
|
message: "\u9009\u62E9\u5E94\u7528\u6A21\u5757\uFF08apps\uFF09",
|
|
314
317
|
choices: APPS,
|
|
315
318
|
validate: (input2) => {
|
|
316
|
-
if (input2.length === 0)
|
|
319
|
+
if (input2.length === 0) {
|
|
317
320
|
return "\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u5E94\u7528";
|
|
321
|
+
}
|
|
318
322
|
return true;
|
|
319
323
|
}
|
|
320
324
|
});
|
package/dist/index.js
CHANGED
|
@@ -8,14 +8,10 @@ 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.4",
|
|
12
12
|
description: "\u521D\u59CB\u5316\u9879\u76EE\u6846\u67B6",
|
|
13
13
|
author: "Werheng <werheng.zhang@gmail.com>",
|
|
14
14
|
license: "MIT",
|
|
15
|
-
repository: "https://github.com/werheng/pubinfo-cli",
|
|
16
|
-
bugs: {
|
|
17
|
-
url: "https://github.com/werheng/pubinfo-cli/issues"
|
|
18
|
-
},
|
|
19
15
|
bin: {
|
|
20
16
|
pubinfo: "./dist/index.js"
|
|
21
17
|
},
|
|
@@ -26,7 +22,10 @@ var package_default = {
|
|
|
26
22
|
dev: "tsup --watch src",
|
|
27
23
|
build: "tsup",
|
|
28
24
|
cli: "tsx src/index.ts",
|
|
29
|
-
"cli:clean": "rimraf ./my-app"
|
|
25
|
+
"cli:clean": "rimraf ./my-app",
|
|
26
|
+
clean: "pnpm rimraf node_modules && pnpm rimraf dist && pnpm rimraf .turbo",
|
|
27
|
+
stub: "unbuild --stub",
|
|
28
|
+
lint: "eslint . --cache --fix"
|
|
30
29
|
},
|
|
31
30
|
dependencies: {
|
|
32
31
|
"@inquirer/prompts": "^4.3.3",
|
|
@@ -86,8 +85,9 @@ async function download(options) {
|
|
|
86
85
|
dir: options.dir
|
|
87
86
|
});
|
|
88
87
|
} catch (error) {
|
|
89
|
-
if (error.message.includes(REMOTE_URL))
|
|
88
|
+
if (error.message.includes(REMOTE_URL)) {
|
|
90
89
|
error.message = error.message.replace(REMOTE_URL, "[REMOTE_URL]");
|
|
90
|
+
}
|
|
91
91
|
consola.error(`\u4E0B\u8F7D\u5931\u8D25: ${error.message}`);
|
|
92
92
|
process.exit(1);
|
|
93
93
|
} finally {
|
|
@@ -146,8 +146,9 @@ async function writeJSON(path, json) {
|
|
|
146
146
|
await writeFile(path, stringifyJSON(json));
|
|
147
147
|
}
|
|
148
148
|
function assignValues(target, source) {
|
|
149
|
-
for (const [key, value] of Object.entries(source))
|
|
149
|
+
for (const [key, value] of Object.entries(source)) {
|
|
150
150
|
target[key] = value;
|
|
151
|
+
}
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
// src/rewrite.ts
|
|
@@ -256,8 +257,9 @@ async function fetchData() {
|
|
|
256
257
|
version
|
|
257
258
|
};
|
|
258
259
|
} catch (error) {
|
|
259
|
-
if (error.message.includes(REMOTE_URL))
|
|
260
|
+
if (error.message.includes(REMOTE_URL)) {
|
|
260
261
|
error.message = error.message.replace(REMOTE_URL, "[REMOTE_URL]");
|
|
262
|
+
}
|
|
261
263
|
consola4.error(`\u7F51\u7EDC\u8FDE\u63A5\u5F02\u5E38: ${error.message}`);
|
|
262
264
|
process3.exit(1);
|
|
263
265
|
} finally {
|
|
@@ -274,15 +276,17 @@ async function init() {
|
|
|
274
276
|
answer.key = await input({ message: "\u9879\u76EE\u6807\u8BC6\uFF08key\uFF09", default: answer.dir });
|
|
275
277
|
if (existsSync3(answer.dir)) {
|
|
276
278
|
const overwrite = await confirm({ message: `\u76EE\u5F55 ${colors2.cyan(answer.dir)} \u5DF2\u5B58\u5728\uFF0C\u662F\u5426\u8986\u76D6\uFF1F` });
|
|
277
|
-
if (!overwrite)
|
|
279
|
+
if (!overwrite) {
|
|
278
280
|
throw Error;
|
|
281
|
+
}
|
|
279
282
|
}
|
|
280
283
|
answer.version = await input({
|
|
281
284
|
message: "\u6846\u67B6\u7248\u672C\u53F7\uFF08version\uFF09",
|
|
282
285
|
default: version.latest,
|
|
283
286
|
validate: (input2) => {
|
|
284
|
-
if (!version.list.includes(input2))
|
|
287
|
+
if (!version.list.includes(input2)) {
|
|
285
288
|
return `\u7248\u672C\u53F7: ${colors2.bold(input2)} \u4E0D\u5B58\u5728, \u5F53\u524D\u6700\u65B0\u7248\u672C\u53F7: ${colors2.bold(version.latest)}.`;
|
|
289
|
+
}
|
|
286
290
|
return true;
|
|
287
291
|
}
|
|
288
292
|
});
|
|
@@ -290,8 +294,9 @@ async function init() {
|
|
|
290
294
|
message: "\u9009\u62E9\u5E94\u7528\u6A21\u5757\uFF08apps\uFF09",
|
|
291
295
|
choices: APPS,
|
|
292
296
|
validate: (input2) => {
|
|
293
|
-
if (input2.length === 0)
|
|
297
|
+
if (input2.length === 0) {
|
|
294
298
|
return "\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u5E94\u7528";
|
|
299
|
+
}
|
|
295
300
|
return true;
|
|
296
301
|
}
|
|
297
302
|
});
|
package/package.json
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pubinfo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.4",
|
|
5
5
|
"description": "初始化项目框架",
|
|
6
6
|
"author": "Werheng <werheng.zhang@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"repository": "https://github.com/werheng/pubinfo-cli",
|
|
9
|
-
"bugs": {
|
|
10
|
-
"url": "https://github.com/werheng/pubinfo-cli/issues"
|
|
11
|
-
},
|
|
12
8
|
"bin": {
|
|
13
9
|
"pubinfo": "./dist/index.js"
|
|
14
10
|
},
|
|
@@ -32,6 +28,9 @@
|
|
|
32
28
|
"dev": "tsup --watch src",
|
|
33
29
|
"build": "tsup",
|
|
34
30
|
"cli": "tsx src/index.ts",
|
|
35
|
-
"cli:clean": "rimraf ./my-app"
|
|
31
|
+
"cli:clean": "rimraf ./my-app",
|
|
32
|
+
"clean": "pnpm rimraf node_modules && pnpm rimraf dist && pnpm rimraf .turbo",
|
|
33
|
+
"stub": "unbuild --stub",
|
|
34
|
+
"lint": "eslint . --cache --fix"
|
|
36
35
|
}
|
|
37
36
|
}
|