@vercube/cli 0.0.23 → 0.0.25
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.d.mts +1 -2
- package/dist/index.mjs +27 -40
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export {};
|
|
1
|
+
export { };
|
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { hasTTY } from "std-env";
|
|
|
11
11
|
import { x } from "tinyexec";
|
|
12
12
|
|
|
13
13
|
//#region package.json
|
|
14
|
-
var version = "0.0.
|
|
14
|
+
var version = "0.0.24";
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/commands/build.ts
|
|
@@ -22,12 +22,10 @@ const buildCommand = defineCommand({
|
|
|
22
22
|
},
|
|
23
23
|
args: { entry: {
|
|
24
24
|
type: "string",
|
|
25
|
-
description: "Entry file"
|
|
26
|
-
default: "./src/index.ts"
|
|
25
|
+
description: "Entry file"
|
|
27
26
|
} },
|
|
28
27
|
run: async (ctx) => {
|
|
29
|
-
|
|
30
|
-
await build(app);
|
|
28
|
+
await build(await createVercube({ build: { entry: ctx?.args?.entry ?? void 0 } }));
|
|
31
29
|
}
|
|
32
30
|
});
|
|
33
31
|
|
|
@@ -68,17 +66,12 @@ const icon = [
|
|
|
68
66
|
" "
|
|
69
67
|
];
|
|
70
68
|
function interpolateColor(startColor$1, endColor$1, factor) {
|
|
71
|
-
|
|
72
|
-
const g = Math.round(startColor$1.g + factor * (endColor$1.g - startColor$1.g));
|
|
73
|
-
const b = Math.round(startColor$1.b + factor * (endColor$1.b - startColor$1.b));
|
|
74
|
-
return `\u001B[38;2;${r};${g};${b}m`;
|
|
69
|
+
return `\u001B[38;2;${Math.round(startColor$1.r + factor * (endColor$1.r - startColor$1.r))};${Math.round(startColor$1.g + factor * (endColor$1.g - startColor$1.g))};${Math.round(startColor$1.b + factor * (endColor$1.b - startColor$1.b))}m`;
|
|
75
70
|
}
|
|
76
71
|
function applyGradient(icon$1, startColor$1, endColor$1) {
|
|
77
72
|
const totalLines = icon$1.length;
|
|
78
73
|
return icon$1.map((line, index) => {
|
|
79
|
-
|
|
80
|
-
const color = interpolateColor(startColor$1, endColor$1, factor);
|
|
81
|
-
return color + line;
|
|
74
|
+
return interpolateColor(startColor$1, endColor$1, index / (totalLines - 1)) + line;
|
|
82
75
|
}).join("\n");
|
|
83
76
|
}
|
|
84
77
|
const vercubeIcon = applyGradient(icon, startColor, endColor);
|
|
@@ -88,14 +81,13 @@ const vercubeIcon = applyGradient(icon, startColor, endColor);
|
|
|
88
81
|
const logger = consola.withTag(colors.whiteBright(colors.bold(colors.bgGreenBright(" vercube "))));
|
|
89
82
|
const DEFAULT_REGISTRY = "https://raw.githubusercontent.com/vercube/starter/main/templates";
|
|
90
83
|
const DEFAULT_TEMPLATE_NAME = "vercube";
|
|
91
|
-
const
|
|
84
|
+
const packageManagerOptions = Object.keys({
|
|
92
85
|
npm: void 0,
|
|
93
86
|
pnpm: void 0,
|
|
94
87
|
yarn: void 0,
|
|
95
88
|
bun: void 0,
|
|
96
89
|
deno: void 0
|
|
97
|
-
};
|
|
98
|
-
const packageManagerOptions = Object.keys(pms);
|
|
90
|
+
});
|
|
99
91
|
const initCommand = defineCommand({
|
|
100
92
|
meta: {
|
|
101
93
|
name: "init",
|
|
@@ -141,28 +133,24 @@ const initCommand = defineCommand({
|
|
|
141
133
|
let templateDownloadPath = resolve(cwd, ctx.args.dir);
|
|
142
134
|
logger.info(`Creating a new project in ${colors.cyan(relative(cwd, templateDownloadPath) || templateDownloadPath)}.`);
|
|
143
135
|
let shouldForce = Boolean(ctx.args.force);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}).catch(() => process.exit(1)));
|
|
163
|
-
break;
|
|
164
|
-
default: process.exit(1);
|
|
165
|
-
}
|
|
136
|
+
if (!shouldForce && existsSync(templateDownloadPath)) switch (await logger.prompt(`The directory ${colors.cyan(templateDownloadPath)} already exists. What would you like to do?`, {
|
|
137
|
+
type: "select",
|
|
138
|
+
options: [
|
|
139
|
+
"Override its contents",
|
|
140
|
+
"Select different directory",
|
|
141
|
+
"Abort"
|
|
142
|
+
]
|
|
143
|
+
})) {
|
|
144
|
+
case "Override its contents":
|
|
145
|
+
shouldForce = true;
|
|
146
|
+
break;
|
|
147
|
+
case "Select different directory":
|
|
148
|
+
templateDownloadPath = resolve(cwd, await logger.prompt("Please specify a different directory:", {
|
|
149
|
+
type: "text",
|
|
150
|
+
cancel: "reject"
|
|
151
|
+
}).catch(() => process.exit(1)));
|
|
152
|
+
break;
|
|
153
|
+
default: process.exit(1);
|
|
166
154
|
}
|
|
167
155
|
let template;
|
|
168
156
|
try {
|
|
@@ -228,7 +216,7 @@ const initCommand = defineCommand({
|
|
|
228
216
|
|
|
229
217
|
//#endregion
|
|
230
218
|
//#region src/index.ts
|
|
231
|
-
|
|
219
|
+
runMain(defineCommand({
|
|
232
220
|
meta: {
|
|
233
221
|
name: "Vercube",
|
|
234
222
|
version,
|
|
@@ -239,8 +227,7 @@ const main = defineCommand({
|
|
|
239
227
|
dev: devCommand,
|
|
240
228
|
init: initCommand
|
|
241
229
|
}
|
|
242
|
-
});
|
|
243
|
-
runMain(main);
|
|
230
|
+
}));
|
|
244
231
|
|
|
245
232
|
//#endregion
|
|
246
233
|
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercube/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"description": "CLI module for Vercube framework",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"citty": "0.1.6",
|
|
29
29
|
"consola": "3.4.2",
|
|
30
30
|
"giget": "2.0.0",
|
|
31
|
-
"nypm": "0.6.
|
|
31
|
+
"nypm": "0.6.2",
|
|
32
32
|
"pathe": "2.0.3",
|
|
33
33
|
"std-env": "3.9.0",
|
|
34
34
|
"tinyexec": "1.0.1",
|
|
35
|
-
"@vercube/devkit": "0.0.
|
|
35
|
+
"@vercube/devkit": "0.0.25"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|