esa-cli 0.0.2-beta.22 → 0.0.2-beta.23
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 +31 -149
- package/dist/commands/commit/index.js +2 -2
- package/dist/commands/common/constant.js +4 -4
- package/dist/commands/common/utils.js +2 -2
- package/dist/commands/config.js +1 -1
- package/dist/commands/deploy/index.js +2 -2
- package/dist/commands/deployments/index.js +1 -1
- package/dist/commands/dev/ew2/kvService.js +0 -2
- package/dist/commands/dev/index.js +2 -2
- package/dist/commands/domain/add.js +2 -2
- package/dist/commands/domain/index.js +2 -2
- package/dist/commands/route/index.js +2 -2
- package/dist/commands/routine/delete.js +7 -6
- package/dist/commands/routine/index.js +4 -3
- package/dist/commands/routine/list.js +3 -3
- package/dist/commands/site/index.js +1 -1
- package/dist/commands/utils.js +1 -1
- package/dist/docs/Commands_en.md +110 -74
- package/dist/docs/Commands_zh_CN.md +110 -74
- package/dist/i18n/locales.json +56 -56
- package/dist/index.js +2 -2
- package/dist/libs/logger.js +5 -5
- package/dist/utils/checkDevPort.js +2 -2
- package/dist/utils/checkIsRoutineCreated.js +1 -1
- package/dist/utils/download.js +1 -1
- package/dist/utils/installDeno.js +1 -1
- package/dist/utils/installEw2.js +2 -2
- package/package.json +3 -2
- package/zh_CN.md +28 -154
package/dist/i18n/locales.json
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
"zh_CN": "提交代码,保存为一个版本"
|
|
5
5
|
},
|
|
6
6
|
"commit_er_not_exist": {
|
|
7
|
-
"en": "No
|
|
7
|
+
"en": "No Functions& Pages found, creating a new one",
|
|
8
8
|
"zh_CN": "没有找到任何函数,正在创建新函数"
|
|
9
9
|
},
|
|
10
10
|
"commit_er_description": {
|
|
11
|
-
"en": "Enter a description for
|
|
11
|
+
"en": "Enter a description for Functions& Pages",
|
|
12
12
|
"zh_CN": "请输入函数的描述"
|
|
13
13
|
},
|
|
14
14
|
"commit_version_description": {
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"zh_CN": "发生错误"
|
|
21
21
|
},
|
|
22
22
|
"commit_create_er_success": {
|
|
23
|
-
"en": "
|
|
24
|
-
"zh_CN": "
|
|
23
|
+
"en": "Functions& Pages created successfully.",
|
|
24
|
+
"zh_CN": "函数和Pages创建成功。"
|
|
25
25
|
},
|
|
26
26
|
"commit_upload_success": {
|
|
27
27
|
"en": "Code uploaded successfully.",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"zh_CN": "提交代码时发生错误。"
|
|
37
37
|
},
|
|
38
38
|
"summery_cd": {
|
|
39
|
-
"en": "Enter your
|
|
40
|
-
"zh_CN": "
|
|
39
|
+
"en": "Enter your project folder",
|
|
40
|
+
"zh_CN": "进入您的项目文件夹"
|
|
41
41
|
},
|
|
42
42
|
"summery_commit": {
|
|
43
43
|
"en": "Save a new version of code",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"zh_CN": "生产环境"
|
|
77
77
|
},
|
|
78
78
|
"deploy_description_routine": {
|
|
79
|
-
"en": "Enter the description of
|
|
80
|
-
"zh_CN": "
|
|
79
|
+
"en": "Enter the description of Functions& Pages",
|
|
80
|
+
"zh_CN": "请输入函数和Pages的描述"
|
|
81
81
|
},
|
|
82
82
|
"deploy_description_version": {
|
|
83
83
|
"en": "Enter the description of the code version",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"zh_CN": "请选择您要发布的版本"
|
|
93
93
|
},
|
|
94
94
|
"deploy_spec_select": {
|
|
95
|
-
"en": "Please select the spec of
|
|
95
|
+
"en": "Please select the spec of Functions& Pages you want to create",
|
|
96
96
|
"zh_CN": "请选择您要创建的函数规格"
|
|
97
97
|
},
|
|
98
98
|
"deploy_create_formal_version_ques": {
|
|
@@ -136,8 +136,8 @@
|
|
|
136
136
|
"zh_CN": "显示帮助"
|
|
137
137
|
},
|
|
138
138
|
"commit_create_er_fail": {
|
|
139
|
-
"en": "An error occurred while trying to create
|
|
140
|
-
"zh_CN": "
|
|
139
|
+
"en": "An error occurred while trying to create Functions& Pages",
|
|
140
|
+
"zh_CN": "创建函数和Pages时发生错误"
|
|
141
141
|
},
|
|
142
142
|
"commit_upload_fail": {
|
|
143
143
|
"en": "An error occurred while trying to upload your code",
|
|
@@ -164,8 +164,8 @@
|
|
|
164
164
|
"zh_CN": "帮助"
|
|
165
165
|
},
|
|
166
166
|
"common_sub_command_fail": {
|
|
167
|
-
"en": "Use esa <command> -h to see help",
|
|
168
|
-
"zh_CN": "使用 esa <command> -h 查看帮助"
|
|
167
|
+
"en": "Use esa-cli <command> -h to see help",
|
|
168
|
+
"zh_CN": "使用 esa-cli <command> -h 查看帮助"
|
|
169
169
|
},
|
|
170
170
|
"deployments_delete_describe": {
|
|
171
171
|
"en": "Delete one or more deployment versions",
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
"zh_CN": "构建完成"
|
|
193
193
|
},
|
|
194
194
|
"dev_describe": {
|
|
195
|
-
"en": "Start a local server for developing your
|
|
195
|
+
"en": "Start a local server for developing your project",
|
|
196
196
|
"zh_CN": "启动本地调试"
|
|
197
197
|
},
|
|
198
198
|
"dev_port_describe": {
|
|
@@ -224,20 +224,20 @@
|
|
|
224
224
|
"zh_CN": "Worker server 已重启"
|
|
225
225
|
},
|
|
226
226
|
"domain_add_describe": {
|
|
227
|
-
"en": "Bind a domain to
|
|
228
|
-
"zh_CN": "
|
|
227
|
+
"en": "Bind a domain to your project",
|
|
228
|
+
"zh_CN": "绑定域名到函数和Pages"
|
|
229
229
|
},
|
|
230
230
|
"domain_describe": {
|
|
231
|
-
"en": "Manage the domain names bound to your
|
|
232
|
-
"zh_CN": "
|
|
231
|
+
"en": "Manage the domain names bound to your project",
|
|
232
|
+
"zh_CN": "管理绑定到函数和Pages的域名"
|
|
233
233
|
},
|
|
234
234
|
"delete_describe": {
|
|
235
|
-
"en": "Delete a
|
|
236
|
-
"zh_CN": "
|
|
235
|
+
"en": "Delete a project",
|
|
236
|
+
"zh_CN": "删除一个函数和Pages"
|
|
237
237
|
},
|
|
238
238
|
"delete_routineName_positional_describe": {
|
|
239
|
-
"en": "The name of the
|
|
240
|
-
"zh_CN": "
|
|
239
|
+
"en": "The name of the project to delete",
|
|
240
|
+
"zh_CN": "要删除的函数和Pages名称"
|
|
241
241
|
},
|
|
242
242
|
"delete_success": {
|
|
243
243
|
"en": "Delete success!",
|
|
@@ -281,7 +281,7 @@
|
|
|
281
281
|
},
|
|
282
282
|
"init_input_name": {
|
|
283
283
|
"en": "Enter the name of edgeRoutine:",
|
|
284
|
-
"zh_CN": "
|
|
284
|
+
"zh_CN": "输入项目的名称"
|
|
285
285
|
},
|
|
286
286
|
"init_skip_git": {
|
|
287
287
|
"en": "Git installation was skipped.",
|
|
@@ -292,8 +292,8 @@
|
|
|
292
292
|
"zh_CN": "切换为中文"
|
|
293
293
|
},
|
|
294
294
|
"list_describe": {
|
|
295
|
-
"en": "List all your
|
|
296
|
-
"zh_CN": "
|
|
295
|
+
"en": "List all your projects",
|
|
296
|
+
"zh_CN": "查看所有函数和Pages"
|
|
297
297
|
},
|
|
298
298
|
"list_deployment_positional_describe": {
|
|
299
299
|
"en": "(Optional) ID or URL of the deployment to tail. Specify by environment if deployment ID is unknown.",
|
|
@@ -308,8 +308,8 @@
|
|
|
308
308
|
"zh_CN": "查看所有站点名称"
|
|
309
309
|
},
|
|
310
310
|
"list_routine_name_title": {
|
|
311
|
-
"en": "List all of
|
|
312
|
-
"zh_CN": "
|
|
311
|
+
"en": "List all of Functions& Pages",
|
|
312
|
+
"zh_CN": "查看所有函数和Pages项目"
|
|
313
313
|
},
|
|
314
314
|
"login_describe": {
|
|
315
315
|
"en": "Login to the server",
|
|
@@ -353,7 +353,7 @@
|
|
|
353
353
|
},
|
|
354
354
|
"route_add_describe": {
|
|
355
355
|
"en": "Bind a Route to a routine",
|
|
356
|
-
"zh_CN": "
|
|
356
|
+
"zh_CN": "将路由绑定到函数和Pages"
|
|
357
357
|
},
|
|
358
358
|
"route_add_route_describe": {
|
|
359
359
|
"en": "The name of route to add",
|
|
@@ -404,8 +404,8 @@
|
|
|
404
404
|
"zh_CN": "路由删除失败!"
|
|
405
405
|
},
|
|
406
406
|
"route_describe": {
|
|
407
|
-
"en": "Manage the routes bound to your
|
|
408
|
-
"zh_CN": "
|
|
407
|
+
"en": "Manage the routes bound to your project",
|
|
408
|
+
"zh_CN": "管理绑定到函数和Pages的路由"
|
|
409
409
|
},
|
|
410
410
|
"route_list_describe": {
|
|
411
411
|
"en": "List all related routes",
|
|
@@ -468,8 +468,8 @@
|
|
|
468
468
|
"zh_CN": "用这个命令登录:${namedCommand}"
|
|
469
469
|
},
|
|
470
470
|
"routine_describe": {
|
|
471
|
-
"en": "Manage your
|
|
472
|
-
"zh_CN": "
|
|
471
|
+
"en": "Manage your project",
|
|
472
|
+
"zh_CN": "管理函数和Pages"
|
|
473
473
|
},
|
|
474
474
|
"route_input": {
|
|
475
475
|
"en": "Enter a Route:",
|
|
@@ -484,8 +484,8 @@
|
|
|
484
484
|
"zh_CN": "我们的Runtime还不支持此操作系统,我们暂时使用Deno作为本地开发runtime,需要先安装。"
|
|
485
485
|
},
|
|
486
486
|
"install_runtime_tip": {
|
|
487
|
-
"en": "🔔 Runtime must be installed to use esa dev. Installing...",
|
|
488
|
-
"zh_CN": "必须安装Runtime才能使用 esa dev。正在安装..."
|
|
487
|
+
"en": "🔔 Runtime must be installed to use esa-cli dev. Installing...",
|
|
488
|
+
"zh_CN": "必须安装Runtime才能使用 esa-cli dev。正在安装..."
|
|
489
489
|
},
|
|
490
490
|
"install_runtime_success": {
|
|
491
491
|
"en": "Runtime installed.",
|
|
@@ -505,7 +505,7 @@
|
|
|
505
505
|
},
|
|
506
506
|
"deploy_first_time": {
|
|
507
507
|
"en": "This is first time to deploy. Let's create a version first!",
|
|
508
|
-
"zh_CN": "
|
|
508
|
+
"zh_CN": "这是您第一次部署此函数和Pages,请先创建一个版本"
|
|
509
509
|
},
|
|
510
510
|
"deploy_select_version": {
|
|
511
511
|
"en": "Select which version you'd like to deploy",
|
|
@@ -572,11 +572,11 @@
|
|
|
572
572
|
"zh_CN": "上传前压缩代码"
|
|
573
573
|
},
|
|
574
574
|
"commit_option_description": {
|
|
575
|
-
"en": "Description for
|
|
575
|
+
"en": "Description for Functions& Pages/version (skip interactive input)",
|
|
576
576
|
"zh_CN": "函数/版本的描述(跳过交互式输入)"
|
|
577
577
|
},
|
|
578
578
|
"dev_entry_describe": {
|
|
579
|
-
"en": "Entry file of
|
|
579
|
+
"en": "Entry file of Functions& Pages",
|
|
580
580
|
"zh_CN": "入口文件路径"
|
|
581
581
|
},
|
|
582
582
|
"dev_option_minify": {
|
|
@@ -732,7 +732,7 @@
|
|
|
732
732
|
"zh_CN": " 版本ID 版本描述"
|
|
733
733
|
},
|
|
734
734
|
"commit_er_exist": {
|
|
735
|
-
"en": "
|
|
735
|
+
"en": "Functions& Pages exists, updating the code",
|
|
736
736
|
"zh_CN": "边缘函数已存在,已更新代码"
|
|
737
737
|
},
|
|
738
738
|
"domain_add_invalid_name": {
|
|
@@ -792,7 +792,7 @@
|
|
|
792
792
|
"zh_CN": "您想要部署您的项目吗?"
|
|
793
793
|
},
|
|
794
794
|
"first_deploy": {
|
|
795
|
-
"en": "This is the first time to deploy, we will create a new
|
|
795
|
+
"en": "This is the first time to deploy, we will create a new project for you.",
|
|
796
796
|
"zh_CN": "这是第一次部署,我们将为您创建一个新的函数。"
|
|
797
797
|
},
|
|
798
798
|
"no_formal_version_found": {
|
|
@@ -809,7 +809,7 @@
|
|
|
809
809
|
},
|
|
810
810
|
"routine_not_exist": {
|
|
811
811
|
"en": "Routine does not exist, please create a new one. Run command:",
|
|
812
|
-
"zh_CN": "
|
|
812
|
+
"zh_CN": "函数和Pages不存在,请创建一个新函数和Pages项目。运行命令:"
|
|
813
813
|
},
|
|
814
814
|
"dev_input_inspect_tip1": {
|
|
815
815
|
"en": "👉 Please visit ${inspectLink} in the Chrome browser",
|
|
@@ -824,7 +824,7 @@
|
|
|
824
824
|
"zh_CN": "域名生效可能需要一段时间,请稍后再试。"
|
|
825
825
|
},
|
|
826
826
|
"deploy_quick_describe": {
|
|
827
|
-
"en": "Quick deploy
|
|
827
|
+
"en": "Quick deploy Functions& Pages to production environment",
|
|
828
828
|
"zh_CN": "快速部署到生产环境"
|
|
829
829
|
},
|
|
830
830
|
"deploy_option_version": {
|
|
@@ -968,8 +968,8 @@
|
|
|
968
968
|
"zh_CN": "输出debug日志"
|
|
969
969
|
},
|
|
970
970
|
"install_runtime_update_tip": {
|
|
971
|
-
"en": "🔔 Runtime must be update to use esa dev. Installing...",
|
|
972
|
-
"zh_CN": "必须更新Runtime才能使用 esa dev。正在安装..."
|
|
971
|
+
"en": "🔔 Runtime must be update to use esa-cli dev. Installing...",
|
|
972
|
+
"zh_CN": "必须更新Runtime才能使用 esa-cli dev。正在安装..."
|
|
973
973
|
},
|
|
974
974
|
"dev_ip_not_allowed": {
|
|
975
975
|
"en": "Direct access to IP addresses is not allowed when setting local-upstream: ${url}",
|
|
@@ -1012,12 +1012,12 @@
|
|
|
1012
1012
|
"zh_CN": "用户取消了操作。"
|
|
1013
1013
|
},
|
|
1014
1014
|
"routine_create_success": {
|
|
1015
|
-
"en": "
|
|
1016
|
-
"zh_CN": "
|
|
1015
|
+
"en": "Project created successfully.",
|
|
1016
|
+
"zh_CN": "函数和Pages创建成功"
|
|
1017
1017
|
},
|
|
1018
1018
|
"routine_create_fail": {
|
|
1019
|
-
"en": "
|
|
1020
|
-
"zh_CN": "
|
|
1019
|
+
"en": "Project created failed.",
|
|
1020
|
+
"zh_CN": "函数和Pages创建失败"
|
|
1021
1021
|
},
|
|
1022
1022
|
"create_route_route": {
|
|
1023
1023
|
"en": "Enter a Route (e.g., example.com/*):",
|
|
@@ -1108,27 +1108,27 @@
|
|
|
1108
1108
|
"zh_CN": "站点 \"${siteName}\" 未找到"
|
|
1109
1109
|
},
|
|
1110
1110
|
"commit_assets_exist": {
|
|
1111
|
-
"en": "This is a
|
|
1112
|
-
"zh_CN": "
|
|
1111
|
+
"en": "This is a Functions& Pages with assets project",
|
|
1112
|
+
"zh_CN": "这是一个带静态资源的函数和Pages项目"
|
|
1113
1113
|
},
|
|
1114
1114
|
"commit_routine_with_assets_success": {
|
|
1115
|
-
"en": "
|
|
1116
|
-
"zh_CN": "
|
|
1115
|
+
"en": "Functions& Pages with assets code version committed successfully.",
|
|
1116
|
+
"zh_CN": "带静态资源的函数和Pages代码版本提交成功。"
|
|
1117
1117
|
},
|
|
1118
1118
|
"commit_routine_with_assets_fail": {
|
|
1119
|
-
"en": "An error occurred while trying to commit your
|
|
1120
|
-
"zh_CN": "
|
|
1119
|
+
"en": "An error occurred while trying to commit your Functions& Pages with assets.",
|
|
1120
|
+
"zh_CN": "提交带静态资源的函数和Pages时发生错误。"
|
|
1121
1121
|
},
|
|
1122
1122
|
"commit_option_assets": {
|
|
1123
1123
|
"en": "Assets directory",
|
|
1124
1124
|
"zh_CN": "静态资源目录"
|
|
1125
1125
|
},
|
|
1126
1126
|
"commit_option_name": {
|
|
1127
|
-
"en": "
|
|
1127
|
+
"en": "Functions& Pages name",
|
|
1128
1128
|
"zh_CN": "边缘函数名称"
|
|
1129
1129
|
},
|
|
1130
1130
|
"deploy_option_name": {
|
|
1131
|
-
"en": "Name of
|
|
1131
|
+
"en": "Name of Functions& Pages",
|
|
1132
1132
|
"zh_CN": "边缘函数名称"
|
|
1133
1133
|
},
|
|
1134
1134
|
"deploy_option_assets": {
|
|
@@ -1272,7 +1272,7 @@
|
|
|
1272
1272
|
"zh_CN": "全局更新失败。你可能需要更高权限(sudo)或使用 yarn/pnpm:"
|
|
1273
1273
|
},
|
|
1274
1274
|
"deploy_option_keyword": {
|
|
1275
|
-
"en": "Keyword to search for
|
|
1275
|
+
"en": "Keyword to search for projects",
|
|
1276
1276
|
"zh_CN": ""
|
|
1277
1277
|
},
|
|
1278
1278
|
"route_input_method": {
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ const main = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
34
34
|
.fail((msg, err) => {
|
|
35
35
|
console.error(msg, err);
|
|
36
36
|
})
|
|
37
|
-
.scriptName('esa')
|
|
37
|
+
.scriptName('esa-cli')
|
|
38
38
|
.locale((cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.lang) || 'en')
|
|
39
39
|
.version(false)
|
|
40
40
|
.wrap(null)
|
|
@@ -61,7 +61,7 @@ const main = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
61
61
|
esa.command('*', false, () => { }, (args) => {
|
|
62
62
|
if (args._.length > 0) {
|
|
63
63
|
// Unknown command
|
|
64
|
-
console.error(t('common_sub_command_fail').d('Use esa <command> -h to see help'));
|
|
64
|
+
console.error(t('common_sub_command_fail').d('Use esa-cli <command> -h to see help'));
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
67
|
if (args.v) {
|
package/dist/libs/logger.js
CHANGED
|
@@ -179,7 +179,7 @@ class Logger {
|
|
|
179
179
|
this.error('Missing ESA project configuration (esa.jsonc or esa.toml)');
|
|
180
180
|
this.block();
|
|
181
181
|
this.log('If there is code to deploy, you can either:');
|
|
182
|
-
this.subLog(`- Specify an entry-point to your Routine via the command line (ex: ${chalk.green('esa deploy src/index.ts')})`);
|
|
182
|
+
this.subLog(`- Specify an entry-point to your Routine via the command line (ex: ${chalk.green('esa-cli deploy src/index.ts')})`);
|
|
183
183
|
this.subLog('- Or create an "esa.jsonc" file (recommended):');
|
|
184
184
|
console.log('```jsonc\n' +
|
|
185
185
|
'{\n' +
|
|
@@ -197,7 +197,7 @@ class Logger {
|
|
|
197
197
|
'port = 18080\n' +
|
|
198
198
|
'```\n');
|
|
199
199
|
this.log('If you are deploying a directory of static assets, you can either:');
|
|
200
|
-
this.subLog(`- Create an "esa.jsonc" file (recommended) and run ${chalk.green('esa deploy -a ./dist')}`);
|
|
200
|
+
this.subLog(`- Create an "esa.jsonc" file (recommended) and run ${chalk.green('esa-cli deploy -a ./dist')}`);
|
|
201
201
|
console.log('```jsonc\n' +
|
|
202
202
|
'{\n' +
|
|
203
203
|
' "name": "my-routine",\n' +
|
|
@@ -206,7 +206,7 @@ class Logger {
|
|
|
206
206
|
' }\n' +
|
|
207
207
|
'}\n' +
|
|
208
208
|
'```');
|
|
209
|
-
this.subLog(`- Or create an "esa.toml" file and run ${chalk.green('esa deploy -a ./dist')}`);
|
|
209
|
+
this.subLog(`- Or create an "esa.toml" file and run ${chalk.green('esa-cli deploy -a ./dist')}`);
|
|
210
210
|
console.log('```toml\n' +
|
|
211
211
|
'name = "my-routine"\n' +
|
|
212
212
|
'\n' +
|
|
@@ -214,14 +214,14 @@ class Logger {
|
|
|
214
214
|
'directory = "./dist"\n' +
|
|
215
215
|
'```\n');
|
|
216
216
|
this.log('Alternatively, initialize a new ESA project:');
|
|
217
|
-
this.log(chalk.green('$ esa init my-
|
|
217
|
+
this.log(chalk.green('$ esa-cli init my-project'));
|
|
218
218
|
this.block();
|
|
219
219
|
}
|
|
220
220
|
pathEacces(localPath) {
|
|
221
221
|
this.block();
|
|
222
222
|
this.log(chalk.yellow(t('common_eacces_intro', { localPath }).d(`You do not have permission to ${localPath}, please use`)));
|
|
223
223
|
this.block();
|
|
224
|
-
this.log(chalk.green(`$ ${chalk.red('sudo')} esa <Command>`));
|
|
224
|
+
this.log(chalk.green(`$ ${chalk.red('sudo')} esa-cli <Command>`));
|
|
225
225
|
this.block();
|
|
226
226
|
this.subLog(chalk.yellow('OR'));
|
|
227
227
|
this.block();
|
|
@@ -62,7 +62,7 @@ const checkAndInputPort = (port, inspectPort) => __awaiter(void 0, void 0, void
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
catch (_) {
|
|
65
|
-
const option = chalk.green('esa dev --port <port>');
|
|
65
|
+
const option = chalk.green('esa-cli dev --port <port>');
|
|
66
66
|
logger.log(t('dev_port_used_advice', { option }).d(`You can use ${option} to specify another port.`));
|
|
67
67
|
throw new Error('Specified port already in use.');
|
|
68
68
|
}
|
|
@@ -88,7 +88,7 @@ const checkAndInputPort = (port, inspectPort) => __awaiter(void 0, void 0, void
|
|
|
88
88
|
])).port;
|
|
89
89
|
}
|
|
90
90
|
catch (_) {
|
|
91
|
-
const option = chalk.green('esa dev --inspect-port <port>');
|
|
91
|
+
const option = chalk.green('esa-cli dev --inspect-port <port>');
|
|
92
92
|
logger.log(t('dev_port_used_advice', { option }).d(`You can use ${option} to specify another port.`));
|
|
93
93
|
throw new Error('Inspect port already in use.');
|
|
94
94
|
}
|
|
@@ -25,7 +25,7 @@ export function validRoutine(name) {
|
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
26
|
const isCreatedRoutine = yield isRoutineExist(name);
|
|
27
27
|
if (!isCreatedRoutine) {
|
|
28
|
-
logger.warn(`${t('routine_not_exist').d('Routine does not exist, please create a new one. Run command:')} ${chalk.greenBright('esa deploy')}`);
|
|
28
|
+
logger.warn(`${t('routine_not_exist').d('Routine does not exist, please create a new one. Run command:')} ${chalk.greenBright('esa-cli deploy')}`);
|
|
29
29
|
exit(1);
|
|
30
30
|
}
|
|
31
31
|
});
|
package/dist/utils/download.js
CHANGED
|
@@ -169,7 +169,7 @@ export function downloadRuntimeAndUnzipForWindows() {
|
|
|
169
169
|
}
|
|
170
170
|
logger.success(t('deno_install_success').d('Runtime install success!'));
|
|
171
171
|
logger.block();
|
|
172
|
-
const dev = chalk.green('esa dev');
|
|
172
|
+
const dev = chalk.green('esa-cli dev');
|
|
173
173
|
logger.log(t('deno_install_success_tips', { dev }).d(`Please run ${dev} again`));
|
|
174
174
|
}
|
|
175
175
|
catch (error) {
|
|
@@ -66,7 +66,7 @@ export function installDeno() {
|
|
|
66
66
|
default:
|
|
67
67
|
installCommand = `sh ${p}/install.sh`;
|
|
68
68
|
}
|
|
69
|
-
logger.warn(t('install_runtime_tip').d(`🔔 Runtime must be installed to use esa dev. Installing...`));
|
|
69
|
+
logger.warn(t('install_runtime_tip').d(`🔔 Runtime must be installed to use esa-cli dev. Installing...`));
|
|
70
70
|
try {
|
|
71
71
|
execSync(installCommand, { stdio: 'inherit' });
|
|
72
72
|
logger.success(t('install_runtime_success').d(`Runtime installed.`));
|
package/dist/utils/installEw2.js
CHANGED
|
@@ -43,7 +43,7 @@ export function preCheckEw2() {
|
|
|
43
43
|
try {
|
|
44
44
|
yield fsAccess(EW2BinPath, fs.constants.X_OK);
|
|
45
45
|
if (!manifestRes.isLatest) {
|
|
46
|
-
logger.warn(t('install_runtime_update_tip').d(`🔔 Runtime must be update to use esa dev. Installing...`));
|
|
46
|
+
logger.warn(t('install_runtime_update_tip').d(`🔔 Runtime must be update to use esa-cli dev. Installing...`));
|
|
47
47
|
return yield installVersion(manifestRes.remoteManifest);
|
|
48
48
|
}
|
|
49
49
|
return true;
|
|
@@ -55,7 +55,7 @@ export function preCheckEw2() {
|
|
|
55
55
|
return false;
|
|
56
56
|
}
|
|
57
57
|
if (err.code === 'ENOENT' || err.code === 'EPERM') {
|
|
58
|
-
logger.warn(t('install_runtime_tip').d(`🔔 Runtime must be installed to use esa dev. Installing...`));
|
|
58
|
+
logger.warn(t('install_runtime_tip').d(`🔔 Runtime must be installed to use esa-cli dev. Installing...`));
|
|
59
59
|
return yield installVersion(manifestRes.remoteManifest);
|
|
60
60
|
}
|
|
61
61
|
logger.error(err.message);
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "esa-cli",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.23",
|
|
4
4
|
"description": "A CLI for operating Alibaba Cloud ESA EdgeRoutine (Edge Functions).",
|
|
5
5
|
"main": "bin/enter.cjs",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"esa": "bin/enter.cjs"
|
|
8
|
+
"esa": "bin/enter.cjs",
|
|
9
|
+
"esa-cli": "bin/enter.cjs"
|
|
9
10
|
},
|
|
10
11
|
"files": [
|
|
11
12
|
"bin",
|
package/zh_CN.md
CHANGED
|
@@ -1,176 +1,50 @@
|
|
|
1
|
-
# ESA CLI
|
|
1
|
+
# 安装/更新 ESA CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ESA CLI 是用于构建阿里云 ESA Functions 与 Pages 的命令行工具。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<p>
|
|
6
|
+
<a href="https://discord.gg/xygV6MYx">
|
|
7
|
+
<img alt="Discord 中文" src="https://img.shields.io/badge/Discord-中文-5865F2?logo=discord&logoColor=white" />
|
|
8
|
+
</a>
|
|
9
|
+
<a href="https://discord.gg/YeFg4yUA" style="margin-left:8px;">
|
|
10
|
+
<img alt="Discord English" src="https://img.shields.io/badge/Discord-English-5865F2?logo=discord&logoColor=white" />
|
|
11
|
+
</a>
|
|
12
|
+
</p>
|
|
6
13
|
|
|
7
|
-
|
|
14
|
+
## 安装 ESA CLI
|
|
8
15
|
|
|
9
|
-
|
|
10
|
-
- [边缘函数概述](https://help.aliyun.com/document_detail/2710021.html)
|
|
16
|
+
### 前置条件
|
|
11
17
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
我们正在积极改进,并欢迎任何反馈。感谢您的理解与支持!
|
|
18
|
+
- Node.js:18.x 或更高(支持 18.x、20.x、22.x)
|
|
19
|
+
- 操作系统:macOS (Apple Silicon)、Linux
|
|
20
|
+
- 推荐使用 Volta 或 nvm 等 Node 版本管理工具,避免权限问题并便于切换版本
|
|
16
21
|
|
|
17
22
|
## 安装
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
$ npm install esa-cli -g # 全局安装
|
|
23
|
-
$ esa -v # 查看版本
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## 使用指南
|
|
27
|
-
|
|
28
|
-
### 1. 初始化Routine项目
|
|
24
|
+
为确保团队协作的一致性,建议在项目中将 `esa-cli` 安装为开发依赖,以便团队成员使用相同版本。
|
|
29
25
|
|
|
30
|
-
```bash
|
|
31
|
-
& esa init
|
|
32
26
|
```
|
|
33
|
-
|
|
34
|
-
初始化命令有完整的流程引导,根据提示输入项目名称、选择模板即可。
|
|
35
|
-
|
|
36
|
-
### 2. 开始本地调试
|
|
37
|
-
|
|
38
|
-
本地调试功能是 CLI 的核心,提供了比阿里云 ESA 控制台更便捷的调试体验。
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
& cd <Project Name>
|
|
42
|
-
& esa dev [options]
|
|
27
|
+
npm i -D esa-cli@latest
|
|
43
28
|
```
|
|
44
29
|
|
|
45
|
-
|
|
30
|
+
当尚未安装 `esa-cli` 时,`npx` 会从注册表拉取并运行最新版本。
|
|
46
31
|
|
|
47
|
-
|
|
32
|
+
## 查看 ESA CLI 版本
|
|
48
33
|
|
|
49
|
-
```javascript
|
|
50
|
-
const html = `<!DOCTYPE html>
|
|
51
|
-
<body>
|
|
52
|
-
<h1>Hello World!</h1>
|
|
53
|
-
</body>`;
|
|
54
|
-
|
|
55
|
-
async function handleRequest(request) {
|
|
56
|
-
return new Response(html, {
|
|
57
|
-
headers: {
|
|
58
|
-
'content-type': 'text/html;charset=UTF-8'
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default {
|
|
64
|
-
async fetch(event) {
|
|
65
|
-
return event.respondWith(handleRequest(event));
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
34
|
```
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
#### 本地调试
|
|
73
|
-
|
|
74
|
-
执行 `esa dev` 后,会自动打包入口文件,并启动本地调试服务,界面样式如下:
|
|
75
|
-
|
|
76
|
-

|
|
77
|
-
|
|
78
|
-
- 在界面上按 `b` 即可在浏览器中打开调试页面。
|
|
79
|
-
- 在界面上按 `c` 可以清空面板。
|
|
80
|
-
- 在界面上按 `x` 可以退出调试。
|
|
81
|
-
- 可以用 `esa dev --port <port>` 临时指定端口,也可以使用 `esa config -l` 按照项目配置端口。
|
|
82
|
-
|
|
83
|
-
### 3. 登录阿里云账号
|
|
84
|
-
|
|
85
|
-
需要先登录阿里云账号,才能进行远程管理操作。
|
|
86
|
-
|
|
87
|
-
首先请访问[阿里云RAM控制台](https://ram.console.aliyun.com/manage/ak)获取您的AccessKey ID和AccessKey Secret,再执行`esa login`根据提示输入。
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
& esa login # 登录
|
|
91
|
-
& esa logout # 登出
|
|
35
|
+
npx esa-cli --version
|
|
36
|
+
# 或
|
|
37
|
+
npx esa-cli -v
|
|
92
38
|
```
|
|
93
39
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
当本地调试完成后,需要生成一个代码版本用于部署。
|
|
40
|
+
## 更新 ESA CLI
|
|
97
41
|
|
|
98
|
-
```bash
|
|
99
|
-
& esa commit # 生成版本
|
|
100
42
|
```
|
|
101
|
-
|
|
102
|
-
### 5. 部署到环境 & 管理版本与部署
|
|
103
|
-
|
|
104
|
-
当代码版本生成后,需要部署到边缘节点。
|
|
105
|
-
|
|
106
|
-
通过`esa deployments [script]`命令可以管理版本与部署情况。
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
& esa deploy # 根据提示选择版本、目标环境即可部署
|
|
110
|
-
& esa deployments list # 查看部署情况
|
|
111
|
-
& esa deployments delete <versionId> # 删除版本
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
_注意:已经被部署的版本无法删除。_
|
|
115
|
-
|
|
116
|
-
### 6. 管理触发器
|
|
117
|
-
|
|
118
|
-
当被部署到节点后,您可以配置触发器,通过触发器可以访问您的边缘函数。触发器有两种:
|
|
119
|
-
|
|
120
|
-
- 域名:为您的函数绑定域名,该域名必须是您ESA站点的子域名,您可以通过域名直接访问到该函数,此时边缘函数将作为该域名的源站。
|
|
121
|
-
- 路由:为您的ESA站点绑定函数路由,访问该路由可触发边缘函数执行,此时边缘函数可以和站点的源站进行通信。
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
# 域名
|
|
125
|
-
& esa domain list
|
|
126
|
-
& esa domain add <domainName> # 需要是您的已备案域名
|
|
127
|
-
& esa domain delete <domainName>
|
|
128
|
-
|
|
129
|
-
# 路由
|
|
130
|
-
& esa route list
|
|
131
|
-
& esa route add [route] [site]
|
|
132
|
-
& esa route delete <route>
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### 7. 管理函数
|
|
136
|
-
|
|
137
|
-
可以通过CLI查看、删除Routine函数。
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
& esa routine list # 查看函数
|
|
141
|
-
& esa routine delete <routineName> # 删除函数
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## 命令
|
|
145
|
-
|
|
146
|
-
查看[命令](./docs/Commands.md)
|
|
147
|
-
|
|
148
|
-
## 配置文件
|
|
149
|
-
|
|
150
|
-
### 全局配置
|
|
151
|
-
|
|
152
|
-
```toml
|
|
153
|
-
endpoint = "" # ESA API Endpoint
|
|
154
|
-
lang = "zh_CN" # 语言
|
|
155
|
-
|
|
156
|
-
[auth]
|
|
157
|
-
accessKeyId = "" # AccessKey ID
|
|
158
|
-
accessKeySecret = "" # AccessKey Secret
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### 项目配置
|
|
162
|
-
|
|
163
|
-
```toml
|
|
164
|
-
name = "Hello World" # 项目名称
|
|
165
|
-
description = "Hello World" # 项目描述
|
|
166
|
-
entry = "src/index.js" # 入口文件
|
|
167
|
-
codeVersions = [ ] # 代码版本
|
|
168
|
-
|
|
169
|
-
[dev]
|
|
170
|
-
port = 18080 # 调试端口
|
|
171
|
-
localUpstream = '' # 本地调试上游源站,会替换掉回源时当前的origin
|
|
43
|
+
npm i -D esa-cli@latest
|
|
172
44
|
```
|
|
173
45
|
|
|
174
|
-
##
|
|
46
|
+
## 相关文档
|
|
175
47
|
|
|
176
|
-
[
|
|
48
|
+
- [esa-cli 命令](./docs/Commands_zh_CN.md)
|
|
49
|
+
- [阿里云 ESA 文档](https://help.aliyun.com/document_detail/2710021.html)
|
|
50
|
+
- [Functions 和 Pages API 参考](https://help.aliyun.com/document_detail/2710024.html)
|