create-pubinfo 0.3.1 → 0.3.2
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/{chunk-DR5C46L2.js → chunk-6FAJDUJL.js} +6 -4
- package/dist/cli.cjs +13 -7
- package/dist/cli.js +8 -4
- package/dist/index.cjs +6 -4
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -3,12 +3,13 @@ import { downloadTemplate } from "giget";
|
|
|
3
3
|
import consola from "consola";
|
|
4
4
|
|
|
5
5
|
// src/progress.ts
|
|
6
|
+
import process from "node:process";
|
|
6
7
|
import { Presets, SingleBar } from "cli-progress";
|
|
7
8
|
import colors from "ansi-colors";
|
|
8
9
|
import FackProgress from "fake-progress";
|
|
9
10
|
function createMockProgressBar() {
|
|
10
11
|
const fakeProgress = new FackProgress({
|
|
11
|
-
timeConstant:
|
|
12
|
+
timeConstant: 10 * 1e3
|
|
12
13
|
});
|
|
13
14
|
let complete = false;
|
|
14
15
|
const bar = new SingleBar(
|
|
@@ -17,9 +18,10 @@ function createMockProgressBar() {
|
|
|
17
18
|
barCompleteChar: "\u2588",
|
|
18
19
|
barIncompleteChar: "\u2591",
|
|
19
20
|
hideCursor: true,
|
|
20
|
-
linewrap:
|
|
21
|
+
linewrap: true,
|
|
21
22
|
barsize: 40,
|
|
22
|
-
clearOnComplete: true
|
|
23
|
+
clearOnComplete: true,
|
|
24
|
+
stopOnComplete: true
|
|
23
25
|
},
|
|
24
26
|
Presets.shades_classic
|
|
25
27
|
);
|
|
@@ -35,9 +37,9 @@ function createMockProgressBar() {
|
|
|
35
37
|
bar.update(count);
|
|
36
38
|
if (complete) {
|
|
37
39
|
bar.update(100);
|
|
38
|
-
bar.stop();
|
|
39
40
|
console.log(`${colors.bold.green("Download complete in")} ${colors.bold.yellow(`${Date.now() - startTime}`)} ${colors.bold.green("ms.")}`);
|
|
40
41
|
clearInterval(timer);
|
|
42
|
+
process.exit(0);
|
|
41
43
|
}
|
|
42
44
|
}, 100);
|
|
43
45
|
}
|
package/dist/cli.cjs
CHANGED
|
@@ -32,7 +32,7 @@ var import_consola2 = __toESM(require("consola"), 1);
|
|
|
32
32
|
var package_default = {
|
|
33
33
|
name: "create-pubinfo",
|
|
34
34
|
type: "module",
|
|
35
|
-
version: "0.3.
|
|
35
|
+
version: "0.3.2",
|
|
36
36
|
description: "Start a Pubinfo project.",
|
|
37
37
|
author: "Werheng <werheng.zhang@gmail.com>",
|
|
38
38
|
license: "MIT",
|
|
@@ -72,12 +72,13 @@ var import_giget = require("giget");
|
|
|
72
72
|
var import_consola = __toESM(require("consola"), 1);
|
|
73
73
|
|
|
74
74
|
// src/progress.ts
|
|
75
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
75
76
|
var import_cli_progress = require("cli-progress");
|
|
76
77
|
var import_ansi_colors = __toESM(require("ansi-colors"), 1);
|
|
77
78
|
var import_fake_progress = __toESM(require("fake-progress"), 1);
|
|
78
79
|
function createMockProgressBar() {
|
|
79
80
|
const fakeProgress = new import_fake_progress.default({
|
|
80
|
-
timeConstant:
|
|
81
|
+
timeConstant: 10 * 1e3
|
|
81
82
|
});
|
|
82
83
|
let complete = false;
|
|
83
84
|
const bar = new import_cli_progress.SingleBar(
|
|
@@ -86,9 +87,10 @@ function createMockProgressBar() {
|
|
|
86
87
|
barCompleteChar: "\u2588",
|
|
87
88
|
barIncompleteChar: "\u2591",
|
|
88
89
|
hideCursor: true,
|
|
89
|
-
linewrap:
|
|
90
|
+
linewrap: true,
|
|
90
91
|
barsize: 40,
|
|
91
|
-
clearOnComplete: true
|
|
92
|
+
clearOnComplete: true,
|
|
93
|
+
stopOnComplete: true
|
|
92
94
|
},
|
|
93
95
|
import_cli_progress.Presets.shades_classic
|
|
94
96
|
);
|
|
@@ -104,9 +106,9 @@ function createMockProgressBar() {
|
|
|
104
106
|
bar.update(count);
|
|
105
107
|
if (complete) {
|
|
106
108
|
bar.update(100);
|
|
107
|
-
bar.stop();
|
|
108
109
|
console.log(`${import_ansi_colors.default.bold.green("Download complete in")} ${import_ansi_colors.default.bold.yellow(`${Date.now() - startTime}`)} ${import_ansi_colors.default.bold.green("ms.")}`);
|
|
109
110
|
clearInterval(timer);
|
|
111
|
+
import_node_process.default.exit(0);
|
|
110
112
|
}
|
|
111
113
|
}, 100);
|
|
112
114
|
}
|
|
@@ -181,7 +183,11 @@ async function main() {
|
|
|
181
183
|
} catch (error) {
|
|
182
184
|
import_consola2.default.fail("Operation cancelled");
|
|
183
185
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
+
try {
|
|
187
|
+
await download(answer);
|
|
188
|
+
await rewrite(answer);
|
|
189
|
+
} catch (error) {
|
|
190
|
+
import_consola2.default.error(error);
|
|
191
|
+
}
|
|
186
192
|
}
|
|
187
193
|
main();
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
download
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6FAJDUJL.js";
|
|
5
5
|
|
|
6
6
|
// src/cli.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -12,7 +12,7 @@ import consola from "consola";
|
|
|
12
12
|
var package_default = {
|
|
13
13
|
name: "create-pubinfo",
|
|
14
14
|
type: "module",
|
|
15
|
-
version: "0.3.
|
|
15
|
+
version: "0.3.2",
|
|
16
16
|
description: "Start a Pubinfo project.",
|
|
17
17
|
author: "Werheng <werheng.zhang@gmail.com>",
|
|
18
18
|
license: "MIT",
|
|
@@ -86,7 +86,11 @@ async function main() {
|
|
|
86
86
|
} catch (error) {
|
|
87
87
|
consola.fail("Operation cancelled");
|
|
88
88
|
}
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
try {
|
|
90
|
+
await download(answer);
|
|
91
|
+
await rewrite(answer);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
consola.error(error);
|
|
94
|
+
}
|
|
91
95
|
}
|
|
92
96
|
main();
|
package/dist/index.cjs
CHANGED
|
@@ -39,12 +39,13 @@ var import_giget = require("giget");
|
|
|
39
39
|
var import_consola = __toESM(require("consola"), 1);
|
|
40
40
|
|
|
41
41
|
// src/progress.ts
|
|
42
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
42
43
|
var import_cli_progress = require("cli-progress");
|
|
43
44
|
var import_ansi_colors = __toESM(require("ansi-colors"), 1);
|
|
44
45
|
var import_fake_progress = __toESM(require("fake-progress"), 1);
|
|
45
46
|
function createMockProgressBar() {
|
|
46
47
|
const fakeProgress = new import_fake_progress.default({
|
|
47
|
-
timeConstant:
|
|
48
|
+
timeConstant: 10 * 1e3
|
|
48
49
|
});
|
|
49
50
|
let complete = false;
|
|
50
51
|
const bar = new import_cli_progress.SingleBar(
|
|
@@ -53,9 +54,10 @@ function createMockProgressBar() {
|
|
|
53
54
|
barCompleteChar: "\u2588",
|
|
54
55
|
barIncompleteChar: "\u2591",
|
|
55
56
|
hideCursor: true,
|
|
56
|
-
linewrap:
|
|
57
|
+
linewrap: true,
|
|
57
58
|
barsize: 40,
|
|
58
|
-
clearOnComplete: true
|
|
59
|
+
clearOnComplete: true,
|
|
60
|
+
stopOnComplete: true
|
|
59
61
|
},
|
|
60
62
|
import_cli_progress.Presets.shades_classic
|
|
61
63
|
);
|
|
@@ -71,9 +73,9 @@ function createMockProgressBar() {
|
|
|
71
73
|
bar.update(count);
|
|
72
74
|
if (complete) {
|
|
73
75
|
bar.update(100);
|
|
74
|
-
bar.stop();
|
|
75
76
|
console.log(`${import_ansi_colors.default.bold.green("Download complete in")} ${import_ansi_colors.default.bold.yellow(`${Date.now() - startTime}`)} ${import_ansi_colors.default.bold.green("ms.")}`);
|
|
76
77
|
clearInterval(timer);
|
|
78
|
+
import_node_process.default.exit(0);
|
|
77
79
|
}
|
|
78
80
|
}, 100);
|
|
79
81
|
}
|
package/dist/index.js
CHANGED