@ruan-cat/vercel-deploy-tool 0.4.0 → 0.5.0
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/package.json +2 -1
- package/src/config.ts +7 -0
- package/src/index.ts +24 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ruan-cat/vercel-deploy-tool",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "阮喵喵自用的vercel部署工具,用于实现复杂项目的部署。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"c12": "^1.11.2",
|
|
45
45
|
"commander": "^12.0.0",
|
|
46
46
|
"consola": "^3.2.3",
|
|
47
|
+
"gradient-string": "^3.0.0",
|
|
47
48
|
"lodash-es": "4.17.21",
|
|
48
49
|
"pathe": "^1.1.2",
|
|
49
50
|
"rimraf": "^6.0.1",
|
package/src/config.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ import fs, {
|
|
|
16
16
|
|
|
17
17
|
import { concat, isEmpty, isUndefined } from "lodash-es";
|
|
18
18
|
import { consola } from "consola";
|
|
19
|
+
import gradient from "gradient-string";
|
|
19
20
|
|
|
20
21
|
import {
|
|
21
22
|
isConditionsEvery,
|
|
@@ -169,6 +170,12 @@ function getTargetCWDCommandArgument(deployTarget: DeployTarget) {
|
|
|
169
170
|
*/
|
|
170
171
|
function generateExeca(execaSimpleParams: { command: string; parameters: string[] }) {
|
|
171
172
|
const { command, parameters } = execaSimpleParams;
|
|
173
|
+
|
|
174
|
+
if (config?.isShowCommand) {
|
|
175
|
+
const coloredCommand = gradient(["rgb(0, 153, 247)", "rgb(241, 23, 18)"])(`${command} ${parameters.join(" ")}`);
|
|
176
|
+
consola.info(` 当前运行的命令为: ${coloredCommand} \n`);
|
|
177
|
+
}
|
|
178
|
+
|
|
172
179
|
return generateSimpleAsyncTask(() => spawnSync(command, parameters, { shell: true }));
|
|
173
180
|
}
|
|
174
181
|
|
|
@@ -474,7 +481,9 @@ async function main() {
|
|
|
474
481
|
parameters: [],
|
|
475
482
|
});
|
|
476
483
|
consola.start(` 开始用户命令任务 `);
|
|
477
|
-
const
|
|
484
|
+
const child = await userCommand();
|
|
485
|
+
process.stdout.write(child.stdout);
|
|
486
|
+
process.stderr.write(child.stderr);
|
|
478
487
|
// consola.success(` 完成用户命令任务 ${code} `);
|
|
479
488
|
consola.success(` 完成用户命令任务 `);
|
|
480
489
|
// consola.box(stdout);
|
|
@@ -511,10 +520,23 @@ async function main() {
|
|
|
511
520
|
generateSimpleAsyncTask(async () => {
|
|
512
521
|
const deploy = generateDeployTask(deployTarget);
|
|
513
522
|
consola.start(` 开始部署任务 `);
|
|
514
|
-
const { stdout } = await deploy();
|
|
523
|
+
const { stdout, error, stderr } = await deploy();
|
|
524
|
+
|
|
525
|
+
if (error) {
|
|
526
|
+
consola.error(" 部署失败了 \n");
|
|
527
|
+
consola.error(error);
|
|
528
|
+
process.stderr.write(stderr);
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
|
|
515
532
|
const vercelUrl = stdout.toString();
|
|
516
533
|
consola.success(` 完成部署任务 检查生成的url为 \n `);
|
|
517
534
|
consola.box(vercelUrl);
|
|
535
|
+
|
|
536
|
+
consola.success(` 部署任务输出如下: \n`);
|
|
537
|
+
process.stdout.write(stdout);
|
|
538
|
+
console.log(`\n`);
|
|
539
|
+
|
|
518
540
|
return vercelUrl;
|
|
519
541
|
}),
|
|
520
542
|
|