esa-cli 1.0.1 → 1.0.2-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.
- package/README.md +2 -2
- package/dist/commands/commit/index.js +6 -1
- package/dist/commands/common/utils.js +84 -4
- package/dist/commands/deploy/index.js +18 -2
- package/dist/commands/login/index.js +38 -65
- package/dist/commands/utils.js +18 -46
- package/dist/docs/Commands_en.md +261 -140
- package/dist/docs/Commands_zh_CN.md +256 -144
- package/dist/docs/Config_en.md +13 -7
- package/dist/docs/Config_zh_CN.md +13 -7
- package/dist/i18n/locales.json +8 -0
- package/dist/utils/compress.js +9 -3
- package/dist/utils/fileUtils/index.js +1 -1
- package/dist/utils/validateCredentials.js +126 -0
- package/package.json +1 -1
- package/zh_CN.md +2 -2
package/dist/docs/Commands_en.md
CHANGED
|
@@ -1,271 +1,392 @@
|
|
|
1
|
-
## Commands
|
|
1
|
+
## ESA CLI Commands
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ESA CLI offers a number of commands to manage your Alibaba Cloud ESA Functions & Pages.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**init** - Create a new project from a variety of web frameworks and templates.
|
|
6
|
+
**dev** - Start a local server for developing your Functions & Pages.
|
|
7
|
+
**commit** - Commit your code and save as a new version.
|
|
8
|
+
**deploy** - Deploy your Functions & Pages to Alibaba Cloud.
|
|
9
|
+
**deployments** - Manage your deployments and versions.
|
|
10
|
+
**project** - Manage your Functions & Pages projects.
|
|
11
|
+
**site** - List your activated sites.
|
|
12
|
+
**domain** - Manage domain bindings for your Functions & Pages.
|
|
13
|
+
**route** - Manage route bindings for your Functions & Pages.
|
|
14
|
+
**login** - Authorize ESA CLI with your Alibaba Cloud account.
|
|
15
|
+
**logout** - Remove ESA CLI's authorization for accessing your account.
|
|
16
|
+
**config** - Modify your local or global configuration.
|
|
17
|
+
**lang** - Set the language of the CLI.
|
|
18
|
+
|
|
19
|
+
### How to run ESA CLI commands
|
|
20
|
+
|
|
21
|
+
If you have installed esa-cli globally, please refer to the following commands for execution.
|
|
22
|
+
|
|
23
|
+
**Installation**
|
|
6
24
|
|
|
7
|
-
```
|
|
8
|
-
esa-cli
|
|
25
|
+
```
|
|
26
|
+
npm i esa-cli@latest -g
|
|
9
27
|
```
|
|
10
28
|
|
|
11
|
-
|
|
12
|
-
- name: Project name
|
|
29
|
+
**Execute commands**
|
|
13
30
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
31
|
+
```
|
|
32
|
+
esa-cli <COMMAND> <SUBCOMMAND> [PARAMETERS] [OPTIONS]
|
|
33
|
+
```
|
|
21
34
|
|
|
22
35
|
---
|
|
23
36
|
|
|
24
|
-
|
|
37
|
+
If you have installed ESA CLI locally in your project (rather than globally), the way to run ESA CLI will depend on your specific setup and package manager.
|
|
25
38
|
|
|
26
|
-
|
|
39
|
+
```
|
|
40
|
+
npx esa-cli <COMMAND> <SUBCOMMAND> [PARAMETERS] [OPTIONS]
|
|
41
|
+
```
|
|
27
42
|
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
**You can add ESA CLI commands that you use often as scripts in your project's package.json file:**
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
...
|
|
48
|
+
"scripts": {
|
|
49
|
+
"deploy": "esa-cli deploy",
|
|
50
|
+
"dev": "esa-cli dev"
|
|
51
|
+
}
|
|
52
|
+
...
|
|
53
|
+
}
|
|
30
54
|
```
|
|
31
55
|
|
|
32
|
-
|
|
33
|
-
- entry: Entry file of Functions& Pages
|
|
56
|
+
**Then you can run them using your package manager of choice:**
|
|
34
57
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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)
|
|
58
|
+
```
|
|
59
|
+
npm run deploy
|
|
60
|
+
```
|
|
41
61
|
|
|
42
62
|
---
|
|
43
63
|
|
|
44
|
-
|
|
64
|
+
## init
|
|
45
65
|
|
|
46
|
-
|
|
66
|
+
Create a new project via templates. A variety of web frameworks are available to choose from as well as templates. Dependencies are installed by default, with the option to deploy your project immediately.
|
|
47
67
|
|
|
48
|
-
```
|
|
49
|
-
esa-cli
|
|
68
|
+
```
|
|
69
|
+
esa-cli init [<NAME>] [OPTIONS]
|
|
50
70
|
```
|
|
51
71
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
72
|
+
**NAME** _optional (default: name of working directory)_
|
|
73
|
+
The name of the Functions & Pages project. This is both the directory name and name property in the generated ESA CLI configuration.
|
|
74
|
+
|
|
75
|
+
**--framework, -f** _optional_
|
|
76
|
+
Choose a frontend framework (react/vue/nextjs...)
|
|
77
|
+
|
|
78
|
+
**--language, -l** _optional_
|
|
79
|
+
Choose programming language (typescript/javascript). Choices: typescript | javascript
|
|
80
|
+
|
|
81
|
+
**--template, -t** _optional_
|
|
82
|
+
Template name to use
|
|
83
|
+
|
|
84
|
+
**--yes, -y** _optional_
|
|
85
|
+
Answer "Yes" to all prompts (default: false), template uses helloworld
|
|
86
|
+
|
|
87
|
+
**--git** _optional_
|
|
88
|
+
Initialize git repository
|
|
89
|
+
|
|
90
|
+
**--deploy** _optional_
|
|
91
|
+
Deploy after initialization
|
|
57
92
|
|
|
58
93
|
---
|
|
59
94
|
|
|
60
|
-
|
|
95
|
+
## dev
|
|
61
96
|
|
|
62
|
-
|
|
97
|
+
Start a local server for developing your Functions & Pages.
|
|
63
98
|
|
|
64
|
-
```bash
|
|
65
|
-
esa-cli deploy [entry]
|
|
66
99
|
```
|
|
100
|
+
esa-cli dev [<ENTRY>] [OPTIONS]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**ENTRY** _optional_
|
|
104
|
+
Entry file of Functions & Pages
|
|
105
|
+
|
|
106
|
+
**--port, -p** _optional_
|
|
107
|
+
Port to listen on
|
|
108
|
+
|
|
109
|
+
**--minify, -m** _optional_
|
|
110
|
+
Minify code during development (default: false)
|
|
111
|
+
|
|
112
|
+
**--refresh-command** _optional_
|
|
113
|
+
Command to run before auto-refresh on save
|
|
67
114
|
|
|
68
|
-
-
|
|
69
|
-
|
|
115
|
+
**--local-upstream** _optional_
|
|
116
|
+
Host to act as origin in development
|
|
70
117
|
|
|
71
|
-
|
|
72
|
-
|
|
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
|
|
118
|
+
**--debug** _optional_
|
|
119
|
+
Output debug logs (default: false)
|
|
78
120
|
|
|
79
121
|
---
|
|
80
122
|
|
|
81
|
-
|
|
123
|
+
## commit
|
|
82
124
|
|
|
83
|
-
|
|
125
|
+
Commit your code and save as a new version.
|
|
84
126
|
|
|
85
|
-
```bash
|
|
86
|
-
esa-cli deployments list
|
|
87
127
|
```
|
|
128
|
+
esa-cli commit [<ENTRY>] [OPTIONS]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**ENTRY** _optional_
|
|
132
|
+
Entry file of Functions & Pages
|
|
133
|
+
|
|
134
|
+
**--minify, -m** _optional_
|
|
135
|
+
Minify code before committing (default: false)
|
|
136
|
+
|
|
137
|
+
**--assets, -a** _optional_
|
|
138
|
+
Assets directory
|
|
88
139
|
|
|
89
|
-
|
|
140
|
+
**--description, -d** _optional_
|
|
141
|
+
Description for Functions & Pages/version (skip interactive input)
|
|
142
|
+
|
|
143
|
+
**--name, -n** _optional_
|
|
144
|
+
Functions & Pages name
|
|
90
145
|
|
|
91
146
|
---
|
|
92
147
|
|
|
93
|
-
|
|
148
|
+
## deploy
|
|
94
149
|
|
|
95
|
-
|
|
150
|
+
Generate a code version and deploy the project to both staging and production environments.
|
|
96
151
|
|
|
97
|
-
```bash
|
|
98
|
-
esa-cli deployments delete [deploymentId...]
|
|
99
152
|
```
|
|
153
|
+
esa-cli deploy [<ENTRY>] [OPTIONS]
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**ENTRY** _optional_
|
|
157
|
+
Entry file of Functions & Pages, defaults to entry configuration in `esa.jsonc`
|
|
158
|
+
|
|
159
|
+
**--version, -v** _optional_
|
|
160
|
+
Version to deploy (skip interactive selection)
|
|
161
|
+
|
|
162
|
+
**--environment, -e** _optional_
|
|
163
|
+
Environment to deploy to. Choices: staging | production
|
|
164
|
+
|
|
165
|
+
**--name, -n** _optional_
|
|
166
|
+
Name of Functions & Pages
|
|
100
167
|
|
|
101
|
-
-
|
|
102
|
-
|
|
168
|
+
**--assets, -a** _optional_
|
|
169
|
+
Assets directory (e.g., ./dist)
|
|
170
|
+
|
|
171
|
+
**--description, -d** _optional_
|
|
172
|
+
Description of the version
|
|
173
|
+
|
|
174
|
+
**--minify, -m** _optional_
|
|
175
|
+
Whether to minify the code
|
|
103
176
|
|
|
104
177
|
---
|
|
105
178
|
|
|
106
|
-
|
|
179
|
+
## deployments
|
|
107
180
|
|
|
108
|
-
|
|
181
|
+
Manage your deployments and versions.
|
|
182
|
+
|
|
183
|
+
### deployments list
|
|
184
|
+
|
|
185
|
+
List all code versions under the current Functions & Pages.
|
|
109
186
|
|
|
110
|
-
```bash
|
|
111
|
-
esa-cli project list
|
|
112
187
|
```
|
|
188
|
+
esa-cli deployments list
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### deployments delete
|
|
192
|
+
|
|
193
|
+
Delete one or more code versions of the current Functions & Pages.
|
|
113
194
|
|
|
114
|
-
|
|
195
|
+
```
|
|
196
|
+
esa-cli deployments delete [<DEPLOYMENT_ID>...] [OPTIONS]
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**DEPLOYMENT_ID** _required_
|
|
200
|
+
Deployment version IDs to delete (can pass multiple at once)
|
|
115
201
|
|
|
116
202
|
---
|
|
117
203
|
|
|
118
|
-
|
|
204
|
+
## project
|
|
205
|
+
|
|
206
|
+
Manage your Functions & Pages projects.
|
|
207
|
+
|
|
208
|
+
### project list
|
|
209
|
+
|
|
210
|
+
List all Functions & Pages under the account.
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
esa-cli project list
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### project delete
|
|
119
217
|
|
|
120
|
-
Delete
|
|
218
|
+
Delete specified Functions & Pages.
|
|
121
219
|
|
|
122
|
-
```
|
|
123
|
-
esa-cli project delete <
|
|
220
|
+
```
|
|
221
|
+
esa-cli project delete <PROJECT_NAME> [OPTIONS]
|
|
124
222
|
```
|
|
125
223
|
|
|
126
|
-
|
|
127
|
-
|
|
224
|
+
**PROJECT_NAME** _required_
|
|
225
|
+
Name of the Functions or Pages to delete
|
|
128
226
|
|
|
129
227
|
---
|
|
130
228
|
|
|
131
|
-
|
|
229
|
+
## site
|
|
230
|
+
|
|
231
|
+
List your activated sites.
|
|
232
|
+
|
|
233
|
+
### site list
|
|
132
234
|
|
|
133
|
-
List all
|
|
235
|
+
List all activated sites under the account.
|
|
134
236
|
|
|
135
|
-
```
|
|
237
|
+
```
|
|
136
238
|
esa-cli site list
|
|
137
239
|
```
|
|
138
240
|
|
|
139
|
-
No additional options.
|
|
140
|
-
|
|
141
241
|
---
|
|
142
242
|
|
|
143
|
-
|
|
243
|
+
## domain
|
|
244
|
+
|
|
245
|
+
Manage domain bindings for your Functions & Pages.
|
|
144
246
|
|
|
145
|
-
|
|
247
|
+
### domain add
|
|
146
248
|
|
|
147
|
-
|
|
148
|
-
|
|
249
|
+
Bind a domain to the current Functions & Pages.
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
esa-cli domain add <DOMAIN> [OPTIONS]
|
|
149
253
|
```
|
|
150
254
|
|
|
151
|
-
|
|
152
|
-
- domain: The domain name to bind
|
|
255
|
+
**Only sites activated under this account can be bound**
|
|
153
256
|
|
|
154
|
-
|
|
257
|
+
**DOMAIN** _required_
|
|
258
|
+
The domain name to bind (must be activated under the account's sites)
|
|
155
259
|
|
|
156
|
-
###
|
|
260
|
+
### domain list
|
|
157
261
|
|
|
158
|
-
|
|
262
|
+
View all bound domains for the current Functions & Pages.
|
|
159
263
|
|
|
160
|
-
```
|
|
264
|
+
```
|
|
161
265
|
esa-cli domain list
|
|
162
266
|
```
|
|
163
267
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
---
|
|
268
|
+
### domain delete
|
|
167
269
|
|
|
168
|
-
|
|
270
|
+
Delete bound domains under the current Functions & Pages.
|
|
169
271
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
esa-cli domain delete <domain>
|
|
272
|
+
```
|
|
273
|
+
esa-cli domain delete <DOMAIN> [OPTIONS]
|
|
174
274
|
```
|
|
175
275
|
|
|
176
|
-
|
|
177
|
-
|
|
276
|
+
**DOMAIN** _required_
|
|
277
|
+
The domain name to delete binding
|
|
178
278
|
|
|
179
279
|
---
|
|
180
280
|
|
|
181
|
-
|
|
281
|
+
## route
|
|
182
282
|
|
|
183
|
-
|
|
283
|
+
Manage route bindings for your Functions & Pages.
|
|
184
284
|
|
|
185
|
-
|
|
186
|
-
|
|
285
|
+
### route add
|
|
286
|
+
|
|
287
|
+
Bind a route to the current Functions & Pages.
|
|
288
|
+
|
|
289
|
+
```
|
|
290
|
+
esa-cli route add [<ROUTE>] [<SITE>] [OPTIONS]
|
|
187
291
|
```
|
|
188
292
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
- site: The site name, e.g. example.com
|
|
293
|
+
**ROUTE** _optional_
|
|
294
|
+
Route value, e.g. example.com/_ or _.example.com/\*
|
|
192
295
|
|
|
193
|
-
|
|
194
|
-
|
|
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)
|
|
296
|
+
**SITE** _optional_
|
|
297
|
+
Site name, e.g. example.com
|
|
199
298
|
|
|
200
|
-
|
|
299
|
+
**Only sites activated under this account can be bound**
|
|
201
300
|
|
|
202
|
-
|
|
301
|
+
**--route, -r** _optional_
|
|
302
|
+
Route value, e.g. example.com/\*
|
|
203
303
|
|
|
204
|
-
|
|
304
|
+
- Host supports leading `*` for suffix match (e.g., `*.example.com`)
|
|
305
|
+
- Path supports trailing `*` for prefix match (e.g., `/api/*`)
|
|
205
306
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
```
|
|
307
|
+
**--site, -s** _optional_
|
|
308
|
+
Site name (must be an activated site under the account)
|
|
209
309
|
|
|
210
|
-
|
|
310
|
+
**--alias, -a** _optional_
|
|
311
|
+
Route name (alias) e.g. apple, orange, etc.
|
|
211
312
|
|
|
212
|
-
|
|
313
|
+
### route list
|
|
314
|
+
|
|
315
|
+
View all bound routes under the current Functions & Pages.
|
|
316
|
+
|
|
317
|
+
```
|
|
318
|
+
esa-cli route list
|
|
319
|
+
```
|
|
213
320
|
|
|
214
|
-
###
|
|
321
|
+
### route delete
|
|
215
322
|
|
|
216
|
-
Delete
|
|
323
|
+
Delete bound routes under Functions & Pages.
|
|
217
324
|
|
|
218
|
-
```
|
|
219
|
-
esa-cli route delete <
|
|
325
|
+
```
|
|
326
|
+
esa-cli route delete <ROUTE_NAME> [OPTIONS]
|
|
220
327
|
```
|
|
221
328
|
|
|
222
|
-
|
|
223
|
-
|
|
329
|
+
**ROUTE_NAME** _required_
|
|
330
|
+
The name of the route to delete
|
|
224
331
|
|
|
225
332
|
---
|
|
226
333
|
|
|
227
|
-
|
|
334
|
+
## login
|
|
228
335
|
|
|
229
|
-
|
|
336
|
+
Authorize ESA CLI with your Alibaba Cloud account.
|
|
230
337
|
|
|
231
|
-
```bash
|
|
232
|
-
esa-cli login
|
|
233
338
|
```
|
|
339
|
+
esa-cli login [OPTIONS]
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
**--access-key-id, --ak** _optional_
|
|
343
|
+
AccessKey ID (AK)
|
|
344
|
+
|
|
345
|
+
**--access-key-secret, --sk** _optional_
|
|
346
|
+
AccessKey Secret (SK)
|
|
347
|
+
|
|
348
|
+
**--endpoint, -e** _optional_
|
|
349
|
+
API endpoint URL Example: esa.cn-hangzhou.aliyuncs.com
|
|
234
350
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
351
|
+
**Environment Variables**
|
|
352
|
+
Read from environment variables:
|
|
353
|
+
|
|
354
|
+
- **ESA_ACCESS_KEY_ID**
|
|
355
|
+
- **ESA_ACCESS_KEY_SECRET**
|
|
356
|
+
- **ESA_ENDPOINT**
|
|
238
357
|
|
|
239
358
|
---
|
|
240
359
|
|
|
241
|
-
|
|
360
|
+
## logout
|
|
242
361
|
|
|
243
|
-
|
|
362
|
+
Remove ESA CLI's authorization for accessing your account.
|
|
244
363
|
|
|
245
|
-
```
|
|
364
|
+
```
|
|
246
365
|
esa-cli logout
|
|
247
366
|
```
|
|
248
367
|
|
|
249
368
|
---
|
|
250
369
|
|
|
251
|
-
|
|
370
|
+
## config
|
|
252
371
|
|
|
253
372
|
Modify your local or global configuration.
|
|
254
373
|
|
|
255
|
-
```
|
|
256
|
-
esa-cli config [
|
|
374
|
+
```
|
|
375
|
+
esa-cli config [OPTIONS]
|
|
257
376
|
```
|
|
258
377
|
|
|
259
|
-
-
|
|
260
|
-
|
|
261
|
-
|
|
378
|
+
**--local, -l** _optional_
|
|
379
|
+
Edit local config file (default: false)
|
|
380
|
+
|
|
381
|
+
**--global, -g** _optional_
|
|
382
|
+
Edit global config file (default: false)
|
|
262
383
|
|
|
263
384
|
---
|
|
264
385
|
|
|
265
|
-
|
|
386
|
+
## lang
|
|
266
387
|
|
|
267
388
|
Set the language of the CLI.
|
|
268
389
|
|
|
269
|
-
```
|
|
390
|
+
```
|
|
270
391
|
esa-cli lang
|
|
271
392
|
```
|