create-pubinfo 0.3.0 → 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/README.md +1 -1
- package/dist/chunk-6FAJDUJL.js +80 -0
- package/dist/cli.cjs +106 -36
- package/dist/cli.js +55 -13
- package/dist/index.cjs +53 -25
- package/dist/index.js +1 -1
- package/package.json +13 -6
- package/dist/chunk-DRJ7EKPP.js +0 -52
package/README.md
CHANGED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// src/download.ts
|
|
2
|
+
import { downloadTemplate } from "giget";
|
|
3
|
+
import consola from "consola";
|
|
4
|
+
|
|
5
|
+
// src/progress.ts
|
|
6
|
+
import process from "node:process";
|
|
7
|
+
import { Presets, SingleBar } from "cli-progress";
|
|
8
|
+
import colors from "ansi-colors";
|
|
9
|
+
import FackProgress from "fake-progress";
|
|
10
|
+
function createMockProgressBar() {
|
|
11
|
+
const fakeProgress = new FackProgress({
|
|
12
|
+
timeConstant: 10 * 1e3
|
|
13
|
+
});
|
|
14
|
+
let complete = false;
|
|
15
|
+
const bar = new SingleBar(
|
|
16
|
+
{
|
|
17
|
+
format: `${colors.bold.green("Download:")} ${colors.blueBright("{bar}")}| {percentage}% || {value}/{total} || Speed: {speed}`,
|
|
18
|
+
barCompleteChar: "\u2588",
|
|
19
|
+
barIncompleteChar: "\u2591",
|
|
20
|
+
hideCursor: true,
|
|
21
|
+
linewrap: true,
|
|
22
|
+
barsize: 40,
|
|
23
|
+
clearOnComplete: true,
|
|
24
|
+
stopOnComplete: true
|
|
25
|
+
},
|
|
26
|
+
Presets.shades_classic
|
|
27
|
+
);
|
|
28
|
+
function interval() {
|
|
29
|
+
const startTime = Date.now();
|
|
30
|
+
fakeProgress.start();
|
|
31
|
+
console.log("\n");
|
|
32
|
+
bar.start(100, 0, {
|
|
33
|
+
speed: "N/A"
|
|
34
|
+
});
|
|
35
|
+
const timer = setInterval(() => {
|
|
36
|
+
const count = Number((fakeProgress.progress * 100).toFixed(0));
|
|
37
|
+
bar.update(count);
|
|
38
|
+
if (complete) {
|
|
39
|
+
bar.update(100);
|
|
40
|
+
console.log(`${colors.bold.green("Download complete in")} ${colors.bold.yellow(`${Date.now() - startTime}`)} ${colors.bold.green("ms.")}`);
|
|
41
|
+
clearInterval(timer);
|
|
42
|
+
process.exit(0);
|
|
43
|
+
}
|
|
44
|
+
}, 100);
|
|
45
|
+
}
|
|
46
|
+
function stop() {
|
|
47
|
+
complete = true;
|
|
48
|
+
}
|
|
49
|
+
interval();
|
|
50
|
+
return stop;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/download.ts
|
|
54
|
+
var pubinfo = async (input, { auth }) => {
|
|
55
|
+
return {
|
|
56
|
+
name: "pubinfo",
|
|
57
|
+
version: input,
|
|
58
|
+
headers: { Authorization: `token ${auth}` },
|
|
59
|
+
tar: "http://124.223.184.245:10000/monorepo-project-template.tar.gz"
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
async function download(options = {}) {
|
|
63
|
+
const stop = createMockProgressBar();
|
|
64
|
+
try {
|
|
65
|
+
await downloadTemplate("pubinfo:monorepo-project-template", {
|
|
66
|
+
providers: { pubinfo },
|
|
67
|
+
force: true,
|
|
68
|
+
auth: options.auth,
|
|
69
|
+
dir: options.dir
|
|
70
|
+
});
|
|
71
|
+
} catch (error) {
|
|
72
|
+
consola.error(error);
|
|
73
|
+
} finally {
|
|
74
|
+
stop();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
download
|
|
80
|
+
};
|
package/dist/cli.cjs
CHANGED
|
@@ -26,12 +26,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
// src/cli.ts
|
|
27
27
|
var import_commander = require("commander");
|
|
28
28
|
var import_prompts = require("@inquirer/prompts");
|
|
29
|
+
var import_consola2 = __toESM(require("consola"), 1);
|
|
29
30
|
|
|
30
31
|
// package.json
|
|
31
32
|
var package_default = {
|
|
32
33
|
name: "create-pubinfo",
|
|
33
34
|
type: "module",
|
|
34
|
-
version: "0.3.
|
|
35
|
+
version: "0.3.2",
|
|
35
36
|
description: "Start a Pubinfo project.",
|
|
36
37
|
author: "Werheng <werheng.zhang@gmail.com>",
|
|
37
38
|
license: "MIT",
|
|
@@ -39,31 +40,86 @@ var package_default = {
|
|
|
39
40
|
bugs: {
|
|
40
41
|
url: "https://github.com/werheng/pubinfo-cli/issues"
|
|
41
42
|
},
|
|
42
|
-
bin:
|
|
43
|
-
"create-pubinfo": "./dist/cli.js"
|
|
44
|
-
},
|
|
43
|
+
bin: "./dist/cli.js",
|
|
45
44
|
files: [
|
|
46
45
|
"dist"
|
|
47
46
|
],
|
|
48
47
|
scripts: {
|
|
49
48
|
dev: "tsup --watch src",
|
|
50
|
-
build: "tsup"
|
|
49
|
+
build: "tsup",
|
|
50
|
+
cli: "tsx src/cli.ts"
|
|
51
51
|
},
|
|
52
52
|
dependencies: {
|
|
53
53
|
"@inquirer/prompts": "^4.3.1",
|
|
54
|
+
"ansi-colors": "^4.1.3",
|
|
55
|
+
boxen: "^7.1.1",
|
|
56
|
+
cfonts: "^3.2.0",
|
|
57
|
+
"cli-progress": "^3.12.0",
|
|
54
58
|
commander: "^12.0.0",
|
|
55
59
|
consola: "^3.2.3",
|
|
56
60
|
"fake-progress": "^1.0.4",
|
|
57
61
|
giget: "^1.2.3",
|
|
58
|
-
progress: "^2.0.3"
|
|
62
|
+
progress: "^2.0.3",
|
|
63
|
+
radash: "^12.1.0"
|
|
64
|
+
},
|
|
65
|
+
devDependencies: {
|
|
66
|
+
"@types/cli-progress": "^3.11.5"
|
|
59
67
|
}
|
|
60
68
|
};
|
|
61
69
|
|
|
62
70
|
// src/download.ts
|
|
63
71
|
var import_giget = require("giget");
|
|
64
|
-
var import_progress = __toESM(require("progress"), 1);
|
|
65
|
-
var import_fake_progress = __toESM(require("fake-progress"), 1);
|
|
66
72
|
var import_consola = __toESM(require("consola"), 1);
|
|
73
|
+
|
|
74
|
+
// src/progress.ts
|
|
75
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
76
|
+
var import_cli_progress = require("cli-progress");
|
|
77
|
+
var import_ansi_colors = __toESM(require("ansi-colors"), 1);
|
|
78
|
+
var import_fake_progress = __toESM(require("fake-progress"), 1);
|
|
79
|
+
function createMockProgressBar() {
|
|
80
|
+
const fakeProgress = new import_fake_progress.default({
|
|
81
|
+
timeConstant: 10 * 1e3
|
|
82
|
+
});
|
|
83
|
+
let complete = false;
|
|
84
|
+
const bar = new import_cli_progress.SingleBar(
|
|
85
|
+
{
|
|
86
|
+
format: `${import_ansi_colors.default.bold.green("Download:")} ${import_ansi_colors.default.blueBright("{bar}")}| {percentage}% || {value}/{total} || Speed: {speed}`,
|
|
87
|
+
barCompleteChar: "\u2588",
|
|
88
|
+
barIncompleteChar: "\u2591",
|
|
89
|
+
hideCursor: true,
|
|
90
|
+
linewrap: true,
|
|
91
|
+
barsize: 40,
|
|
92
|
+
clearOnComplete: true,
|
|
93
|
+
stopOnComplete: true
|
|
94
|
+
},
|
|
95
|
+
import_cli_progress.Presets.shades_classic
|
|
96
|
+
);
|
|
97
|
+
function interval() {
|
|
98
|
+
const startTime = Date.now();
|
|
99
|
+
fakeProgress.start();
|
|
100
|
+
console.log("\n");
|
|
101
|
+
bar.start(100, 0, {
|
|
102
|
+
speed: "N/A"
|
|
103
|
+
});
|
|
104
|
+
const timer = setInterval(() => {
|
|
105
|
+
const count = Number((fakeProgress.progress * 100).toFixed(0));
|
|
106
|
+
bar.update(count);
|
|
107
|
+
if (complete) {
|
|
108
|
+
bar.update(100);
|
|
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.")}`);
|
|
110
|
+
clearInterval(timer);
|
|
111
|
+
import_node_process.default.exit(0);
|
|
112
|
+
}
|
|
113
|
+
}, 100);
|
|
114
|
+
}
|
|
115
|
+
function stop() {
|
|
116
|
+
complete = true;
|
|
117
|
+
}
|
|
118
|
+
interval();
|
|
119
|
+
return stop;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/download.ts
|
|
67
123
|
var pubinfo = async (input2, { auth }) => {
|
|
68
124
|
return {
|
|
69
125
|
name: "pubinfo",
|
|
@@ -73,7 +129,7 @@ var pubinfo = async (input2, { auth }) => {
|
|
|
73
129
|
};
|
|
74
130
|
};
|
|
75
131
|
async function download(options = {}) {
|
|
76
|
-
const stop =
|
|
132
|
+
const stop = createMockProgressBar();
|
|
77
133
|
try {
|
|
78
134
|
await (0, import_giget.downloadTemplate)("pubinfo:monorepo-project-template", {
|
|
79
135
|
providers: { pubinfo },
|
|
@@ -83,29 +139,35 @@ async function download(options = {}) {
|
|
|
83
139
|
});
|
|
84
140
|
} catch (error) {
|
|
85
141
|
import_consola.default.error(error);
|
|
142
|
+
} finally {
|
|
143
|
+
stop();
|
|
86
144
|
}
|
|
87
|
-
stop();
|
|
88
145
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
146
|
+
|
|
147
|
+
// src/rewrite.ts
|
|
148
|
+
async function rewrite(_) {
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// src/log.ts
|
|
152
|
+
var import_cfonts = __toESM(require("cfonts"), 1);
|
|
153
|
+
function bootstrop() {
|
|
154
|
+
printLoGo("PUBINFO");
|
|
155
|
+
function printLoGo(logo) {
|
|
156
|
+
import_cfonts.default.say(logo, {
|
|
157
|
+
font: "simple3d",
|
|
158
|
+
align: "left",
|
|
159
|
+
background: "transparent",
|
|
160
|
+
letterSpacing: 1,
|
|
161
|
+
lineHeight: 1,
|
|
162
|
+
space: true,
|
|
163
|
+
maxLength: 0,
|
|
164
|
+
spaceless: false,
|
|
165
|
+
gradient: ["blue", "magenta"],
|
|
166
|
+
independentGradient: false,
|
|
167
|
+
transitionGradient: false,
|
|
168
|
+
env: "node"
|
|
169
|
+
});
|
|
170
|
+
}
|
|
109
171
|
}
|
|
110
172
|
|
|
111
173
|
// src/cli.ts
|
|
@@ -113,11 +175,19 @@ async function main() {
|
|
|
113
175
|
const program = new import_commander.Command();
|
|
114
176
|
program.name(package_default.name).description(package_default.description).version(package_default.version);
|
|
115
177
|
program.parse();
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
})
|
|
178
|
+
bootstrop();
|
|
179
|
+
const answer = {};
|
|
180
|
+
try {
|
|
181
|
+
answer.dir = await (0, import_prompts.input)({ message: "\u8BF7\u8F93\u5165\u76EE\u5F55\u540D\u79F0", default: "my-app" });
|
|
182
|
+
answer.key = await (0, import_prompts.input)({ message: "\u8BF7\u8F93\u5165\u9879\u76EE\u6807\u8BC6(key)", default: answer.dir });
|
|
183
|
+
} catch (error) {
|
|
184
|
+
import_consola2.default.fail("Operation cancelled");
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
await download(answer);
|
|
188
|
+
await rewrite(answer);
|
|
189
|
+
} catch (error) {
|
|
190
|
+
import_consola2.default.error(error);
|
|
191
|
+
}
|
|
122
192
|
}
|
|
123
193
|
main();
|
package/dist/cli.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
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";
|
|
8
8
|
import { input } from "@inquirer/prompts";
|
|
9
|
+
import consola from "consola";
|
|
9
10
|
|
|
10
11
|
// package.json
|
|
11
12
|
var package_default = {
|
|
12
13
|
name: "create-pubinfo",
|
|
13
14
|
type: "module",
|
|
14
|
-
version: "0.3.
|
|
15
|
+
version: "0.3.2",
|
|
15
16
|
description: "Start a Pubinfo project.",
|
|
16
17
|
author: "Werheng <werheng.zhang@gmail.com>",
|
|
17
18
|
license: "MIT",
|
|
@@ -19,36 +20,77 @@ var package_default = {
|
|
|
19
20
|
bugs: {
|
|
20
21
|
url: "https://github.com/werheng/pubinfo-cli/issues"
|
|
21
22
|
},
|
|
22
|
-
bin:
|
|
23
|
-
"create-pubinfo": "./dist/cli.js"
|
|
24
|
-
},
|
|
23
|
+
bin: "./dist/cli.js",
|
|
25
24
|
files: [
|
|
26
25
|
"dist"
|
|
27
26
|
],
|
|
28
27
|
scripts: {
|
|
29
28
|
dev: "tsup --watch src",
|
|
30
|
-
build: "tsup"
|
|
29
|
+
build: "tsup",
|
|
30
|
+
cli: "tsx src/cli.ts"
|
|
31
31
|
},
|
|
32
32
|
dependencies: {
|
|
33
33
|
"@inquirer/prompts": "^4.3.1",
|
|
34
|
+
"ansi-colors": "^4.1.3",
|
|
35
|
+
boxen: "^7.1.1",
|
|
36
|
+
cfonts: "^3.2.0",
|
|
37
|
+
"cli-progress": "^3.12.0",
|
|
34
38
|
commander: "^12.0.0",
|
|
35
39
|
consola: "^3.2.3",
|
|
36
40
|
"fake-progress": "^1.0.4",
|
|
37
41
|
giget: "^1.2.3",
|
|
38
|
-
progress: "^2.0.3"
|
|
42
|
+
progress: "^2.0.3",
|
|
43
|
+
radash: "^12.1.0"
|
|
44
|
+
},
|
|
45
|
+
devDependencies: {
|
|
46
|
+
"@types/cli-progress": "^3.11.5"
|
|
39
47
|
}
|
|
40
48
|
};
|
|
41
49
|
|
|
50
|
+
// src/rewrite.ts
|
|
51
|
+
async function rewrite(_) {
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/log.ts
|
|
55
|
+
import fonts from "cfonts";
|
|
56
|
+
function bootstrop() {
|
|
57
|
+
printLoGo("PUBINFO");
|
|
58
|
+
function printLoGo(logo) {
|
|
59
|
+
fonts.say(logo, {
|
|
60
|
+
font: "simple3d",
|
|
61
|
+
align: "left",
|
|
62
|
+
background: "transparent",
|
|
63
|
+
letterSpacing: 1,
|
|
64
|
+
lineHeight: 1,
|
|
65
|
+
space: true,
|
|
66
|
+
maxLength: 0,
|
|
67
|
+
spaceless: false,
|
|
68
|
+
gradient: ["blue", "magenta"],
|
|
69
|
+
independentGradient: false,
|
|
70
|
+
transitionGradient: false,
|
|
71
|
+
env: "node"
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
42
76
|
// src/cli.ts
|
|
43
77
|
async function main() {
|
|
44
78
|
const program = new Command();
|
|
45
79
|
program.name(package_default.name).description(package_default.description).version(package_default.version);
|
|
46
80
|
program.parse();
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
})
|
|
81
|
+
bootstrop();
|
|
82
|
+
const answer = {};
|
|
83
|
+
try {
|
|
84
|
+
answer.dir = await input({ message: "\u8BF7\u8F93\u5165\u76EE\u5F55\u540D\u79F0", default: "my-app" });
|
|
85
|
+
answer.key = await input({ message: "\u8BF7\u8F93\u5165\u9879\u76EE\u6807\u8BC6(key)", default: answer.dir });
|
|
86
|
+
} catch (error) {
|
|
87
|
+
consola.fail("Operation cancelled");
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
await download(answer);
|
|
91
|
+
await rewrite(answer);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
consola.error(error);
|
|
94
|
+
}
|
|
53
95
|
}
|
|
54
96
|
main();
|
package/dist/index.cjs
CHANGED
|
@@ -36,9 +36,57 @@ module.exports = __toCommonJS(src_exports);
|
|
|
36
36
|
|
|
37
37
|
// src/download.ts
|
|
38
38
|
var import_giget = require("giget");
|
|
39
|
-
var import_progress = __toESM(require("progress"), 1);
|
|
40
|
-
var import_fake_progress = __toESM(require("fake-progress"), 1);
|
|
41
39
|
var import_consola = __toESM(require("consola"), 1);
|
|
40
|
+
|
|
41
|
+
// src/progress.ts
|
|
42
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
43
|
+
var import_cli_progress = require("cli-progress");
|
|
44
|
+
var import_ansi_colors = __toESM(require("ansi-colors"), 1);
|
|
45
|
+
var import_fake_progress = __toESM(require("fake-progress"), 1);
|
|
46
|
+
function createMockProgressBar() {
|
|
47
|
+
const fakeProgress = new import_fake_progress.default({
|
|
48
|
+
timeConstant: 10 * 1e3
|
|
49
|
+
});
|
|
50
|
+
let complete = false;
|
|
51
|
+
const bar = new import_cli_progress.SingleBar(
|
|
52
|
+
{
|
|
53
|
+
format: `${import_ansi_colors.default.bold.green("Download:")} ${import_ansi_colors.default.blueBright("{bar}")}| {percentage}% || {value}/{total} || Speed: {speed}`,
|
|
54
|
+
barCompleteChar: "\u2588",
|
|
55
|
+
barIncompleteChar: "\u2591",
|
|
56
|
+
hideCursor: true,
|
|
57
|
+
linewrap: true,
|
|
58
|
+
barsize: 40,
|
|
59
|
+
clearOnComplete: true,
|
|
60
|
+
stopOnComplete: true
|
|
61
|
+
},
|
|
62
|
+
import_cli_progress.Presets.shades_classic
|
|
63
|
+
);
|
|
64
|
+
function interval() {
|
|
65
|
+
const startTime = Date.now();
|
|
66
|
+
fakeProgress.start();
|
|
67
|
+
console.log("\n");
|
|
68
|
+
bar.start(100, 0, {
|
|
69
|
+
speed: "N/A"
|
|
70
|
+
});
|
|
71
|
+
const timer = setInterval(() => {
|
|
72
|
+
const count = Number((fakeProgress.progress * 100).toFixed(0));
|
|
73
|
+
bar.update(count);
|
|
74
|
+
if (complete) {
|
|
75
|
+
bar.update(100);
|
|
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.")}`);
|
|
77
|
+
clearInterval(timer);
|
|
78
|
+
import_node_process.default.exit(0);
|
|
79
|
+
}
|
|
80
|
+
}, 100);
|
|
81
|
+
}
|
|
82
|
+
function stop() {
|
|
83
|
+
complete = true;
|
|
84
|
+
}
|
|
85
|
+
interval();
|
|
86
|
+
return stop;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// src/download.ts
|
|
42
90
|
var pubinfo = async (input, { auth }) => {
|
|
43
91
|
return {
|
|
44
92
|
name: "pubinfo",
|
|
@@ -48,7 +96,7 @@ var pubinfo = async (input, { auth }) => {
|
|
|
48
96
|
};
|
|
49
97
|
};
|
|
50
98
|
async function download(options = {}) {
|
|
51
|
-
const stop =
|
|
99
|
+
const stop = createMockProgressBar();
|
|
52
100
|
try {
|
|
53
101
|
await (0, import_giget.downloadTemplate)("pubinfo:monorepo-project-template", {
|
|
54
102
|
providers: { pubinfo },
|
|
@@ -58,29 +106,9 @@ async function download(options = {}) {
|
|
|
58
106
|
});
|
|
59
107
|
} catch (error) {
|
|
60
108
|
import_consola.default.error(error);
|
|
109
|
+
} finally {
|
|
110
|
+
stop();
|
|
61
111
|
}
|
|
62
|
-
stop();
|
|
63
|
-
}
|
|
64
|
-
function startProgress() {
|
|
65
|
-
const bar = new import_progress.default("Downloading [:bar] :percent", {
|
|
66
|
-
complete: "=",
|
|
67
|
-
incomplete: " ",
|
|
68
|
-
width: 20,
|
|
69
|
-
total: 100
|
|
70
|
-
});
|
|
71
|
-
const fake = new import_fake_progress.default({
|
|
72
|
-
timeConstant: 5 * 1e3
|
|
73
|
-
});
|
|
74
|
-
const startTime = Date.now();
|
|
75
|
-
fake.start();
|
|
76
|
-
const timer = setInterval(() => {
|
|
77
|
-
bar.update(fake.progress);
|
|
78
|
-
if (bar.complete) {
|
|
79
|
-
import_consola.default.success(`Download complete in ${Date.now() - startTime}ms.`);
|
|
80
|
-
clearInterval(timer);
|
|
81
|
-
}
|
|
82
|
-
}, 100);
|
|
83
|
-
return () => fake.end();
|
|
84
112
|
}
|
|
85
113
|
// Annotate the CommonJS export names for ESM import in node:
|
|
86
114
|
0 && (module.exports = {
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pubinfo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.2",
|
|
5
5
|
"description": "Start a Pubinfo project.",
|
|
6
6
|
"author": "Werheng <werheng.zhang@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -9,22 +9,29 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/werheng/pubinfo-cli/issues"
|
|
11
11
|
},
|
|
12
|
-
"bin":
|
|
13
|
-
"create-pubinfo": "./dist/cli.js"
|
|
14
|
-
},
|
|
12
|
+
"bin": "./dist/cli.js",
|
|
15
13
|
"files": [
|
|
16
14
|
"dist"
|
|
17
15
|
],
|
|
18
16
|
"dependencies": {
|
|
19
17
|
"@inquirer/prompts": "^4.3.1",
|
|
18
|
+
"ansi-colors": "^4.1.3",
|
|
19
|
+
"boxen": "^7.1.1",
|
|
20
|
+
"cfonts": "^3.2.0",
|
|
21
|
+
"cli-progress": "^3.12.0",
|
|
20
22
|
"commander": "^12.0.0",
|
|
21
23
|
"consola": "^3.2.3",
|
|
22
24
|
"fake-progress": "^1.0.4",
|
|
23
25
|
"giget": "^1.2.3",
|
|
24
|
-
"progress": "^2.0.3"
|
|
26
|
+
"progress": "^2.0.3",
|
|
27
|
+
"radash": "^12.1.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/cli-progress": "^3.11.5"
|
|
25
31
|
},
|
|
26
32
|
"scripts": {
|
|
27
33
|
"dev": "tsup --watch src",
|
|
28
|
-
"build": "tsup"
|
|
34
|
+
"build": "tsup",
|
|
35
|
+
"cli": "tsx src/cli.ts"
|
|
29
36
|
}
|
|
30
37
|
}
|
package/dist/chunk-DRJ7EKPP.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// src/download.ts
|
|
2
|
-
import { downloadTemplate } from "giget";
|
|
3
|
-
import ProgressBar from "progress";
|
|
4
|
-
import FackProgress from "fake-progress";
|
|
5
|
-
import consola from "consola";
|
|
6
|
-
var pubinfo = async (input, { auth }) => {
|
|
7
|
-
return {
|
|
8
|
-
name: "pubinfo",
|
|
9
|
-
version: input,
|
|
10
|
-
headers: { Authorization: `token ${auth}` },
|
|
11
|
-
tar: "http://124.223.184.245:10000/monorepo-project-template.tar.gz"
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
async function download(options = {}) {
|
|
15
|
-
const stop = startProgress();
|
|
16
|
-
try {
|
|
17
|
-
await downloadTemplate("pubinfo:monorepo-project-template", {
|
|
18
|
-
providers: { pubinfo },
|
|
19
|
-
force: true,
|
|
20
|
-
auth: options.auth,
|
|
21
|
-
dir: options.dir
|
|
22
|
-
});
|
|
23
|
-
} catch (error) {
|
|
24
|
-
consola.error(error);
|
|
25
|
-
}
|
|
26
|
-
stop();
|
|
27
|
-
}
|
|
28
|
-
function startProgress() {
|
|
29
|
-
const bar = new ProgressBar("Downloading [:bar] :percent", {
|
|
30
|
-
complete: "=",
|
|
31
|
-
incomplete: " ",
|
|
32
|
-
width: 20,
|
|
33
|
-
total: 100
|
|
34
|
-
});
|
|
35
|
-
const fake = new FackProgress({
|
|
36
|
-
timeConstant: 5 * 1e3
|
|
37
|
-
});
|
|
38
|
-
const startTime = Date.now();
|
|
39
|
-
fake.start();
|
|
40
|
-
const timer = setInterval(() => {
|
|
41
|
-
bar.update(fake.progress);
|
|
42
|
-
if (bar.complete) {
|
|
43
|
-
consola.success(`Download complete in ${Date.now() - startTime}ms.`);
|
|
44
|
-
clearInterval(timer);
|
|
45
|
-
}
|
|
46
|
-
}, 100);
|
|
47
|
-
return () => fake.end();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
download
|
|
52
|
-
};
|