esa-cli 0.0.5 → 1.0.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.
Files changed (85) hide show
  1. package/README.md +32 -149
  2. package/dist/commands/commit/index.js +49 -104
  3. package/dist/commands/commit/prodBuild.js +2 -3
  4. package/dist/commands/common/constant.js +4 -4
  5. package/dist/commands/common/utils.js +419 -0
  6. package/dist/commands/config.js +2 -2
  7. package/dist/commands/deploy/helper.js +43 -49
  8. package/dist/commands/deploy/index.js +51 -174
  9. package/dist/commands/deployments/delete.js +32 -22
  10. package/dist/commands/deployments/index.js +4 -4
  11. package/dist/commands/deployments/list.js +21 -34
  12. package/dist/commands/dev/build.js +3 -3
  13. package/dist/commands/dev/doProcess.js +5 -5
  14. package/dist/commands/dev/ew2/cacheService.js +33 -0
  15. package/dist/commands/dev/ew2/devEntry.js +2 -1
  16. package/dist/commands/dev/ew2/devPack.js +31 -20
  17. package/dist/commands/dev/ew2/kvService.js +50 -0
  18. package/dist/commands/dev/ew2/mock/cache.js +99 -15
  19. package/dist/commands/dev/ew2/mock/kv.js +142 -21
  20. package/dist/commands/dev/ew2/server.js +163 -28
  21. package/dist/commands/dev/index.js +17 -18
  22. package/dist/commands/dev/mockWorker/devPack.js +19 -10
  23. package/dist/commands/dev/mockWorker/server.js +7 -6
  24. package/dist/commands/domain/add.js +4 -4
  25. package/dist/commands/domain/delete.js +3 -3
  26. package/dist/commands/domain/index.js +4 -4
  27. package/dist/commands/domain/list.js +7 -7
  28. package/dist/commands/init/helper.js +654 -21
  29. package/dist/commands/init/index.js +88 -152
  30. package/dist/commands/init/snippets/nextjs/next.config.mjs +6 -0
  31. package/dist/commands/init/snippets/nextjs/next.config.ts +7 -0
  32. package/dist/commands/init/snippets/react-router/react-router.config.ts +7 -0
  33. package/dist/commands/init/template.jsonc +84 -0
  34. package/dist/commands/init/types.js +1 -0
  35. package/dist/commands/lang.js +2 -2
  36. package/dist/commands/login/index.js +74 -34
  37. package/dist/commands/logout.js +6 -6
  38. package/dist/commands/route/add.js +101 -43
  39. package/dist/commands/route/delete.js +6 -6
  40. package/dist/commands/route/helper.js +9 -10
  41. package/dist/commands/route/index.js +4 -4
  42. package/dist/commands/route/list.js +4 -4
  43. package/dist/commands/routine/delete.js +9 -8
  44. package/dist/commands/routine/index.js +6 -5
  45. package/dist/commands/routine/list.js +45 -39
  46. package/dist/commands/site/index.js +3 -3
  47. package/dist/commands/site/list.js +6 -7
  48. package/dist/commands/utils.js +61 -25
  49. package/dist/components/descriptionInput.js +1 -1
  50. package/dist/components/filterSelector.js +1 -1
  51. package/dist/components/mutiLevelSelect.js +19 -20
  52. package/dist/components/mutiSelectTable.js +1 -1
  53. package/dist/components/routeBuilder.js +68 -0
  54. package/dist/components/selectInput.js +2 -3
  55. package/dist/components/selectItem.js +1 -1
  56. package/dist/docs/Commands_en.md +164 -117
  57. package/dist/docs/Commands_zh_CN.md +155 -107
  58. package/dist/docs/Config_en.md +70 -0
  59. package/dist/docs/Config_zh_CN.md +68 -0
  60. package/dist/i18n/index.js +2 -2
  61. package/dist/i18n/locales.json +414 -82
  62. package/dist/index.js +28 -13
  63. package/dist/libs/api.js +3 -6
  64. package/dist/libs/apiService.js +192 -69
  65. package/dist/libs/git/index.js +86 -9
  66. package/dist/libs/interface.js +0 -1
  67. package/dist/libs/logger.js +162 -10
  68. package/dist/libs/service.js +2 -2
  69. package/dist/libs/templates/index.js +1 -1
  70. package/dist/utils/checkAssetsExist.js +80 -0
  71. package/dist/utils/checkDevPort.js +5 -19
  72. package/dist/utils/checkEntryFileExist.js +10 -0
  73. package/dist/utils/checkIsRoutineCreated.js +27 -21
  74. package/dist/utils/checkVersion.js +119 -1
  75. package/dist/utils/command.js +149 -0
  76. package/dist/utils/compress.js +142 -0
  77. package/dist/utils/download.js +8 -8
  78. package/dist/utils/fileMd5.js +1 -1
  79. package/dist/utils/fileUtils/index.js +136 -45
  80. package/dist/utils/installDeno.js +4 -4
  81. package/dist/utils/installEw2.js +9 -9
  82. package/dist/utils/openInBrowser.js +1 -1
  83. package/dist/utils/prompt.js +97 -0
  84. package/package.json +23 -12
  85. package/zh_CN.md +29 -154
@@ -1,224 +1,271 @@
1
- # Commands
1
+ ## Commands
2
2
 
3
- ### init
3
+ ### esa-cli init [name]
4
+
5
+ Initialize a project with a template or a framework.
4
6
 
5
- Initialize a routine with a template.
6
-
7
7
  ```bash
8
- $ esa init [OPTIONS]
8
+ esa-cli init [name]
9
9
  ```
10
10
 
11
- - -c, --config `boolean` `optional`
12
- - Generate a config file for your project.
11
+ - Positionals:
12
+ - name: Project name
13
+
14
+ - Options:
15
+ - -f, --framework string: Choose a frontend framework (react/vue/nextjs...)
16
+ - -l, --language string: Choose programming language (typescript/javascript). Choices: typescript | javascript
17
+ - -t, --template string: Template name to use
18
+ - -y, --yes boolean: Answer "Yes" to all prompts (default: false)
19
+ - --git boolean: Initialize git repository
20
+ - --deploy boolean: Deploy after initialization
13
21
 
14
- ### routine [script]
22
+ ---
15
23
 
16
- Manage your routine.
17
-
18
- #### delete <routineName>
24
+ ### esa-cli dev [entry]
19
25
 
20
- Delete a routine.
26
+ Start a local server for developing your project.
21
27
 
22
28
  ```bash
23
- $ esa routine delete <routineName>
29
+ esa-cli dev [entry]
24
30
  ```
25
31
 
26
- - routineName `string` `required`
27
- - The name of the routine to delete.
32
+ - Positionals:
33
+ - entry: Entry file of Functions& Pages
34
+
35
+ - Options:
36
+ - -p, --port number: Port to listen on
37
+ - -m, --minify boolean: Minify code during development (default: false)
38
+ - --refresh-command string: Command to run before auto-refresh on save
39
+ - --local-upstream string: Host to act as origin in development
40
+ - --debug boolean: Output debug logs (default: false)
41
+
42
+ ---
28
43
 
29
- #### list
44
+ ### esa-cli commit [entry]
30
45
 
31
- List all your routines.
46
+ Commit your code and save as a new version.
32
47
 
33
48
  ```bash
34
- $ esa routine list
49
+ esa-cli commit [entry]
35
50
  ```
36
51
 
37
- ### route [script]
52
+ - Options:
53
+ - -m, --minify boolean: Minify code before committing (default: false)
54
+ - -a, --assets string: Assets directory
55
+ - -d, --description string: Description for Functions& Pages/version (skip interactive input)
56
+ - -n, --name string: Functions& Pages name
38
57
 
39
- Manage the routes bound to your routine.
40
-
41
- #### add [route] [site]
58
+ ---
42
59
 
43
- Bind a Route to a routine.
60
+ ### esa-cli deploy [entry]
61
+
62
+ Deploy your project.
44
63
 
45
64
  ```bash
46
- $ esa route add [route] [site]
65
+ esa-cli deploy [entry]
47
66
  ```
48
67
 
49
- #### delete <route>
68
+ - Positionals:
69
+ - entry: Entry file of Functions& Pages
50
70
 
51
- Delete a related route.
71
+ - Options:
72
+ - -v, --version string: Version to deploy (skip interactive selection)
73
+ - -e, --environment string: Environment to deploy to. Choices: staging | production
74
+ - -n, --name string: Name of Functions& Pages
75
+ - -a, --assets string: Assets directory (e.g., ./dist)
76
+ - -d, --description string: Description of the version
77
+ - -m, --minify boolean: Minify the code
78
+
79
+ ---
80
+
81
+ ### esa-cli deployments list
82
+
83
+ List all deployments.
52
84
 
53
85
  ```bash
54
- $ esa route delete <route>
86
+ esa-cli deployments list
55
87
  ```
56
88
 
57
- - route `string` `required`
58
- - The name of the routes to delete.
89
+ No additional options.
59
90
 
60
- #### list
91
+ ---
61
92
 
62
- List all related routes.
93
+ ### esa-cli deployments delete [deploymentId...]
94
+
95
+ Delete one or more deployment versions.
63
96
 
64
97
  ```bash
65
- $ esa route list
98
+ esa-cli deployments delete [deploymentId...]
66
99
  ```
67
100
 
68
- ### login
101
+ - Positionals:
102
+ - deploymentId...: Deployment version IDs to delete (one or more)
69
103
 
70
- Login to the server.
71
-
72
- ```bash
73
- $ esa login
74
- ```
104
+ ---
75
105
 
76
- ### dev [entry]
106
+ ### esa-cli project list
107
+
108
+ List all your projects.
77
109
 
78
- Start a local server for developing your routine.
79
-
80
110
  ```bash
81
- $ esa dev [entry] [OPTIONS]
111
+ esa-cli project list
82
112
  ```
83
113
 
84
- - entry `string` `optional`
85
- - Entry file of the Routine.
114
+ No additional options.
86
115
 
87
- - -port, --p `number` `optional`
88
- - Port to listen on.
116
+ ---
89
117
 
90
- - --inspect-port `number` `optional`
91
- - Chrome inspect devTool port.
118
+ ### esa-cli project delete <projectName>
92
119
 
93
- - -minify, --m `boolean` `optional`
94
- - Minify code during development.
120
+ Delete a project.
95
121
 
96
- - --local-upstream `string` `optional`
97
- - Host to act as origin in development.
122
+ ```bash
123
+ esa-cli project delete <projectName>
124
+ ```
98
125
 
99
- - --refresh-command `string` `optional`
100
- - Provide a command to be executed before the auto-refresh on save.
126
+ - Positionals:
127
+ - projectName: The name of the project to delete
101
128
 
102
- ### deployments [script]
129
+ ---
103
130
 
104
- Manage your deployments.
105
-
106
- #### delete <deploymentId>
131
+ ### esa-cli site list
107
132
 
108
- Delete one or more deployment versions.
133
+ List all your sites.
109
134
 
110
135
  ```bash
111
- $ esa deployments delete <deploymentId>
136
+ esa-cli site list
112
137
  ```
113
138
 
114
- - deploymentId `string` `required`
115
- - The ID of the deployments to delete.
139
+ No additional options.
116
140
 
117
- #### list
141
+ ---
118
142
 
119
- List all deployments.
143
+ ### esa-cli domain add <domain>
144
+
145
+ Bind a domain to your project.
120
146
 
121
147
  ```bash
122
- $ esa deployments list
148
+ esa-cli domain add <domain>
123
149
  ```
124
150
 
125
- ### deploy [entry]
151
+ - Positionals:
152
+ - domain: The domain name to bind
153
+
154
+ ---
155
+
156
+ ### esa-cli domain list
157
+
158
+ List all related domains.
126
159
 
127
- Deploy your project.
128
-
129
160
  ```bash
130
- $ esa deploy [entry]
161
+ esa-cli domain list
131
162
  ```
132
163
 
133
- - entry `string` `optional`
134
- - Entry file of the Routine.
164
+ No additional options.
135
165
 
136
- ### domain [script]
166
+ ---
137
167
 
138
- Manage the domain names bound to your routine.
139
-
140
- #### add <domain>
168
+ ### esa-cli domain delete <domain>
141
169
 
142
- Bind a domain to a routine.
170
+ Delete a related domain.
143
171
 
144
172
  ```bash
145
- $ esa domain add <domain>
173
+ esa-cli domain delete <domain>
146
174
  ```
147
175
 
148
- - domain `string` `required`
149
- - The name of domain to add.
176
+ - Positionals:
177
+ - domain: The domain name to delete
150
178
 
151
- #### delete <domain>
179
+ ---
152
180
 
153
- Delete a related domain.
181
+ ### esa-cli route add
182
+
183
+ Bind a route to the current project.
154
184
 
155
185
  ```bash
156
- $ esa domain delete <domain>
186
+ esa-cli route add [route] [site] [--alias <routeName>] [--route <route>] [--site <site>]
157
187
  ```
158
188
 
159
- - domains `string` `required`
160
- - The names of the related domains to delete.
189
+ - Positionals (optional):
190
+ - route: The route value, e.g. example.com/_ or _.example.com/\*
191
+ - site: The site name, e.g. example.com
161
192
 
162
- #### list
193
+ - Options:
194
+ - -r, --route string: Route value, e.g. example.com/\*
195
+ - Host supports leading `*` for suffix match (e.g., `*.example.com`)
196
+ - Path supports trailing `*` for prefix match (e.g., `/api/*`)
197
+ - -s, --site string: Site name (must be an active site)
198
+ - -a, --alias string: Route name (alias)
163
199
 
164
- List all related domains.
200
+ ---
201
+
202
+ ### esa-cli route list
203
+
204
+ List all related routes.
165
205
 
166
206
  ```bash
167
- $ esa domain list
207
+ esa-cli route list
168
208
  ```
169
209
 
170
- ### commit [entry]
210
+ No additional options.
211
+
212
+ ---
213
+
214
+ ### esa-cli route delete <routeName>
215
+
216
+ Delete a related route.
171
217
 
172
- Commit your code, save as a new version.
173
-
174
218
  ```bash
175
- $ esa commit [entry] [OPTIONS]
219
+ esa-cli route delete <routeName>
176
220
  ```
177
221
 
178
- - entry `string` `optional`
179
- - Entry file of the Routine.
222
+ - Positionals:
223
+ - routeName: The name of the route to delete
180
224
 
181
- - -m, --minify `boolean` `optional`
182
- - Minify code before committing.
225
+ ---
183
226
 
184
- ### logout
227
+ ### esa-cli login
228
+
229
+ Login to the server.
185
230
 
186
- Logout.
187
-
188
231
  ```bash
189
- $ esa logout
232
+ esa-cli login
190
233
  ```
191
234
 
192
- ### config
235
+ - Options:
236
+ - --access-key-id, --ak string: AccessKey ID (AK)
237
+ - --access-key-secret, --sk string: AccessKey Secret (SK)
238
+
239
+ ---
240
+
241
+ ### esa-cli logout
242
+
243
+ Logout.
193
244
 
194
- Modify your local or global configuration using -l, -g.
195
-
196
245
  ```bash
197
- $ esa config [OPTIONS]
246
+ esa-cli logout
198
247
  ```
199
248
 
200
- - -g, --global `boolean` `optional`
201
- - Edit global config file.
249
+ ---
202
250
 
203
- - -l, --local `boolean` `optional`
204
- - Edit local config file.
251
+ ### esa-cli config [-l | -g]
205
252
 
206
- ### lang
253
+ Modify your local or global configuration.
207
254
 
208
- Set the language of the CLI.
209
-
210
255
  ```bash
211
- $ esa lang
256
+ esa-cli config [--local] [--global]
212
257
  ```
213
258
 
214
- ### site [script]
259
+ - Options:
260
+ - -l, --local boolean: Edit local config file (default: false)
261
+ - -g, --global boolean: Edit global config file (default: false)
215
262
 
216
- Manage your sites.
217
-
218
- #### list
263
+ ---
219
264
 
220
- List all your sites.
265
+ ### esa-cli lang
266
+
267
+ Set the language of the CLI.
221
268
 
222
269
  ```bash
223
- $ esa site list
270
+ esa-cli lang
224
271
  ```