@ruan-cat/vercel-deploy-tool 0.0.9 → 0.0.11
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 +7 -7
- package/readme.md +32 -8
- package/src/index.ts +5 -5
- package/src/utils/define-promise-tasks.ts +2 -2
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ruan-cat/vercel-deploy-tool",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "阮喵喵自用的vercel部署工具,用于实现复杂项目的部署。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
7
7
|
"types": "./src/index.ts",
|
|
8
|
-
"homepage": "https://github.com/
|
|
8
|
+
"homepage": "https://github.com/ruan-cat/vercel-monorepo-test/tree/main/demos/vercel-deploy-tool",
|
|
9
9
|
"bugs": {
|
|
10
|
-
"url": "https://github.com/
|
|
10
|
+
"url": "https://github.com/ruan-cat/vercel-monorepo-test/issues"
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/
|
|
14
|
+
"url": "git+https://github.com/ruan-cat/vercel-monorepo-test.git",
|
|
15
15
|
"directory": "demos/vercel-deploy-tool"
|
|
16
16
|
},
|
|
17
17
|
"exports": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"author": {
|
|
28
28
|
"name": "ruan-cat",
|
|
29
29
|
"email": "1219043956@qq.com",
|
|
30
|
-
"url": "https://github.com/
|
|
30
|
+
"url": "https://github.com/ruan-cat"
|
|
31
31
|
},
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"publishConfig": {
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"consola": "^3.2.3",
|
|
46
46
|
"cpx": "^1.5.0",
|
|
47
47
|
"execa": "^9.3.1",
|
|
48
|
-
"lodash-es": "
|
|
48
|
+
"lodash-es": "4.17.21",
|
|
49
49
|
"mkdirp": "^3.0.1",
|
|
50
50
|
"pathe": "^1.1.2",
|
|
51
51
|
"rimraf": "^5.0.7",
|
|
52
52
|
"shx": "^0.3.4",
|
|
53
53
|
"vercel": "^34.2.7",
|
|
54
|
-
"@ruan-cat/utils": "^1.0.
|
|
54
|
+
"@ruan-cat/utils": "^1.0.5"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/lodash-es": "^4.17.12",
|
package/readme.md
CHANGED
|
@@ -17,11 +17,35 @@ pnpm i -D @ruan-cat/vercel-deploy-tool@latest
|
|
|
17
17
|
|
|
18
18
|
## 环境要求
|
|
19
19
|
|
|
20
|
-
- node >=
|
|
20
|
+
- node >=20.15.1
|
|
21
21
|
- pnpm >=9
|
|
22
22
|
|
|
23
23
|
## 使用教程
|
|
24
24
|
|
|
25
|
+
### 增加 .gitignore 配置
|
|
26
|
+
|
|
27
|
+
本工具会在根目录内默认生成一个全空配置的 vercel.null.def.json 文件,这个文件应该被忽略。
|
|
28
|
+
|
|
29
|
+
后续的使用会不可避免的使用 vercel 的 api,会在你的项目内生成一个或多个.vercel 文件夹,故.vercel 文件夹也应该被忽略。
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# 忽略vercel本地打包生成的文件
|
|
33
|
+
.vercel
|
|
34
|
+
# 忽略自动生成vercel部署配置文件
|
|
35
|
+
vercel.null.def.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
如果你使用环境变量文件,推荐你加上 dotenv 推荐的环境变量文件忽略。
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# dotenv environment variable files
|
|
42
|
+
.env
|
|
43
|
+
.env.development.local
|
|
44
|
+
.env.test.local
|
|
45
|
+
.env.production.local
|
|
46
|
+
.env.local
|
|
47
|
+
```
|
|
48
|
+
|
|
25
49
|
### 获取 vercel 提供的 id
|
|
26
50
|
|
|
27
51
|
用 [`vc link`](https://vercel.com/guides/how-can-i-use-github-actions-with-vercel) 命令获取 vercelOrgId 和 vercelProjectId。
|
|
@@ -104,16 +128,16 @@ pnpm i -D tsx
|
|
|
104
128
|
```yaml
|
|
105
129
|
name: 自写的vercel部署工具
|
|
106
130
|
env:
|
|
107
|
-
|
|
131
|
+
# 必须密文提供token
|
|
108
132
|
VERCEL_TOKEN: ${{ secrets.vercel_token }}
|
|
109
|
-
|
|
133
|
+
# 可以明文提供组织id和项目id
|
|
110
134
|
# VERCEL_ORG_ID: ${{ secrets.vercel_orgId }}
|
|
111
135
|
# VERCEL_PROJECT_ID: ${{ secrets.vercel_projectId }}
|
|
112
136
|
|
|
113
137
|
on:
|
|
114
138
|
push:
|
|
115
139
|
branches:
|
|
116
|
-
|
|
140
|
+
# 可以自选分支 为了避免过快耗尽vercel额度,建议只在main分支内触发部署
|
|
117
141
|
- main
|
|
118
142
|
|
|
119
143
|
jobs:
|
|
@@ -128,7 +152,7 @@ jobs:
|
|
|
128
152
|
with:
|
|
129
153
|
# 若项目提供了packageManager配置 这里可以不提供该配置
|
|
130
154
|
# version: 9
|
|
131
|
-
|
|
155
|
+
# 必须安装 vercel @dotenvx/dotenvx tsx 这三个全局包
|
|
132
156
|
run_install: |
|
|
133
157
|
- recursive: true
|
|
134
158
|
- args: [--global, "vercel", "@dotenvx/dotenvx", "tsx"]
|
|
@@ -136,7 +160,7 @@ jobs:
|
|
|
136
160
|
- name: 安装node
|
|
137
161
|
uses: actions/setup-node@v4
|
|
138
162
|
with:
|
|
139
|
-
node-version:
|
|
163
|
+
node-version: 20.15.1
|
|
140
164
|
cache: pnpm
|
|
141
165
|
|
|
142
166
|
- name: 检查版本
|
|
@@ -149,9 +173,9 @@ jobs:
|
|
|
149
173
|
run: pnpm ls -g
|
|
150
174
|
|
|
151
175
|
- name: 运行自写的vercel部署工具
|
|
152
|
-
|
|
176
|
+
# 读取环境变量
|
|
153
177
|
# https://dotenvx.com/docs/cis/github-actions#install-dotenvx
|
|
154
|
-
|
|
178
|
+
# pnpm run your-command
|
|
155
179
|
run: |
|
|
156
180
|
curl -sfS https://dotenvx.sh/install.sh | sh
|
|
157
181
|
pnpm dotenvx run -- pnpm run deploy-vercel
|
package/src/index.ts
CHANGED
|
@@ -244,8 +244,8 @@ function generateCopyDistTasks(deployTarget: WithUserCommands) {
|
|
|
244
244
|
parameters: [],
|
|
245
245
|
});
|
|
246
246
|
const { code, stdout } = await commandFunction();
|
|
247
|
-
consola.info(`
|
|
248
|
-
consola.box(stdout);
|
|
247
|
+
consola.info(` 执行了命令 🐓: `, command);
|
|
248
|
+
// consola.box(stdout);
|
|
249
249
|
});
|
|
250
250
|
});
|
|
251
251
|
|
|
@@ -311,7 +311,7 @@ function generateAfterBuildTasksConfig(config: Config): Task {
|
|
|
311
311
|
consola.start(` 开始用户 afterBuildTasks 命令任务 `);
|
|
312
312
|
const { code, stdout } = await userCommand();
|
|
313
313
|
consola.success(` 完成用户 afterBuildTasks 命令任务 ${code} `);
|
|
314
|
-
consola.box(stdout);
|
|
314
|
+
// consola.box(stdout);
|
|
315
315
|
});
|
|
316
316
|
}),
|
|
317
317
|
};
|
|
@@ -355,7 +355,7 @@ async function main() {
|
|
|
355
355
|
const { code, stdout } = await build();
|
|
356
356
|
consola.success(` 完成build任务 `);
|
|
357
357
|
consola.info(` 完成命令 ${code} `);
|
|
358
|
-
consola.box(stdout);
|
|
358
|
+
// consola.box(stdout);
|
|
359
359
|
});
|
|
360
360
|
}),
|
|
361
361
|
},
|
|
@@ -388,7 +388,7 @@ async function main() {
|
|
|
388
388
|
consola.start(` 开始用户命令任务 `);
|
|
389
389
|
const { code, stdout } = await userCommand();
|
|
390
390
|
consola.success(` 完成用户命令任务 ${code} `);
|
|
391
|
-
consola.box(stdout);
|
|
391
|
+
// consola.box(stdout);
|
|
392
392
|
});
|
|
393
393
|
}),
|
|
394
394
|
},
|
|
@@ -125,11 +125,11 @@ export async function executePromiseTasks(
|
|
|
125
125
|
|
|
126
126
|
res = await task(lastParams);
|
|
127
127
|
lastParams = res;
|
|
128
|
-
console.log(` 串行任务 单独 res `, res);
|
|
128
|
+
// console.log(` 串行任务 单独 res `, res);
|
|
129
129
|
} else {
|
|
130
130
|
res = await executePromiseTasks(task, lastParams);
|
|
131
131
|
lastParams = res;
|
|
132
|
-
console.log(` 串行任务 配置 res `, res);
|
|
132
|
+
// console.log(` 串行任务 配置 res `, res);
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
|