@ruan-cat/vercel-deploy-tool 0.7.4 → 0.8.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 +3 -3
- package/src/index.ts +17 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ruan-cat/vercel-deploy-tool",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "阮喵喵自用的vercel部署工具,用于实现复杂项目的部署。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"pathe": "^1.1.2",
|
|
51
51
|
"rimraf": "^6.0.1",
|
|
52
52
|
"shx": "^0.3.4",
|
|
53
|
-
"vercel": "
|
|
54
|
-
"@ruan-cat/utils": "^
|
|
53
|
+
"vercel": "^41.2.0",
|
|
54
|
+
"@ruan-cat/utils": "^3.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/gulp": "^4.0.17",
|
package/src/index.ts
CHANGED
|
@@ -140,6 +140,18 @@ function getVercelProjetNameCommandArgument() {
|
|
|
140
140
|
return <const>[`--project=${config.vercelProjetName}`];
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
/**
|
|
144
|
+
* 以命令参数数组的形式,获得范围名称
|
|
145
|
+
* @see https://vercel.com/docs/cli/global-options#scope
|
|
146
|
+
*
|
|
147
|
+
* 为什么传递组织id?
|
|
148
|
+
* 此篇讨论内 使用了组织id
|
|
149
|
+
* @see https://vercel.community/t/deployment-via-gitlab-ci-to-dev-domain/523/3
|
|
150
|
+
*/
|
|
151
|
+
function getVercelScopeCommandArgument() {
|
|
152
|
+
return <const>[`--scope=${config.vercelOrgId}`];
|
|
153
|
+
}
|
|
154
|
+
|
|
143
155
|
/** 以命令参数数组的形式,获得项目token */
|
|
144
156
|
function getVercelTokenCommandArgument() {
|
|
145
157
|
return <const>[`--token=${config.vercelToken}`];
|
|
@@ -352,11 +364,15 @@ function generateCopyDistTasks(deployTarget: WithUserCommands) {
|
|
|
352
364
|
* 旨在于封装类似于这样的命令:
|
|
353
365
|
*
|
|
354
366
|
* vc alias set "$url1" ${{env.p1-url}} -t ${{env.vct}}
|
|
367
|
+
*
|
|
368
|
+
* 封装出类似的命令:
|
|
369
|
+
* vercel alias set $DEPLOYMENT_URL domain2.com --token=$VERCEL_TOKEN --scope=$VERCEL_ORG_ID
|
|
370
|
+
* @see https://vercel.community/t/deployment-via-gitlab-ci-to-dev-domain/523/3
|
|
355
371
|
*/
|
|
356
372
|
function generateAliasTask(vercelUrl: string, userUrl: string) {
|
|
357
373
|
return generateSpawnSync({
|
|
358
374
|
command: `vc alias set ${vercelUrl} ${userUrl}`,
|
|
359
|
-
parameters: concat(getVercelTokenCommandArgument()),
|
|
375
|
+
parameters: concat(getVercelTokenCommandArgument(), getVercelScopeCommandArgument()),
|
|
360
376
|
});
|
|
361
377
|
}
|
|
362
378
|
|