esa-cli 0.0.2-beta.13 → 0.0.2-beta.15
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/dist/commands/commit/index.js +22 -4
- package/dist/commands/common/{routineUtils.js → utils.js} +104 -58
- package/dist/commands/deploy/index.js +11 -51
- package/dist/commands/init/helper.js +482 -6
- package/dist/commands/init/index.js +62 -530
- package/dist/commands/init/snippets/nextjs/next.config.mjs +6 -0
- package/dist/commands/init/snippets/nextjs/next.config.ts +7 -0
- package/dist/commands/init/snippets/react-router/react-router.config.ts +7 -0
- package/dist/commands/init/template.jsonc +54 -4
- package/dist/commands/init/types.js +1 -0
- package/dist/commands/login/index.js +18 -28
- package/dist/commands/utils.js +1 -1
- package/dist/components/mutiLevelSelect.js +18 -20
- package/dist/docs/Commands_en.md +111 -143
- package/dist/docs/Commands_zh_CN.md +111 -143
- package/dist/i18n/locales.json +76 -20
- package/dist/libs/apiService.js +8 -3
- package/dist/libs/git/index.js +80 -7
- package/dist/libs/logger.js +64 -7
- package/dist/utils/checkIsRoutineCreated.js +16 -4
- package/dist/utils/command.js +149 -0
- package/dist/utils/compress.js +42 -4
- package/dist/utils/fileUtils/index.js +30 -34
- package/dist/utils/prompt.js +97 -0
- package/package.json +3 -1
- package/dist/docs/eslint-config-en.md +0 -1
- package/dist/docs/eslint-config.md +0 -73
- package/dist/docs/init-command-quick-test.md +0 -208
- package/dist/docs/init-command-test-guide.md +0 -598
|
@@ -1,234 +1,202 @@
|
|
|
1
|
-
|
|
1
|
+
## 命令一览
|
|
2
2
|
|
|
3
|
-
### init
|
|
3
|
+
### esa init [name]
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
初始化一个边缘函数项目(支持框架或模板)。
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
esa init [name]
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
11
|
+
- 位置参数:
|
|
12
|
+
- name:项目名
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
14
|
+
- 选项:
|
|
15
|
+
- -f, --framework string:选择前端框架(react/vue/nextjs...)
|
|
16
|
+
- -l, --language string:选择语言(typescript/javascript)。可选:typescript | javascript
|
|
17
|
+
- -t, --template string:指定模板名称
|
|
18
|
+
- -y, --yes boolean:对所有交互询问选择“是”(默认 false)
|
|
19
|
+
- --git boolean:在项目中初始化 git
|
|
20
|
+
- --deploy boolean:初始化完成后自动部署
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
- 在您的项目中生成一个 `esa.toml` 配置文件。
|
|
22
|
+
---
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
- 未指定 `--framework` 与 `--template` 且未使用 `--yes` 时,会先询问选择“框架初始化”或“模版初始化”。
|
|
22
|
-
- 选择框架后将调用对应官方脚手架创建项目,并在新项目根目录自动生成 `esa.toml`。入口文件会自动探测,候选包括:`src/index.js`、`src/index.jsx`、`src/index.tsx`、`src/main.js`、`src/main.ts`、`src/main.tsx`、`pages/index.js`、`pages/index.tsx`、`app/page.js`、`app/page.tsx`。静态资源目录会根据框架常规构建输出自动设置,例如 CRA 为 `build/`、Vite 通常为 `dist/`(若存在),Next 静态导出使用 `out/`(若存在)。
|
|
24
|
+
### esa dev [entry]
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
管理边缘函数。
|
|
27
|
-
|
|
28
|
-
#### delete <routineName>
|
|
29
|
-
|
|
30
|
-
删除一个边缘函数。
|
|
26
|
+
启动本地开发服务器。
|
|
31
27
|
|
|
32
28
|
```bash
|
|
33
|
-
|
|
29
|
+
esa dev [entry]
|
|
34
30
|
```
|
|
35
31
|
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
|
|
39
|
-
#### list
|
|
32
|
+
- 位置参数:
|
|
33
|
+
- entry:边缘函数入口文件
|
|
40
34
|
|
|
41
|
-
|
|
35
|
+
- 选项:
|
|
36
|
+
- -p, --port number:监听端口
|
|
37
|
+
- -m, --minify boolean:开发模式下压缩代码(默认 false)
|
|
38
|
+
- --refresh-command string:保存自动刷新前执行的命令
|
|
39
|
+
- --local-upstream string:在本地开发中作为源站的主机
|
|
40
|
+
- --debug boolean:输出调试日志(默认 false)
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
$ esa routine list
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### route [script]
|
|
42
|
+
---
|
|
48
43
|
|
|
49
|
-
|
|
44
|
+
### esa commit [entry]
|
|
50
45
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
将路由绑定到边缘函数。
|
|
46
|
+
提交代码并保存为新版本。
|
|
54
47
|
|
|
55
48
|
```bash
|
|
56
|
-
|
|
49
|
+
esa commit [entry]
|
|
57
50
|
```
|
|
58
51
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
- 选项:
|
|
53
|
+
- -m, --minify boolean:提交前压缩代码(默认 false)
|
|
54
|
+
- -a, --assets string:静态资源目录
|
|
55
|
+
- -d, --description string:版本/例程描述(跳过交互输入)
|
|
56
|
+
- -n, --name string:边缘函数名称
|
|
62
57
|
|
|
63
|
-
|
|
64
|
-
$ esa route delete <route>
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
- route `string` `required`
|
|
68
|
-
- 要删除的路由名称。
|
|
58
|
+
---
|
|
69
59
|
|
|
70
|
-
|
|
60
|
+
### esa deploy [entry]
|
|
71
61
|
|
|
72
|
-
|
|
62
|
+
部署项目。
|
|
73
63
|
|
|
74
64
|
```bash
|
|
75
|
-
|
|
65
|
+
esa deploy [entry]
|
|
76
66
|
```
|
|
77
67
|
|
|
78
|
-
|
|
68
|
+
- 位置参数:
|
|
69
|
+
- entry:(可选的)边缘函数入口文件
|
|
79
70
|
|
|
80
|
-
|
|
71
|
+
- 选项:
|
|
72
|
+
- -v, --version string:指定要部署的版本(跳过交互选择)
|
|
73
|
+
- -e, --environment string:部署环境。可选:staging | production
|
|
74
|
+
- -n, --name string:边缘函数名称
|
|
75
|
+
- -a, --assets boolean:是否部署静态资源
|
|
76
|
+
- -d, --description string:版本描述
|
|
77
|
+
- -m, --minify boolean:是否压缩代码
|
|
81
78
|
|
|
82
|
-
|
|
83
|
-
$ esa login
|
|
84
|
-
```
|
|
79
|
+
---
|
|
85
80
|
|
|
86
|
-
###
|
|
81
|
+
### esa deployments [list | delete]
|
|
87
82
|
|
|
88
|
-
|
|
83
|
+
管理部署版本。
|
|
89
84
|
|
|
90
85
|
```bash
|
|
91
|
-
|
|
86
|
+
esa deployments list
|
|
87
|
+
esa deployments delete [deploymentId...]
|
|
92
88
|
```
|
|
93
89
|
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
|
|
97
|
-
- -port, --p `number` `optional`
|
|
98
|
-
- 监听端口。
|
|
99
|
-
|
|
100
|
-
- --inspect-port `number` `optional`
|
|
101
|
-
- 用于 Chrome inspect 调试工具的端口。
|
|
102
|
-
|
|
103
|
-
- -minify, --m `boolean` `optional`
|
|
104
|
-
- 开发打包时压缩代码。
|
|
105
|
-
|
|
106
|
-
- --local-upstream `string` `optional`
|
|
107
|
-
- 在开发时作为源站的域名。
|
|
90
|
+
- 子命令:
|
|
91
|
+
- list:列出所有部署
|
|
92
|
+
- delete [deploymentId...]:删除一个或多个部署版本
|
|
108
93
|
|
|
109
|
-
|
|
110
|
-
- 提供一个在保存自动刷新前执行的命令。
|
|
94
|
+
---
|
|
111
95
|
|
|
112
|
-
###
|
|
96
|
+
### esa routine [list | delete]
|
|
113
97
|
|
|
114
|
-
|
|
98
|
+
管理边缘函数。
|
|
115
99
|
|
|
116
100
|
```bash
|
|
117
|
-
|
|
101
|
+
esa routine list
|
|
102
|
+
esa routine delete <routineName>
|
|
118
103
|
```
|
|
119
104
|
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
|
|
123
|
-
### domain [script]
|
|
105
|
+
- 子命令:
|
|
106
|
+
- list:列出所有边缘函数
|
|
107
|
+
- delete `<routineName>`:删除指定边缘函数
|
|
124
108
|
|
|
125
|
-
|
|
109
|
+
---
|
|
126
110
|
|
|
127
|
-
|
|
111
|
+
### esa site [list]
|
|
128
112
|
|
|
129
|
-
|
|
113
|
+
管理站点。
|
|
130
114
|
|
|
131
115
|
```bash
|
|
132
|
-
|
|
116
|
+
esa site list
|
|
133
117
|
```
|
|
134
118
|
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
|
|
138
|
-
#### delete <domain>
|
|
139
|
-
|
|
140
|
-
删除一个绑定域名。
|
|
119
|
+
- 子命令:
|
|
120
|
+
- list:列出账户下所有已激活站点
|
|
141
121
|
|
|
142
|
-
|
|
143
|
-
$ esa domain delete <domain>
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
- domains `string` `required`
|
|
147
|
-
- 要删除的绑定域名。
|
|
122
|
+
---
|
|
148
123
|
|
|
149
|
-
|
|
124
|
+
### esa domain <add | list | delete>
|
|
150
125
|
|
|
151
|
-
|
|
126
|
+
管理与边缘函数绑定的域名。
|
|
152
127
|
|
|
153
128
|
```bash
|
|
154
|
-
|
|
129
|
+
esa domain add <domain>
|
|
130
|
+
esa domain list
|
|
131
|
+
esa domain delete <domain>
|
|
155
132
|
```
|
|
156
133
|
|
|
157
|
-
|
|
134
|
+
- 子命令:
|
|
135
|
+
- add `<domain>`:绑定域名
|
|
136
|
+
- list:查看所有已绑定域名
|
|
137
|
+
- delete `<domain>`:删除已绑定域名
|
|
158
138
|
|
|
159
|
-
|
|
139
|
+
---
|
|
160
140
|
|
|
161
|
-
|
|
141
|
+
### esa route <add | list | delete>
|
|
162
142
|
|
|
163
|
-
|
|
143
|
+
管理与边缘函数绑定的路由。
|
|
164
144
|
|
|
165
145
|
```bash
|
|
166
|
-
|
|
146
|
+
esa route add
|
|
147
|
+
esa route list
|
|
148
|
+
esa route delete <routeName>
|
|
167
149
|
```
|
|
168
150
|
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
查看所有部署。
|
|
151
|
+
- 子命令:
|
|
152
|
+
- add:绑定路由
|
|
153
|
+
- list:查看所有已绑定路由
|
|
154
|
+
- delete `<routeName>`:删除已绑定路由
|
|
175
155
|
|
|
176
|
-
|
|
177
|
-
$ esa deployments list
|
|
178
|
-
```
|
|
156
|
+
---
|
|
179
157
|
|
|
180
|
-
###
|
|
158
|
+
### esa login
|
|
181
159
|
|
|
182
|
-
|
|
160
|
+
登录。
|
|
183
161
|
|
|
184
162
|
```bash
|
|
185
|
-
|
|
163
|
+
esa login
|
|
186
164
|
```
|
|
187
165
|
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
|
|
191
|
-
- -m, --minify `boolean` `optional`
|
|
192
|
-
- 上传前压缩代码。
|
|
193
|
-
|
|
194
|
-
### logout
|
|
166
|
+
- 选项:
|
|
167
|
+
- --access-key-id, --ak string:AccessKey ID (AK)
|
|
168
|
+
- --access-key-secret, --sk string:AccessKey Secret (SK)
|
|
195
169
|
|
|
196
|
-
|
|
170
|
+
---
|
|
197
171
|
|
|
198
|
-
|
|
199
|
-
$ esa logout
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
### config
|
|
172
|
+
### esa logout
|
|
203
173
|
|
|
204
|
-
|
|
174
|
+
退出登录。
|
|
205
175
|
|
|
206
176
|
```bash
|
|
207
|
-
|
|
177
|
+
esa logout
|
|
208
178
|
```
|
|
209
179
|
|
|
210
|
-
|
|
211
|
-
- 编辑全局配置文件。
|
|
180
|
+
---
|
|
212
181
|
|
|
213
|
-
|
|
214
|
-
- 编辑本地配置文件。
|
|
182
|
+
### esa config [-l | -g]
|
|
215
183
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
选择语言。
|
|
184
|
+
修改本地或全局配置。
|
|
219
185
|
|
|
220
186
|
```bash
|
|
221
|
-
|
|
187
|
+
esa config [--local] [--global]
|
|
222
188
|
```
|
|
223
189
|
|
|
224
|
-
|
|
190
|
+
- 选项:
|
|
191
|
+
- -l, --local boolean:编辑本地配置文件(默认 false)
|
|
192
|
+
- -g, --global boolean:编辑全局配置文件(默认 false)
|
|
225
193
|
|
|
226
|
-
|
|
194
|
+
---
|
|
227
195
|
|
|
228
|
-
|
|
196
|
+
### esa lang
|
|
229
197
|
|
|
230
|
-
|
|
198
|
+
设置 CLI 语言。
|
|
231
199
|
|
|
232
200
|
```bash
|
|
233
|
-
|
|
201
|
+
esa lang
|
|
234
202
|
```
|
package/dist/i18n/locales.json
CHANGED
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"zh_CN": "您的代码已成功部署"
|
|
105
105
|
},
|
|
106
106
|
"deploy_success_guide": {
|
|
107
|
-
"en": "
|
|
107
|
+
"en": "Add a custom domain",
|
|
108
108
|
"zh_CN": "运行此命令以添加域名"
|
|
109
109
|
},
|
|
110
110
|
"deploy_table_header_version": {
|
|
@@ -560,7 +560,7 @@
|
|
|
560
560
|
"zh_CN": "未找到模板 \"${templateName}\"。请检查模板名称并重试。"
|
|
561
561
|
},
|
|
562
562
|
"generate_config_error": {
|
|
563
|
-
"en": "
|
|
563
|
+
"en": "already exists",
|
|
564
564
|
"zh_CN": "配置文件已经存在"
|
|
565
565
|
},
|
|
566
566
|
"generate_config_success": {
|
|
@@ -800,7 +800,7 @@
|
|
|
800
800
|
"zh_CN": "未找到正式版本,您需要先创建一个版本。"
|
|
801
801
|
},
|
|
802
802
|
"init_deploy_success": {
|
|
803
|
-
"en": "
|
|
803
|
+
"en": "Deploy Success",
|
|
804
804
|
"zh_CN": "项目部署完成。访问:"
|
|
805
805
|
},
|
|
806
806
|
"show_default_url": {
|
|
@@ -1109,51 +1109,51 @@
|
|
|
1109
1109
|
},
|
|
1110
1110
|
"commit_assets_exist": {
|
|
1111
1111
|
"en": "This is a routine with assets project",
|
|
1112
|
-
"zh_CN": ""
|
|
1112
|
+
"zh_CN": "这是一个带静态资源的边缘函数项目"
|
|
1113
1113
|
},
|
|
1114
1114
|
"commit_routine_with_assets_success": {
|
|
1115
1115
|
"en": "Routine with assets code version committed successfully.",
|
|
1116
|
-
"zh_CN": ""
|
|
1116
|
+
"zh_CN": "带静态资源的边缘函数代码版本提交成功。"
|
|
1117
1117
|
},
|
|
1118
1118
|
"commit_routine_with_assets_fail": {
|
|
1119
1119
|
"en": "An error occurred while trying to commit your routine with assets.",
|
|
1120
|
-
"zh_CN": ""
|
|
1120
|
+
"zh_CN": "提交带静态资源的边缘函数时发生错误。"
|
|
1121
1121
|
},
|
|
1122
1122
|
"commit_option_assets": {
|
|
1123
1123
|
"en": "Assets directory",
|
|
1124
|
-
"zh_CN": ""
|
|
1124
|
+
"zh_CN": "静态资源目录"
|
|
1125
1125
|
},
|
|
1126
1126
|
"commit_option_name": {
|
|
1127
1127
|
"en": "Edge Routine name",
|
|
1128
|
-
"zh_CN": ""
|
|
1128
|
+
"zh_CN": "边缘函数名称"
|
|
1129
1129
|
},
|
|
1130
1130
|
"deploy_option_name": {
|
|
1131
1131
|
"en": "Name of the routine",
|
|
1132
|
-
"zh_CN": ""
|
|
1132
|
+
"zh_CN": "边缘函数名称"
|
|
1133
1133
|
},
|
|
1134
1134
|
"deploy_option_assets": {
|
|
1135
1135
|
"en": "Deploy assets",
|
|
1136
|
-
"zh_CN": ""
|
|
1136
|
+
"zh_CN": "部署静态资源"
|
|
1137
1137
|
},
|
|
1138
1138
|
"deploy_invalid_environment": {
|
|
1139
1139
|
"en": "Invalid environment",
|
|
1140
|
-
"zh_CN": ""
|
|
1140
|
+
"zh_CN": "无效的环境"
|
|
1141
1141
|
},
|
|
1142
1142
|
"deploy_success_guide_2": {
|
|
1143
|
-
"en": "
|
|
1144
|
-
"zh_CN": ""
|
|
1143
|
+
"en": "Add routes for a site",
|
|
1144
|
+
"zh_CN": "运行此命令以添加路由"
|
|
1145
1145
|
},
|
|
1146
1146
|
"login_get_from_env": {
|
|
1147
1147
|
"en": "Get AccessKey ID and AccessKey Secret from environment variables.",
|
|
1148
|
-
"zh_CN": ""
|
|
1148
|
+
"zh_CN": "从环境变量中获取 AccessKey ID 和 AccessKey Secret。"
|
|
1149
1149
|
},
|
|
1150
1150
|
"deploy_option_description": {
|
|
1151
1151
|
"en": "Description of the version",
|
|
1152
|
-
"zh_CN": ""
|
|
1152
|
+
"zh_CN": "版本描述"
|
|
1153
1153
|
},
|
|
1154
1154
|
"deploy_option_minify": {
|
|
1155
1155
|
"en": "Minify the code",
|
|
1156
|
-
"zh_CN": ""
|
|
1156
|
+
"zh_CN": "压缩代码"
|
|
1157
1157
|
},
|
|
1158
1158
|
"error_reading_project_config_file": {
|
|
1159
1159
|
"en": "Error reading project configuration file.",
|
|
@@ -1161,22 +1161,78 @@
|
|
|
1161
1161
|
},
|
|
1162
1162
|
"checking_template_update": {
|
|
1163
1163
|
"en": "Checking esa-template updates...",
|
|
1164
|
-
"zh_CN": ""
|
|
1164
|
+
"zh_CN": "检查 esa-template 更新..."
|
|
1165
1165
|
},
|
|
1166
1166
|
"template_updating": {
|
|
1167
1167
|
"en": "Updating templates to latest...",
|
|
1168
|
-
"zh_CN": ""
|
|
1168
|
+
"zh_CN": "正在更新模板到最新版本..."
|
|
1169
1169
|
},
|
|
1170
1170
|
"template_updated_to_latest": {
|
|
1171
1171
|
"en": "Templates updated to latest.",
|
|
1172
|
-
"zh_CN": ""
|
|
1172
|
+
"zh_CN": "模板已更新到最新版本。"
|
|
1173
1173
|
},
|
|
1174
1174
|
"checking_esa_template_finished": {
|
|
1175
1175
|
"en": "Checking esa-template finished.",
|
|
1176
|
-
"zh_CN": ""
|
|
1176
|
+
"zh_CN": "检查 esa-template 完成。"
|
|
1177
1177
|
},
|
|
1178
1178
|
"git_installed_success": {
|
|
1179
1179
|
"en": "Git has been installed successfully.",
|
|
1180
|
+
"zh_CN": "Git 已成功安装。"
|
|
1181
|
+
},
|
|
1182
|
+
"compress_not_specified": {
|
|
1183
|
+
"en": "Not specified",
|
|
1184
|
+
"zh_CN": "未指定"
|
|
1185
|
+
},
|
|
1186
|
+
"compress_not_configured": {
|
|
1187
|
+
"en": "Not configured",
|
|
1188
|
+
"zh_CN": "未配置"
|
|
1189
|
+
},
|
|
1190
|
+
"compress_check_file_exists": {
|
|
1191
|
+
"en": "(Check if file exists)",
|
|
1192
|
+
"zh_CN": "(检查文件是否存在)"
|
|
1193
|
+
},
|
|
1194
|
+
"compress_check_directory_exists": {
|
|
1195
|
+
"en": "(Check if directory exists)",
|
|
1196
|
+
"zh_CN": "(检查目录是否存在)"
|
|
1197
|
+
},
|
|
1198
|
+
"deploy_success_cd": {
|
|
1199
|
+
"en": "Enter project directory",
|
|
1200
|
+
"zh_CN": ""
|
|
1201
|
+
},
|
|
1202
|
+
"init_abort": {
|
|
1203
|
+
"en": "Initialization aborted",
|
|
1204
|
+
"zh_CN": ""
|
|
1205
|
+
},
|
|
1206
|
+
"reason": {
|
|
1207
|
+
"en": "Reason:",
|
|
1208
|
+
"zh_CN": ""
|
|
1209
|
+
},
|
|
1210
|
+
"dir_already_exists": {
|
|
1211
|
+
"en": "Target directory already exists",
|
|
1212
|
+
"zh_CN": ""
|
|
1213
|
+
},
|
|
1214
|
+
"path": {
|
|
1215
|
+
"en": "Path:",
|
|
1216
|
+
"zh_CN": ""
|
|
1217
|
+
},
|
|
1218
|
+
"try": {
|
|
1219
|
+
"en": "Try one of the following:",
|
|
1220
|
+
"zh_CN": ""
|
|
1221
|
+
},
|
|
1222
|
+
"try_diff_name": {
|
|
1223
|
+
"en": "Choose a different project name",
|
|
1224
|
+
"zh_CN": ""
|
|
1225
|
+
},
|
|
1226
|
+
"try_remove": {
|
|
1227
|
+
"en": "Remove the directory:",
|
|
1228
|
+
"zh_CN": ""
|
|
1229
|
+
},
|
|
1230
|
+
"try_another_dir": {
|
|
1231
|
+
"en": "Run the command in another directory",
|
|
1232
|
+
"zh_CN": ""
|
|
1233
|
+
},
|
|
1234
|
+
"step": {
|
|
1235
|
+
"en": "Step:",
|
|
1180
1236
|
"zh_CN": ""
|
|
1181
1237
|
}
|
|
1182
1238
|
}
|
package/dist/libs/apiService.js
CHANGED
|
@@ -583,7 +583,8 @@ export class ApiService {
|
|
|
583
583
|
let request = new $OpenApi.OpenApiRequest({
|
|
584
584
|
query: {
|
|
585
585
|
Name: edgeRoutine.name,
|
|
586
|
-
Description: edgeRoutine.description
|
|
586
|
+
Description: edgeRoutine.description,
|
|
587
|
+
HasAssets: edgeRoutine.hasAssets
|
|
587
588
|
}
|
|
588
589
|
});
|
|
589
590
|
let runtime = {
|
|
@@ -916,6 +917,7 @@ export class ApiService {
|
|
|
916
917
|
*/
|
|
917
918
|
CreateRoutineWithAssetsCodeVersion(requestParams) {
|
|
918
919
|
return __awaiter(this, void 0, void 0, function* () {
|
|
920
|
+
var _a;
|
|
919
921
|
try {
|
|
920
922
|
let params = {
|
|
921
923
|
action: 'CreateRoutineWithAssetsCodeVersion',
|
|
@@ -932,10 +934,13 @@ export class ApiService {
|
|
|
932
934
|
}
|
|
933
935
|
};
|
|
934
936
|
let request = new $OpenApi.OpenApiRequest({
|
|
935
|
-
|
|
937
|
+
body: {
|
|
936
938
|
Name: requestParams.Name,
|
|
937
939
|
CodeDescription: requestParams.CodeDescription,
|
|
938
|
-
|
|
940
|
+
ExtraInfo: requestParams.ExtraInfo,
|
|
941
|
+
ConfOptions: {
|
|
942
|
+
NotFoundStrategy: (_a = requestParams.ConfOptions) === null || _a === void 0 ? void 0 : _a.NotFoundStrategy
|
|
943
|
+
}
|
|
939
944
|
}
|
|
940
945
|
});
|
|
941
946
|
let runtime = {
|
package/dist/libs/git/index.js
CHANGED
|
@@ -8,7 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { execSync } from 'child_process';
|
|
11
|
-
import { exit } from 'process';
|
|
12
11
|
import logger from '../../libs/logger.js';
|
|
13
12
|
export function isInstalledGit() {
|
|
14
13
|
try {
|
|
@@ -31,26 +30,100 @@ export function isGitConfigured() {
|
|
|
31
30
|
}
|
|
32
31
|
export function cloneRepository(url, path) {
|
|
33
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
if (!isInstalledGit()) {
|
|
34
|
+
logger.error('Git is not installed on your system.');
|
|
35
|
+
logger.info('Please install Git first:');
|
|
36
|
+
logger.info(' • macOS: brew install git');
|
|
37
|
+
logger.info(' • Ubuntu/Debian: sudo apt-get install git');
|
|
38
|
+
logger.info(' • Windows: Download from https://git-scm.com/');
|
|
39
|
+
logger.info(' • Or visit: https://git-scm.com/downloads');
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
34
42
|
try {
|
|
35
43
|
execSync(`git clone ${url} ${path}`, { stdio: 'inherit' });
|
|
36
44
|
logger.log('Repository cloned successfully.');
|
|
45
|
+
return true;
|
|
37
46
|
}
|
|
38
47
|
catch (error) {
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
logger.error(`Error occurred while cloning the repository: ${error}`);
|
|
49
|
+
return false;
|
|
41
50
|
}
|
|
42
51
|
});
|
|
43
52
|
}
|
|
44
|
-
export function installGit(path, debug = false) {
|
|
53
|
+
export function installGit(path, debug = false, autoInstall = false) {
|
|
54
|
+
if (!isInstalledGit()) {
|
|
55
|
+
if (autoInstall) {
|
|
56
|
+
logger.info('Git not found. Attempting to auto-install...');
|
|
57
|
+
if (autoInstallGit()) {
|
|
58
|
+
logger.info('Git installed successfully! Now initializing repository...');
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
logger.error('Failed to auto-install Git.');
|
|
62
|
+
logger.info('Please install Git manually:');
|
|
63
|
+
logger.info(' • macOS: brew install git');
|
|
64
|
+
logger.info(' • Ubuntu/Debian: sudo apt-get install git');
|
|
65
|
+
logger.info(' • Windows: Download from https://git-scm.com/');
|
|
66
|
+
logger.info(' • Or visit: https://git-scm.com/downloads');
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
logger.error('Git is not installed on your system.');
|
|
72
|
+
logger.info('Please install Git first:');
|
|
73
|
+
logger.info(' • macOS: brew install git');
|
|
74
|
+
logger.info(' • Ubuntu/Debian: sudo apt-get install git');
|
|
75
|
+
logger.info(' • Windows: Download from https://git-scm.com/');
|
|
76
|
+
logger.info(' • Or visit: https://git-scm.com/downloads');
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
45
80
|
try {
|
|
46
81
|
execSync('git init', { stdio: 'ignore', cwd: path });
|
|
47
82
|
if (debug) {
|
|
48
|
-
logger.log('Git
|
|
83
|
+
logger.log('Git repository initialized successfully.');
|
|
49
84
|
}
|
|
50
85
|
return true;
|
|
51
86
|
}
|
|
52
87
|
catch (error) {
|
|
53
|
-
|
|
54
|
-
|
|
88
|
+
logger.error(`Error occurred while initializing Git repository: ${error}`);
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Attempt to automatically install Git on supported platforms
|
|
94
|
+
* @returns true if installation was successful, false otherwise
|
|
95
|
+
*/
|
|
96
|
+
export function autoInstallGit() {
|
|
97
|
+
try {
|
|
98
|
+
const platform = process.platform;
|
|
99
|
+
if (platform === 'darwin') {
|
|
100
|
+
// macOS - try using Homebrew
|
|
101
|
+
logger.info('Attempting to install Git using Homebrew...');
|
|
102
|
+
execSync('brew install git', { stdio: 'inherit' });
|
|
103
|
+
logger.success('Git installed successfully via Homebrew!');
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
else if (platform === 'linux') {
|
|
107
|
+
// Linux - try using apt-get (Ubuntu/Debian)
|
|
108
|
+
logger.info('Attempting to install Git using apt-get...');
|
|
109
|
+
execSync('sudo apt-get update && sudo apt-get install -y git', {
|
|
110
|
+
stdio: 'inherit'
|
|
111
|
+
});
|
|
112
|
+
logger.success('Git installed successfully via apt-get!');
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
logger.warn('Auto-installation is not supported on this platform.');
|
|
117
|
+
logger.info('Please install Git manually from: https://git-scm.com/downloads');
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
logger.error(`Failed to auto-install Git: ${error}`);
|
|
123
|
+
logger.info('Please install Git manually:');
|
|
124
|
+
logger.info(' • macOS: brew install git');
|
|
125
|
+
logger.info(' • Ubuntu/Debian: sudo apt-get install git');
|
|
126
|
+
logger.info(' • Windows: Download from https://git-scm.com/');
|
|
127
|
+
return false;
|
|
55
128
|
}
|
|
56
129
|
}
|