@ruan-cat/vercel-deploy-tool 0.8.18 → 0.9.1
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 → README.md} +7 -5
- package/package.json +2 -2
- package/src/config.ts +10 -0
- package/src/index.ts +12 -2
package/{readme.md → README.md}
RENAMED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# 阮喵喵自用的 vercel 部署工具
|
|
2
2
|
|
|
3
|
+
生成满足 [Vercel Output API (v3)](https://vercel.com/docs/build-output-api)规范的目录结构,并推送到 vercel 平台内。
|
|
4
|
+
|
|
5
|
+
目前仅考虑简单的静态页面,没有实现云函数等功能。
|
|
6
|
+
|
|
3
7
|
## 设计初衷
|
|
4
8
|
|
|
5
9
|
- 优化冗长的 github action 写法。
|
|
@@ -183,11 +187,9 @@ jobs:
|
|
|
183
187
|
|
|
184
188
|
## 路线图
|
|
185
189
|
|
|
186
|
-
- [x]
|
|
190
|
+
- [x] 封装打包命令,`vc deploy` 命令,并赋予生产环境 url。
|
|
187
191
|
- [x] 拆分配置文件到项目根目录,并实现文件读取。
|
|
188
|
-
- [
|
|
189
|
-
- [ ] 本地运行 javascript 文件,测试。
|
|
190
|
-
- [ ] github action 运行产物。
|
|
191
|
-
- [ ] 封装 node 的 bin 命令,发包。
|
|
192
|
+
- [x] github action 运行产物。
|
|
192
193
|
- [x] github action 全局安装新开发的包,实现纯工作流的部署。
|
|
193
194
|
- [x] 去其他项目,自主完成配置与部署。
|
|
195
|
+
- [ ] 封装 node 的 bin 命令,发包。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ruan-cat/vercel-deploy-tool",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "阮喵喵自用的vercel部署工具,用于实现复杂项目的部署。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"pathe": "^2.0.3",
|
|
51
51
|
"rimraf": "^6.0.1",
|
|
52
52
|
"vercel": "^41.3.0",
|
|
53
|
-
"@ruan-cat/utils": "^4.
|
|
53
|
+
"@ruan-cat/utils": "^4.7.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/gulp": "^4.0.17",
|
package/src/config.ts
CHANGED
|
@@ -25,6 +25,16 @@ export type Base = {
|
|
|
25
25
|
|
|
26
26
|
/** 生产环境的访问url */
|
|
27
27
|
url: string[];
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 是否需要vercel的build命令?
|
|
31
|
+
* @description
|
|
32
|
+
* 某些情况下 用户已经能够准备好vercel的目录结构 不需要依赖于 `vercel build` 命令完成目录构建
|
|
33
|
+
*
|
|
34
|
+
* 故设计此配置 允许用户直接跳过 `vercel build` 命令
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
isNeedVercelBuild?: boolean;
|
|
28
38
|
};
|
|
29
39
|
|
|
30
40
|
/**
|
package/src/index.ts
CHANGED
|
@@ -96,6 +96,11 @@ function getIsCopyDist(target: WithUserCommands) {
|
|
|
96
96
|
return target?.isCopyDist ?? true;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
/** isNeedVercelBuild 配置 */
|
|
100
|
+
function isNeedVercelBuild(target: Base) {
|
|
101
|
+
return target?.isNeedVercelBuild ?? true;
|
|
102
|
+
}
|
|
103
|
+
|
|
99
104
|
/** 是否需要移动文件? */
|
|
100
105
|
function isNeedCopyDist(target: DeployTarget) {
|
|
101
106
|
if (isDeployTargetsWithUserCommands(target)) {
|
|
@@ -463,12 +468,17 @@ async function main() {
|
|
|
463
468
|
type: "parallel",
|
|
464
469
|
tasks: deployTargets.map((deployTarget) => {
|
|
465
470
|
return generateSimpleAsyncTask(async () => {
|
|
471
|
+
/** 当前部署目标 是否需要 vercel 的 build 任务? */
|
|
472
|
+
const isNeedBuildTask = isNeedVercelBuild(deployTarget);
|
|
473
|
+
if (!isNeedBuildTask) {
|
|
474
|
+
consola.warn(` 当前部署目标不需要执行build任务 `);
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
|
|
466
478
|
const build = generateBuildTask(deployTarget);
|
|
467
479
|
consola.start(` 开始build任务 `);
|
|
468
480
|
const { stdout } = await build();
|
|
469
481
|
consola.success(` 完成build任务 `);
|
|
470
|
-
// consola.info(` 完成命令 ${code} `);
|
|
471
|
-
// consola.box(stdout);
|
|
472
482
|
});
|
|
473
483
|
}),
|
|
474
484
|
},
|