esa-cli 0.0.2-beta.2 → 0.0.2-beta.21

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 (80) hide show
  1. package/dist/commands/commit/index.js +45 -117
  2. package/dist/commands/commit/prodBuild.js +2 -3
  3. package/dist/commands/common/constant.js +0 -19
  4. package/dist/commands/common/utils.js +419 -0
  5. package/dist/commands/config.js +1 -1
  6. package/dist/commands/deploy/helper.js +51 -72
  7. package/dist/commands/deploy/index.js +48 -187
  8. package/dist/commands/deployments/delete.js +32 -22
  9. package/dist/commands/deployments/index.js +3 -3
  10. package/dist/commands/deployments/list.js +22 -38
  11. package/dist/commands/dev/build.js +3 -3
  12. package/dist/commands/dev/doProcess.js +5 -5
  13. package/dist/commands/dev/ew2/cacheService.js +33 -0
  14. package/dist/commands/dev/ew2/devEntry.js +2 -1
  15. package/dist/commands/dev/ew2/devPack.js +30 -34
  16. package/dist/commands/dev/ew2/kvService.js +46 -0
  17. package/dist/commands/dev/ew2/mock/cache.js +99 -15
  18. package/dist/commands/dev/ew2/mock/kv.js +142 -21
  19. package/dist/commands/dev/ew2/server.js +165 -28
  20. package/dist/commands/dev/index.js +16 -16
  21. package/dist/commands/dev/mockWorker/devPack.js +32 -21
  22. package/dist/commands/dev/mockWorker/server.js +7 -6
  23. package/dist/commands/domain/add.js +3 -3
  24. package/dist/commands/domain/delete.js +7 -7
  25. package/dist/commands/domain/index.js +3 -3
  26. package/dist/commands/domain/list.js +10 -10
  27. package/dist/commands/init/helper.js +761 -0
  28. package/dist/commands/init/index.js +88 -220
  29. package/dist/commands/init/snippets/nextjs/next.config.mjs +6 -0
  30. package/dist/commands/init/snippets/nextjs/next.config.ts +7 -0
  31. package/dist/commands/init/snippets/react-router/react-router.config.ts +7 -0
  32. package/dist/commands/init/template.jsonc +84 -0
  33. package/dist/commands/init/types.js +1 -0
  34. package/dist/commands/lang.js +2 -2
  35. package/dist/commands/login/index.js +74 -34
  36. package/dist/commands/logout.js +6 -6
  37. package/dist/commands/route/add.js +138 -49
  38. package/dist/commands/route/delete.js +33 -27
  39. package/dist/commands/route/helper.js +124 -0
  40. package/dist/commands/route/index.js +3 -3
  41. package/dist/commands/route/list.js +56 -17
  42. package/dist/commands/routine/delete.js +2 -2
  43. package/dist/commands/routine/index.js +3 -3
  44. package/dist/commands/routine/list.js +9 -21
  45. package/dist/commands/site/index.js +2 -2
  46. package/dist/commands/site/list.js +6 -7
  47. package/dist/commands/utils.js +55 -19
  48. package/dist/components/descriptionInput.js +1 -1
  49. package/dist/components/mutiLevelSelect.js +43 -55
  50. package/dist/components/mutiSelectTable.js +1 -1
  51. package/dist/components/selectInput.js +2 -3
  52. package/dist/components/selectItem.js +1 -1
  53. package/dist/docs/Commands_en.md +142 -131
  54. package/dist/docs/Commands_zh_CN.md +139 -127
  55. package/dist/i18n/index.js +2 -2
  56. package/dist/i18n/locales.json +401 -21
  57. package/dist/index.js +27 -20
  58. package/dist/libs/api.js +32 -9
  59. package/dist/libs/apiService.js +262 -84
  60. package/dist/libs/git/index.js +86 -9
  61. package/dist/libs/interface.js +0 -1
  62. package/dist/libs/logger.js +162 -10
  63. package/dist/libs/service.js +2 -2
  64. package/dist/libs/templates/index.js +3 -2
  65. package/dist/utils/checkAssetsExist.js +80 -0
  66. package/dist/utils/checkDevPort.js +3 -17
  67. package/dist/utils/checkEntryFileExist.js +10 -0
  68. package/dist/utils/checkIsRoutineCreated.js +27 -26
  69. package/dist/utils/checkVersion.js +119 -1
  70. package/dist/utils/command.js +149 -0
  71. package/dist/utils/compress.js +136 -0
  72. package/dist/utils/download.js +182 -0
  73. package/dist/utils/fileMd5.js +1 -1
  74. package/dist/utils/fileUtils/base.js +1 -1
  75. package/dist/utils/fileUtils/index.js +69 -28
  76. package/dist/utils/installDeno.js +8 -8
  77. package/dist/utils/installEw2.js +7 -7
  78. package/dist/utils/openInBrowser.js +1 -1
  79. package/dist/utils/prompt.js +97 -0
  80. package/package.json +20 -12
@@ -1,224 +1,235 @@
1
- # Commands
1
+ ## Commands
2
2
 
3
- ### init
3
+ ### esa init [name]
4
+
5
+ Initialize a routine 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 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 dev [entry]
19
25
 
20
- Delete a routine.
26
+ Start a local server for developing your routine.
21
27
 
22
28
  ```bash
23
- $ esa routine delete <routineName>
29
+ esa 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 the Routine
28
34
 
29
- #### list
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)
30
41
 
31
- List all your routines.
42
+ ---
43
+
44
+ ### esa commit [entry]
45
+
46
+ Commit your code and save as a new version.
32
47
 
33
48
  ```bash
34
- $ esa routine list
49
+ esa 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 the routine/version (skip interactive input)
56
+ - -n, --name string: Edge Routine 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 deploy [entry]
61
+
62
+ Deploy your project.
44
63
 
45
64
  ```bash
46
- $ esa route add [route] [site]
65
+ esa deploy [entry]
47
66
  ```
48
67
 
49
- #### delete <route>
50
-
51
- Delete a related route.
68
+ - Positionals:
69
+ - entry: Entry file of the Routine
52
70
 
53
- ```bash
54
- $ esa route delete <route>
55
- ```
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 the routine
75
+ - -a, --assets string: Assets directory (e.g., ./dist)
76
+ - -d, --description string: Description of the version
77
+ - -m, --minify boolean: Minify the code
56
78
 
57
- - route `string` `required`
58
- - The name of the routes to delete.
79
+ ---
59
80
 
60
- #### list
81
+ ### esa deployments [list | delete]
61
82
 
62
- List all related routes.
83
+ Manage your deployments.
63
84
 
64
85
  ```bash
65
- $ esa route list
86
+ esa deployments list
87
+ esa deployments delete [deploymentId...]
66
88
  ```
67
89
 
68
- ### login
90
+ - Subcommands:
91
+ - list: List all deployments
92
+ - delete [deploymentId...]: Delete one or more deployment versions
69
93
 
70
- Login to the server.
71
-
72
- ```bash
73
- $ esa login
74
- ```
94
+ ---
75
95
 
76
- ### dev [entry]
96
+ ### esa routine [list | delete]
97
+
98
+ Manage your routines.
77
99
 
78
- Start a local server for developing your routine.
79
-
80
100
  ```bash
81
- $ esa dev [entry] [OPTIONS]
101
+ esa routine list
102
+ esa routine delete <routineName>
82
103
  ```
83
104
 
84
- - entry `string` `optional`
85
- - Entry file of the Routine.
105
+ - Subcommands:
106
+ - list: List all your routines
107
+ - delete <routineName>: Delete a routine
86
108
 
87
- - -port, --p `number` `optional`
88
- - Port to listen on.
109
+ ---
89
110
 
90
- - --inspect-port `number` `optional`
91
- - Chrome inspect devTool port.
111
+ ### esa site [list]
92
112
 
93
- - -minify, --m `boolean` `optional`
94
- - Minify code during development.
113
+ Manage your sites.
95
114
 
96
- - --local-upstream `string` `optional`
97
- - Host to act as origin in development.
115
+ ```bash
116
+ esa site list
117
+ ```
98
118
 
99
- - --refresh-command `string` `optional`
100
- - Provide a command to be executed before the auto-refresh on save.
119
+ - Subcommands:
120
+ - list: List all your sites
101
121
 
102
- ### deployments [script]
122
+ ---
103
123
 
104
- Manage your deployments.
105
-
106
- #### delete <deploymentId>
124
+ ### esa domain <add | list | delete>
107
125
 
108
- Delete one or more deployment versions.
126
+ Manage the domain names bound to your routine.
109
127
 
110
128
  ```bash
111
- $ esa deployments delete <deploymentId>
129
+ esa domain add <domain>
130
+ esa domain list
131
+ esa domain delete <domain>
112
132
  ```
113
133
 
114
- - deploymentId `string` `required`
115
- - The ID of the deployments to delete.
116
-
117
- #### list
134
+ - Subcommands:
135
+ - add <domain>: Bind a domain to a routine
136
+ - list: List all related domains
137
+ - delete <domain>: Delete a related domain
118
138
 
119
- List all deployments.
139
+ ---
120
140
 
121
- ```bash
122
- $ esa deployments list
123
- ```
141
+ ### esa route <add | list | delete>
124
142
 
125
- ### deploy [entry]
143
+ Manage the routes bound to your routine.
126
144
 
127
- Deploy your project.
128
-
129
145
  ```bash
130
- $ esa deploy [entry]
146
+ esa route add
147
+ esa route list
148
+ esa route delete <routeName>
131
149
  ```
132
150
 
133
- - entry `string` `optional`
134
- - Entry file of the Routine.
151
+ - Subcommands:
152
+ - add: Bind a Route to a routine
153
+ - list: List all related routes
154
+ - delete <routeName>: Delete a related route
135
155
 
136
- ### domain [script]
156
+ #### esa route add
137
157
 
138
- Manage the domain names bound to your routine.
139
-
140
- #### add <domain>
141
-
142
- Bind a domain to a routine.
158
+ Bind a route to the current routine.
143
159
 
144
160
  ```bash
145
- $ esa domain add <domain>
161
+ esa route add [route] [site] [--alias <routeName>] [--route <route>] [--site <site>]
146
162
  ```
147
163
 
148
- - domain `string` `required`
149
- - The name of domain to add.
164
+ - Positionals (optional):
165
+ - route: The route value, e.g. example.com/_ or _.example.com/\*
166
+ - site: The site name, e.g. example.com
150
167
 
151
- #### delete <domain>
168
+ - Options:
169
+ - -r, --route string: Route value, e.g. example.com/\*
170
+ - Host supports leading `*` for suffix match (e.g., `*.example.com`)
171
+ - Path supports trailing `*` for prefix match (e.g., `/api/*`)
172
+ - -s, --site string: Site name (must be an active site)
173
+ - -a, --alias string: Route name (alias)
152
174
 
153
- Delete a related domain.
175
+ - Interactive behavior:
176
+ - If `--alias` is missing, you will be prompted to input a route name
177
+ - If `--site` is missing, you will be prompted to choose from active sites
178
+ - If `--route` is missing, you will be prompted to input the route value
154
179
 
155
- ```bash
156
- $ esa domain delete <domain>
157
- ```
180
+ - Route matching notes:
181
+ - Host supports `*` prefix: `*.example.com` matches any host ending with `.example.com`
182
+ - Path supports `*` suffix: `/api/*` matches any path starting with `/api/`
183
+ - Examples: `example.com/*`, `*.example.com/`, `*.example.com/api/*`
158
184
 
159
- - domains `string` `required`
160
- - The names of the related domains to delete.
185
+ - Examples:
186
+ - `esa route add -a home -s example.com -r example.com/*`
187
+ - `esa route add example.com/* example.com -a home`
161
188
 
162
- #### list
189
+ ---
163
190
 
164
- List all related domains.
191
+ ### esa login
165
192
 
166
- ```bash
167
- $ esa domain list
168
- ```
169
-
170
- ### commit [entry]
193
+ Login to the server.
171
194
 
172
- Commit your code, save as a new version.
173
-
174
195
  ```bash
175
- $ esa commit [entry] [OPTIONS]
196
+ esa login
176
197
  ```
177
198
 
178
- - entry `string` `optional`
179
- - Entry file of the Routine.
199
+ - Options:
200
+ - --access-key-id, --ak string: AccessKey ID (AK)
201
+ - --access-key-secret, --sk string: AccessKey Secret (SK)
180
202
 
181
- - -m, --minify `boolean` `optional`
182
- - Minify code before committing.
203
+ ---
183
204
 
184
- ### logout
205
+ ### esa logout
185
206
 
186
207
  Logout.
187
-
188
- ```bash
189
- $ esa logout
190
- ```
191
208
 
192
- ### config
193
-
194
- Modify your local or global configuration using -l, -g.
195
-
196
209
  ```bash
197
- $ esa config [OPTIONS]
210
+ esa logout
198
211
  ```
199
212
 
200
- - -g, --global `boolean` `optional`
201
- - Edit global config file.
213
+ ---
202
214
 
203
- - -l, --local `boolean` `optional`
204
- - Edit local config file.
215
+ ### esa config [-l | -g]
205
216
 
206
- ### lang
217
+ Modify your local or global configuration.
207
218
 
208
- Set the language of the CLI.
209
-
210
219
  ```bash
211
- $ esa lang
220
+ esa config [--local] [--global]
212
221
  ```
213
222
 
214
- ### site [script]
223
+ - Options:
224
+ - -l, --local boolean: Edit local config file (default: false)
225
+ - -g, --global boolean: Edit global config file (default: false)
215
226
 
216
- Manage your sites.
217
-
218
- #### list
227
+ ---
219
228
 
220
- List all your sites.
229
+ ### esa lang
230
+
231
+ Set the language of the CLI.
221
232
 
222
233
  ```bash
223
- $ esa site list
234
+ esa lang
224
235
  ```