esa-cli 0.0.1-beta.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.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +175 -0
  3. package/bin/enter.cjs +52 -0
  4. package/dist/README.md +175 -0
  5. package/dist/bin/enter.cjs +52 -0
  6. package/dist/cliconfig.toml +6 -0
  7. package/dist/commands/commit/index.js +147 -0
  8. package/dist/commands/commit/prodBuild.js +50 -0
  9. package/dist/commands/common/constant.js +54 -0
  10. package/dist/commands/config.js +51 -0
  11. package/dist/commands/deploy/helper.js +108 -0
  12. package/dist/commands/deploy/index.js +217 -0
  13. package/dist/commands/deployments/delete.js +92 -0
  14. package/dist/commands/deployments/index.js +27 -0
  15. package/dist/commands/deployments/list.js +89 -0
  16. package/dist/commands/dev/config/devBuild.js +26 -0
  17. package/dist/commands/dev/config/devEntry.js +71 -0
  18. package/dist/commands/dev/config/mock/cache.js +31 -0
  19. package/dist/commands/dev/config/mock/kv.js +87 -0
  20. package/dist/commands/dev/devPack.js +113 -0
  21. package/dist/commands/dev/doProcess.js +73 -0
  22. package/dist/commands/dev/index.js +240 -0
  23. package/dist/commands/dev/server.js +100 -0
  24. package/dist/commands/domain/add.js +72 -0
  25. package/dist/commands/domain/delete.js +74 -0
  26. package/dist/commands/domain/index.js +29 -0
  27. package/dist/commands/domain/list.js +51 -0
  28. package/dist/commands/init/index.js +149 -0
  29. package/dist/commands/lang.js +32 -0
  30. package/dist/commands/login/index.js +108 -0
  31. package/dist/commands/logout.js +44 -0
  32. package/dist/commands/route/add.js +115 -0
  33. package/dist/commands/route/delete.js +74 -0
  34. package/dist/commands/route/index.js +29 -0
  35. package/dist/commands/route/list.js +63 -0
  36. package/dist/commands/routine/delete.js +54 -0
  37. package/dist/commands/routine/index.js +27 -0
  38. package/dist/commands/routine/list.js +101 -0
  39. package/dist/commands/site/index.js +25 -0
  40. package/dist/commands/site/list.js +47 -0
  41. package/dist/commands/utils.js +139 -0
  42. package/dist/components/descriptionInput.js +38 -0
  43. package/dist/components/filterSelector.js +132 -0
  44. package/dist/components/mutiSelectTable.js +95 -0
  45. package/dist/components/selectInput.js +17 -0
  46. package/dist/components/selectItem.js +6 -0
  47. package/dist/components/yesNoPrompt.js +9 -0
  48. package/dist/docs/Commands_en.md +224 -0
  49. package/dist/docs/Commands_zh_CN.md +224 -0
  50. package/dist/docs/dev.png +0 -0
  51. package/dist/i18n/index.js +27 -0
  52. package/dist/i18n/locales.json +766 -0
  53. package/dist/index.js +80 -0
  54. package/dist/libs/apiService.js +914 -0
  55. package/dist/libs/git/index.js +52 -0
  56. package/dist/libs/interface.js +21 -0
  57. package/dist/libs/logger.js +149 -0
  58. package/dist/libs/request.js +98 -0
  59. package/dist/libs/templates/index.js +16 -0
  60. package/dist/package.json +93 -0
  61. package/dist/utils/checkDevPort.js +113 -0
  62. package/dist/utils/checkIsRoutineCreated.js +56 -0
  63. package/dist/utils/checkVersion.js +26 -0
  64. package/dist/utils/debounce.js +18 -0
  65. package/dist/utils/fileUtils/index.js +219 -0
  66. package/dist/utils/fileUtils/interface.js +1 -0
  67. package/dist/utils/install/install.ps1 +33 -0
  68. package/dist/utils/install/install.sh +53 -0
  69. package/dist/utils/installRuntime.js +80 -0
  70. package/dist/utils/openInBrowser.js +24 -0
  71. package/dist/utils/sleep.js +6 -0
  72. package/dist/zh_CN.md +177 -0
  73. package/package.json +93 -0
@@ -0,0 +1,224 @@
1
+ # Commands
2
+
3
+ ### init
4
+
5
+ 选择模版初始化项目。
6
+
7
+ ```bash
8
+ $ esa init [OPTIONS]
9
+ ```
10
+
11
+ - -c, --config `boolean` `optional`
12
+ - 在您的项目中生成一个esa.toml配置文件。
13
+
14
+ ### routine [script]
15
+
16
+ 管理边缘函数。
17
+
18
+ #### delete <routineName>
19
+
20
+ 删除一个边缘函数。
21
+
22
+ ```bash
23
+ $ esa routine delete <routineName>
24
+ ```
25
+
26
+ - routineName `string` `required`
27
+ - 要删除的边缘函数名称。
28
+
29
+ #### list
30
+
31
+ 查看所有边缘函数。
32
+
33
+ ```bash
34
+ $ esa routine list
35
+ ```
36
+
37
+ ### route [script]
38
+
39
+ 管理绑定到边缘函数的路由。
40
+
41
+ #### add [route] [site]
42
+
43
+ 将路由绑定到边缘函数。
44
+
45
+ ```bash
46
+ $ esa route add [route] [site]
47
+ ```
48
+
49
+ #### delete <route>
50
+
51
+ 删除一个绑定路由。
52
+
53
+ ```bash
54
+ $ esa route delete <route>
55
+ ```
56
+
57
+ - route `string` `required`
58
+ - 要删除的路由名称。
59
+
60
+ #### list
61
+
62
+ 查看所有绑定路由。
63
+
64
+ ```bash
65
+ $ esa route list
66
+ ```
67
+
68
+ ### login
69
+
70
+ 登录。
71
+
72
+ ```bash
73
+ $ esa login
74
+ ```
75
+
76
+ ### dev [entry]
77
+
78
+ 启动本地调试。
79
+
80
+ ```bash
81
+ $ esa dev [entry] [OPTIONS]
82
+ ```
83
+
84
+ - entry `string` `optional`
85
+ - 入口文件路径。
86
+
87
+ - -port, --p `number` `optional`
88
+ - 监听端口。
89
+
90
+ - --inspect-port `number` `optional`
91
+ - 用于 Chrome inspect 调试工具的端口。
92
+
93
+ - -minify, --m `boolean` `optional`
94
+ - 开发打包时压缩代码。
95
+
96
+ - --local-upstream `string` `optional`
97
+ - 在开发时作为源站的域名。
98
+
99
+ - --refresh-command `string` `optional`
100
+ - 提供一个在保存自动刷新前执行的命令。
101
+
102
+ ### deploy [entry]
103
+
104
+ 部署您的项目。
105
+
106
+ ```bash
107
+ $ esa deploy [entry]
108
+ ```
109
+
110
+ - entry `string` `optional`
111
+ - 入口文件路径。
112
+
113
+ ### domain [script]
114
+
115
+ 管理绑定到边缘函数的域名。
116
+
117
+ #### add <domain>
118
+
119
+ 绑定域名到边缘函数。
120
+
121
+ ```bash
122
+ $ esa domain add <domain>
123
+ ```
124
+
125
+ - domain `string` `required`
126
+ - 需要添加的域名。
127
+
128
+ #### delete <domain>
129
+
130
+ 删除一个绑定域名。
131
+
132
+ ```bash
133
+ $ esa domain delete <domain>
134
+ ```
135
+
136
+ - domains `string` `required`
137
+ - 要删除的绑定域名。
138
+
139
+ #### list
140
+
141
+ 查看所有绑定域名。
142
+
143
+ ```bash
144
+ $ esa domain list
145
+ ```
146
+
147
+ ### deployments [script]
148
+
149
+ 管理您的部署。
150
+
151
+ #### delete <deploymentId>
152
+
153
+ 删除一个部署版本。
154
+
155
+ ```bash
156
+ $ esa deployments delete <deploymentId>
157
+ ```
158
+
159
+ - deploymentId `string` `required`
160
+ - 要删除的部署版本ID。
161
+
162
+ #### list
163
+
164
+ 查看所有部署。
165
+
166
+ ```bash
167
+ $ esa deployments list
168
+ ```
169
+
170
+ ### commit [entry]
171
+
172
+ 提交代码,保存为一个版本。
173
+
174
+ ```bash
175
+ $ esa commit [entry] [OPTIONS]
176
+ ```
177
+
178
+ - entry `string` `optional`
179
+ - 入口文件路径。
180
+
181
+ - -m, --minify `boolean` `optional`
182
+ - 上传前压缩代码。
183
+
184
+ ### logout
185
+
186
+ 注销登录。
187
+
188
+ ```bash
189
+ $ esa logout
190
+ ```
191
+
192
+ ### config
193
+
194
+ 使用 -l 或 -g 修改本地或全局配置。
195
+
196
+ ```bash
197
+ $ esa config [OPTIONS]
198
+ ```
199
+
200
+ - -g, --global `boolean` `optional`
201
+ - 编辑全局配置文件。
202
+
203
+ - -l, --local `boolean` `optional`
204
+ - 编辑本地配置文件。
205
+
206
+ ### lang
207
+
208
+ 选择语言。
209
+
210
+ ```bash
211
+ $ esa lang
212
+ ```
213
+
214
+ ### site [script]
215
+
216
+ 管理站点。
217
+
218
+ #### list
219
+
220
+ 列出站点。
221
+
222
+ ```bash
223
+ $ esa site list
224
+ ```
Binary file
@@ -0,0 +1,27 @@
1
+ import localesJson from './locales.json' assert { type: 'json' };
2
+ import { getCliConfig } from '../utils/fileUtils/index.js';
3
+ import logger from '../libs/logger.js';
4
+ const t = (key, variables) => {
5
+ var _a;
6
+ const locales = localesJson;
7
+ const lang = ((_a = getCliConfig()) === null || _a === void 0 ? void 0 : _a.lang) || 'en';
8
+ let translation = '';
9
+ if (locales[key] && locales[key][lang]) {
10
+ translation = locales[key][lang];
11
+ }
12
+ else {
13
+ logger.verbose('Not find key: ' + key);
14
+ translation = locales[key].en;
15
+ }
16
+ if (variables) {
17
+ for (const variable in variables) {
18
+ translation = translation.replace(`\${${variable}}`, variables[variable]);
19
+ }
20
+ }
21
+ return {
22
+ d: (defaultText) => {
23
+ return translation || defaultText;
24
+ }
25
+ };
26
+ };
27
+ export default t;