@serverless-devs/s 2.0.96 → 2.0.97-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/lib/clean/index.js +1 -1
- package/lib/cli/index.js +1 -1
- package/lib/component/index.js +1 -1
- package/lib/config/add/index.js +1 -1
- package/lib/config/delete/index.js +1 -1
- package/lib/config/get/index.js +1 -1
- package/lib/config/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/init/index.js +1 -1
- package/lib/set/analysis/index.js +1 -1
- package/lib/set/index.js +1 -1
- package/lib/set/locale/index.js +1 -1
- package/lib/set/registry/index.js +1 -1
- package/lib/set/workspace/index.js +1 -1
- package/lib/update-notifier/index.js +1 -1
- package/package.json +2 -2
- package/CODE_OF_CONDUCT.md +0 -5
- package/CONTRIBUTING.md +0 -189
- package/CONTRIBUTORS.md +0 -148
- package/docs/readme.md +0 -100
- package/docs/zh/awesome.md +0 -20
- package/docs/zh/cicd.md +0 -231
- package/docs/zh/cli_design.md +0 -100
- package/docs/zh/command/clean.md +0 -63
- package/docs/zh/command/cli.md +0 -92
- package/docs/zh/command/component.md +0 -75
- package/docs/zh/command/config.md +0 -274
- package/docs/zh/command/custom.md +0 -73
- package/docs/zh/command/init.md +0 -149
- package/docs/zh/command/readme.md +0 -76
- package/docs/zh/command/set.md +0 -195
- package/docs/zh/default_provider_config/alibabacloud.md +0 -82
- package/docs/zh/default_provider_config/aws.md +0 -12
- package/docs/zh/default_provider_config/azure.md +0 -9
- package/docs/zh/default_provider_config/baiducloud.md +0 -8
- package/docs/zh/default_provider_config/gcp.md +0 -21
- package/docs/zh/default_provider_config/huaweicloud.md +0 -52
- package/docs/zh/default_provider_config/readme.md +0 -9
- package/docs/zh/default_provider_config/tencentcloud.md +0 -41
- package/docs/zh/install.md +0 -52
- package/docs/zh/package_dev.md +0 -142
- package/docs/zh/quick_start.md +0 -297
- package/docs/zh/readme.md +0 -92
- package/docs/zh/tool.md +0 -101
- package/docs/zh/yaml.md +0 -207
- package/docs/zh/yaml_and_cli.md +0 -67
- package/jest.setup.ts +0 -37
- package/spec/readme.md +0 -59
- package/spec/zh/0.0.1/readme.md +0 -47
- package/spec/zh/0.0.1/serverless_package_model/1.purpose_and_goals.md +0 -3
- package/spec/zh/0.0.1/serverless_package_model/2.overview_and_terminology.md +0 -14
- package/spec/zh/0.0.1/serverless_package_model/3.package_model.md +0 -434
- package/spec/zh/0.0.1/serverless_package_model/4.application_scopes.md +0 -3
- package/spec/zh/0.0.1/serverless_package_model/5.design_principles.md +0 -3
- package/spec/zh/0.0.1/serverless_package_model/readme.md +0 -12
- package/spec/zh/0.0.1/serverless_registry_model/1.purpose_and_goals.md +0 -18
- package/spec/zh/0.0.1/serverless_registry_model/2.overview_and_terminology.md +0 -18
- package/spec/zh/0.0.1/serverless_registry_model/3.registry_model.md +0 -61
- package/spec/zh/0.0.1/serverless_registry_model/4.application_scopes.md +0 -6
- package/spec/zh/0.0.1/serverless_registry_model/5.design_principles.md +0 -3
- package/spec/zh/0.0.1/serverless_registry_model/readme.md +0 -12
- package/spec/zh/0.0.1/serverless_user_model/1.purpose_and_goals.md +0 -3
- package/spec/zh/0.0.1/serverless_user_model/2.overview_and_terminology.md +0 -16
- package/spec/zh/0.0.1/serverless_user_model/3.user_model.md +0 -218
- package/spec/zh/0.0.1/serverless_user_model/4.application_scopes.md +0 -4
- package/spec/zh/0.0.1/serverless_user_model/5.design_principles.md +0 -3
- package/spec/zh/0.0.1/serverless_user_model/readme.md +0 -12
- package/test/ci.sh +0 -33
- package/test/cli/cli-manager.test.ts +0 -64
- package/test/config/get.test.ts +0 -12
- package/test/helloworld.test.ts +0 -7
- package/test/start-fc-http-nodejs12/code/index.js +0 -47
- package/test/start-fc-http-nodejs12/s.yaml +0 -38
- package/test/utils/index.test.ts +0 -8
- package/test/utils/storage.test.ts +0 -19
- package/tsconfig.json +0 -37
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
# Component 命令
|
|
2
|
-
|
|
3
|
-
`component`命令是获取已经安装的组件详情信息。
|
|
4
|
-
|
|
5
|
-
- [命令解析](#命令解析)
|
|
6
|
-
- [参数解析](#参数解析)
|
|
7
|
-
- [操作案例](#操作案例)
|
|
8
|
-
- [注意事项](#注意事项)
|
|
9
|
-
|
|
10
|
-
## 命令解析
|
|
11
|
-
|
|
12
|
-
当我们执行`s component -h`之后,可以进行相关帮助信息的查看:
|
|
13
|
-
|
|
14
|
-
```shell script
|
|
15
|
-
$ s component -h
|
|
16
|
-
Usage: s component [options]
|
|
17
|
-
|
|
18
|
-
Get details of installed components.
|
|
19
|
-
|
|
20
|
-
Example:
|
|
21
|
-
$ s component
|
|
22
|
-
$ s component --component fc-api
|
|
23
|
-
|
|
24
|
-
📖 Document: https://github.com/Serverless-Devs/Serverless-Devs/tree/master/docs/zh/command/component.md
|
|
25
|
-
|
|
26
|
-
Options:
|
|
27
|
-
--component [componentName] Gets the specified component information (like: fc, fc@0.0.1)
|
|
28
|
-
-h, --help Display help for command
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### 参数解析
|
|
32
|
-
|
|
33
|
-
| 参数全称 | 参数缩写 | 是否必填 | 参数含义 |
|
|
34
|
-
|-----|-----|-----|-----|
|
|
35
|
-
| name | | 选填 | 获取指定的组件信息,可以是组件名,也可以是[组件名@版本号] |
|
|
36
|
-
|
|
37
|
-
### 操作案例
|
|
38
|
-
|
|
39
|
-
如果想要获取某个组件,可以通过`--component`参数与具体的组件名进行清理,例如:
|
|
40
|
-
|
|
41
|
-
```shell script
|
|
42
|
-
$ s component --component fc-api
|
|
43
|
-
Component: fc
|
|
44
|
-
Reigstry: serverless registry [http://registry.devsapp.cn/simple]
|
|
45
|
-
Version: 0.1.27
|
|
46
|
-
Size: 100 MB
|
|
47
|
-
Description: 阿里云函数计算基础组件
|
|
48
|
-
Path: ~/.s/components/fc
|
|
49
|
-
Hompage: https://github.com/devsapp/fc
|
|
50
|
-
|
|
51
|
-
🙋 Delete the component, please use the command [s clean --component fc@0.1.27]
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
如果想要获取所有已经安装的组件信息,可以直接执行`s component`获取,例如:
|
|
55
|
-
|
|
56
|
-
```shell script
|
|
57
|
-
$ s component
|
|
58
|
-
|
|
59
|
-
🔎 serverless registry [http://registry.devsapp.cn/simple]
|
|
60
|
-
Component Description Size Version
|
|
61
|
-
fc 阿里云函数计算基础组件 100 MB 0.1.27
|
|
62
|
-
devsapp/fc 阿里云函数计算基础组件 100 MB 0.1.27
|
|
63
|
-
fc-api 函数计算api操作组件 100 MB 0.0.44
|
|
64
|
-
|
|
65
|
-
🔎 github registry [https://api.github.com/repos]
|
|
66
|
-
Component Description Size Version
|
|
67
|
-
fc 阿里云函数计算基础组件 100 MB 0.1.27
|
|
68
|
-
devsapp/fc 阿里云函数计算基础组件 100 MB 0.1.27
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
## 注意事项
|
|
74
|
-
|
|
75
|
-
在查询组件时,系统只会显示当前 Registry 与默认的 Github Reigstry 信息。如果需要查看其他 Reigstry 的信息,需要先通过`s set registry`进行 Reigstry 的切换
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
# Config 命令
|
|
2
|
-
|
|
3
|
-
`config`命令是密钥信息相关的命令,包括密钥的配置、密钥的查看以及密钥的修改、删除等。
|
|
4
|
-
|
|
5
|
-
- [命令解析](#命令解析)
|
|
6
|
-
- [config add 命令](#config-add-命令)
|
|
7
|
-
- [参数解析](#参数解析)
|
|
8
|
-
- [操作案例](#操作案例)
|
|
9
|
-
- [config get 命令](#config-get-命令)
|
|
10
|
-
- [参数解析](#参数解析-1)
|
|
11
|
-
- [操作案例](#操作案例-1)
|
|
12
|
-
- [config delete 命令](#config-delete-命令)
|
|
13
|
-
- [参数解析](#参数解析-2)
|
|
14
|
-
- [操作案例](#操作案例-2)
|
|
15
|
-
- [注意事项](#注意事项)
|
|
16
|
-
- [通过环境变量设置密钥](#通过环境变量设置密钥)
|
|
17
|
-
- [关于配置密钥的使用顺序](#关于配置密钥的使用顺序)
|
|
18
|
-
|
|
19
|
-
## 命令解析
|
|
20
|
-
|
|
21
|
-
当执行`s config -h`之后,可以进行相关帮助信息的查看:
|
|
22
|
-
|
|
23
|
-
```shell script
|
|
24
|
-
Usage: s config [commands] [options]
|
|
25
|
-
|
|
26
|
-
Configure venders account, including Alibaba Cloud, Baidu Cloud, Huawei Cloud, Tencent Cloud, etc.
|
|
27
|
-
|
|
28
|
-
📖 Document: https://github.com/Serverless-Devs/Serverless-Devs/tree/master/docs/zh/command/config.md
|
|
29
|
-
|
|
30
|
-
Options:
|
|
31
|
-
-h, --help Display help for command
|
|
32
|
-
|
|
33
|
-
Commands:
|
|
34
|
-
add ➕ Add an account
|
|
35
|
-
get ✔️ Get accounts
|
|
36
|
-
delete ✖️ Delete an account
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
在该命令中,包括了三个子命令:
|
|
40
|
-
- [add:添加密钥配置](#config-add-命令)
|
|
41
|
-
- [get:查看密钥配置](#config-get-命令)
|
|
42
|
-
- [delete:删除密钥配置](#config-delete-命令)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## config add 命令
|
|
46
|
-
|
|
47
|
-
通过`config add`命令,可以进行密钥的配置,使用者可以通过不同厂商的默认密钥模板进行密钥配置,也可以通过`Custom`选项进行自定义密钥配置。
|
|
48
|
-
|
|
49
|
-
通过`-h/--help`可以查看到配置帮助:
|
|
50
|
-
|
|
51
|
-
```shell script
|
|
52
|
-
Usage: s config add [commands] [name]
|
|
53
|
-
|
|
54
|
-
You can add an account
|
|
55
|
-
|
|
56
|
-
Example:
|
|
57
|
-
$ s config add
|
|
58
|
-
$ s config add --AccessKey ****** --SecretKey ******
|
|
59
|
-
$ s config add --AccessKeyID ****** --AccessKeySecret ****** --AccountID ****** --SecurityToken ******
|
|
60
|
-
$ s config add --keyList key1,key2,key3 --valueList value1,value2,value3
|
|
61
|
-
|
|
62
|
-
Configuration parameters template for vendors:
|
|
63
|
-
alibaba: AccountID, AccessKeyID, AccessKeySecret
|
|
64
|
-
aws: AccessKeyID, SecretAccessKey
|
|
65
|
-
baidu: AccessKeyID, SecretAccessKey
|
|
66
|
-
huawei: AccessKey, SecretKey
|
|
67
|
-
google: PrivateKeyData
|
|
68
|
-
tencent: AccountID, SecretID, SecretKey
|
|
69
|
-
|
|
70
|
-
🧭 How to get the key: https://github.com/Serverless-Devs/docs/tree/master/zh/others/provider-config
|
|
71
|
-
|
|
72
|
-
Options:
|
|
73
|
-
--AccountID [AccountID] AccountID of key information
|
|
74
|
-
--AccessKeyID [AccessKeyID] AccessKeyID of key information
|
|
75
|
-
--AccessKeySecret [AccessKeySecret] AccessKeySecret of key information
|
|
76
|
-
--SecurityToken [SecurityToken] SecurityToken of key information
|
|
77
|
-
--SecretAccessKey [SecretAccessKey] SecretAccessKey of key information
|
|
78
|
-
--AccessKey [AccessKey] AccessKey of key information
|
|
79
|
-
--SecretKey [SecretKey] SecretKey of key information
|
|
80
|
-
--SecretID [SecretID] SecretID of key information
|
|
81
|
-
--PrivateKeyData [PrivateKeyData] PrivateKeyData of key information
|
|
82
|
-
-kl , --keyList [keyList] Keys of key information, like: -kl key1,key2,key3
|
|
83
|
-
-il , --infoList [infoList] Values of key information, like: -il info1,info2,info3
|
|
84
|
-
-a, --access [aliasName] Key pair alias, if the alias is not set, use default instead
|
|
85
|
-
-f Mandatory overwrite key information
|
|
86
|
-
-h, --help Display help for command
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
### 参数解析
|
|
91
|
-
|
|
92
|
-
| 参数全称 | 参数缩写 | 是否必填 | 参数含义 |
|
|
93
|
-
|-----|-----|-----|-----|
|
|
94
|
-
| AccountID | - | 选填 | 部分云厂商配置密钥所需要的默认字段 |
|
|
95
|
-
| AccessKeyID | - | 选填 | 部分云厂商配置密钥所需要的默认字段 |
|
|
96
|
-
| AccessKeySecret | - | 选填 | 部分云厂商配置密钥所需要的默认字段 |
|
|
97
|
-
| SecurityToken | - | 选填 | 部分云厂商配置密钥所需要的默认字段 |
|
|
98
|
-
| SecretAccessKey | - | 选填 | 部分云厂商配置密钥所需要的默认字段 |
|
|
99
|
-
| AccessKey | - | 选填 | 部分云厂商配置密钥所需要的默认字段 |
|
|
100
|
-
| SecretKey | - | 选填 | 部分云厂商配置密钥所需要的默认字段 |
|
|
101
|
-
| SecretID | - | 选填 | 部分云厂商配置密钥所需要的默认字段 |
|
|
102
|
-
| PrivateKeyData | - | 选填 | 部分云厂商配置密钥所需要的默认字段 |
|
|
103
|
-
| keyList | kl | 选填 | 在默认字段无法满足配置诉求时,可以通过`keyList`与`infoList`进行批量自定义配置 |
|
|
104
|
-
| infoList | il | 选填 | 在默认字段无法满足配置诉求时,可以通过``keyList`与`infoList`进行批量自定义配置 |
|
|
105
|
-
| access | a | 选填 | 密钥的别名 |
|
|
106
|
-
| f | - | 选填 | 强制修改/覆盖已经配置的密钥信息 |
|
|
107
|
-
|
|
108
|
-
### 操作案例
|
|
109
|
-
|
|
110
|
-
可以通过`config add`直接进行密钥的添加:
|
|
111
|
-
|
|
112
|
-
```shell script
|
|
113
|
-
$ s config add
|
|
114
|
-
|
|
115
|
-
? Please select a provider: (Use arrow keys)
|
|
116
|
-
❯ Alibaba Cloud (alibaba)
|
|
117
|
-
AWS (aws)
|
|
118
|
-
Azure (azure)
|
|
119
|
-
Baidu Cloud (baidu)
|
|
120
|
-
Google Cloud (google)
|
|
121
|
-
Huawei Cloud (huawei)
|
|
122
|
-
Tencent Cloud (tencent)
|
|
123
|
-
Custom (others)
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
当使用者选择某个选项之后,系统会进行交互式引导:
|
|
127
|
-
|
|
128
|
-
```shell script
|
|
129
|
-
s config add
|
|
130
|
-
|
|
131
|
-
? Please select a provider: Alibaba Cloud (alibaba)
|
|
132
|
-
? AccountID **********
|
|
133
|
-
? AccessKeyID **********
|
|
134
|
-
? AccessKeySecret **********
|
|
135
|
-
? Please create alias for key pair. If not, please enter to skip default
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
也可以通过命令式直接进行密钥的添加:
|
|
139
|
-
```shell script
|
|
140
|
-
$ s config add --AccessKeyID ****** --AccessKeySecret ****** --AccountID ******
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
或者添加自定义内容:
|
|
144
|
-
```shell script
|
|
145
|
-
$ s config add --AccessKeyID ****** -kl key1,key2,key3 -il info1,info2,info3
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
- 常见云厂商密钥配置内容
|
|
149
|
-
|
|
150
|
-
```
|
|
151
|
-
alibaba: AccountID, AccessKeyID, AccessKeySecret,
|
|
152
|
-
aws: AccessKeyID, SecretAccessKey,
|
|
153
|
-
baidu: AccessKeyID, SecretAccessKey,
|
|
154
|
-
huawei: AccessKeyID, SecretAccessKey,
|
|
155
|
-
azure: KeyVaultName, TenantID, ClientID, ClientSecret,
|
|
156
|
-
tencent: AccountID, SecretID, SecretKey,
|
|
157
|
-
google: PrivateKeyData
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
> - 通过环境变量获取密钥方法: 这一部分可能会根据不同的文档有不同的可能性,所以需要参考对应的文档进行环境变量对应的`Key-Value`确定。
|
|
161
|
-
> - 常见云厂商密钥获取地址:
|
|
162
|
-
> - [阿里云](./../default_provider_config/alibabacloud.md)
|
|
163
|
-
> - [百度云](./../default_provider_config/baiducloud.md)
|
|
164
|
-
> - [AWS](./../default_provider_config/aws.md)
|
|
165
|
-
> - [Azure](./../default_provider_config/azure.md)
|
|
166
|
-
> - [Google Cloud](./../default_provider_config/gcp.md)
|
|
167
|
-
> - [华为云](./../default_provider_config/huaweicloud.md)
|
|
168
|
-
> - [腾讯云](./../default_provider_config/tencentcloud.md)
|
|
169
|
-
|
|
170
|
-
## config get 命令
|
|
171
|
-
|
|
172
|
-
通过`config get`命令,您可以获得配置过的账号信息。
|
|
173
|
-
|
|
174
|
-
通过`-h/--help`可以查看到配置帮助:
|
|
175
|
-
|
|
176
|
-
```shell script
|
|
177
|
-
$ s config get -h
|
|
178
|
-
|
|
179
|
-
Usage: s config get [options] [name]
|
|
180
|
-
|
|
181
|
-
You can get accounts.
|
|
182
|
-
|
|
183
|
-
Example:
|
|
184
|
-
$ s config get
|
|
185
|
-
$ s config get -a demo
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
Options:
|
|
189
|
-
-a, --access [aliasName] Key pair alia, if the alias is not set, use default instead
|
|
190
|
-
-h, --help Display help for command
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### 参数解析
|
|
194
|
-
|
|
195
|
-
| 参数全称 | 参数缩写 | 是否必填 | 参数含义 |
|
|
196
|
-
|-----|-----|-----|-----|
|
|
197
|
-
| access | a | 选填 | 密钥的别名 |
|
|
198
|
-
|
|
199
|
-
### 操作案例
|
|
200
|
-
|
|
201
|
-
如果想要获取某个已经配置的密钥详情,可以通过`config get`进行获取,例如,想要获取别名为`test`的密钥信息,就可以执行:
|
|
202
|
-
|
|
203
|
-
```shell script
|
|
204
|
-
$ s config get -a test
|
|
205
|
-
test:
|
|
206
|
-
AccountID: 146**********468
|
|
207
|
-
AccessKeyID: LTA******************f5Q
|
|
208
|
-
AccessKeySecret: qDN************************Xp7
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
如果想获得全部的一配置的密钥信息,可以直接通过`config get`不加参数的形式获取:
|
|
212
|
-
|
|
213
|
-
```shell script
|
|
214
|
-
$ s config get
|
|
215
|
-
default:
|
|
216
|
-
AccountID: 158**********465
|
|
217
|
-
AccessKeyID: LTA******************ZCW
|
|
218
|
-
AccessKeySecret: mDL************************odO
|
|
219
|
-
test:
|
|
220
|
-
AccountID: 146**********468
|
|
221
|
-
AccessKeyID: LTA******************f5Q
|
|
222
|
-
AccessKeySecret: qDN************************Xp7
|
|
223
|
-
release:
|
|
224
|
-
AccountID: 176**********635
|
|
225
|
-
AccessKeyID: LTA******************Yy3
|
|
226
|
-
AccessKeySecret: LhT************************VB5
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
## config delete 命令
|
|
230
|
-
|
|
231
|
-
通过`config delete`命令,您可以删除配置过的账号信息。
|
|
232
|
-
|
|
233
|
-
通过`-h/--help`可以查看到配置帮助:
|
|
234
|
-
|
|
235
|
-
```shell script
|
|
236
|
-
$ s config delete -h
|
|
237
|
-
|
|
238
|
-
Usage: s config delete [options] [name]
|
|
239
|
-
|
|
240
|
-
You can delete an account.
|
|
241
|
-
|
|
242
|
-
Example:
|
|
243
|
-
$ s config delete -a demo
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
Options:
|
|
247
|
-
-a, --access [aliasName] Key pair alias, if the alias is not set, use default instead
|
|
248
|
-
-h,--help Display help for command
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### 参数解析
|
|
252
|
-
|
|
253
|
-
| 参数全称 | 参数缩写 | 是否必填 | 参数含义 |
|
|
254
|
-
|-----|-----|-----|-----|
|
|
255
|
-
| access | a | 必填 | 密钥的别名 |
|
|
256
|
-
|
|
257
|
-
### 操作案例
|
|
258
|
-
|
|
259
|
-
如果想要删除某个已经配置的密钥,可以通过`config delete`进行删除,例如,想要删除别名为`test`的密钥信息,就可以执行:
|
|
260
|
-
|
|
261
|
-
```shell script
|
|
262
|
-
$ s config delete -a test
|
|
263
|
-
Key [test] has been successfully removed
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
## 注意事项
|
|
267
|
-
|
|
268
|
-
### 通过环境变量设置密钥
|
|
269
|
-
|
|
270
|
-
详情可以参考:[开发者工具设计文档](../tool.md) 中的 [通过环境变量设置密钥](../tool.md#通过环境变量设置密钥)
|
|
271
|
-
|
|
272
|
-
### 关于配置密钥的使用顺序
|
|
273
|
-
|
|
274
|
-
详情可以参考:[开发者工具设计文档](../tool.md) 中的 [通过环境变量设置密钥](../tool.md#密钥使用顺序与规范)
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# 自定义命令使用指南
|
|
2
|
-
|
|
3
|
-
- [应用级操作](#应用级操作)
|
|
4
|
-
- [服务级操作](#服务级操作)
|
|
5
|
-
- [注意事项](#注意事项)
|
|
6
|
-
|
|
7
|
-
所谓的自定义命令指的是由组件决定的命令。由于 Serverless Devs 开发者工具,本身并不具备任何业务相关的能力(值得包括不限于函数的部署、应用的构建、项目的测试等),所以,这些能力都将会由组件提供,通过 Serverless Devs 开发者工具进行透出。
|
|
8
|
-
|
|
9
|
-
例如,某应用的资源/行为描述文件如下:
|
|
10
|
-
|
|
11
|
-
```yaml
|
|
12
|
-
edition: 1.0.0 # 命令行YAML规范版本,遵循语义化版本(Semantic Versioning)规范
|
|
13
|
-
name: FullStack # 项目名称
|
|
14
|
-
access: xxx-account1
|
|
15
|
-
|
|
16
|
-
services:
|
|
17
|
-
backend: # 服务名称
|
|
18
|
-
component: django-component # 组件名称
|
|
19
|
-
props: # 组件的属性值
|
|
20
|
-
src: ./backend_src
|
|
21
|
-
url: url
|
|
22
|
-
user—frontend: # 服务名称
|
|
23
|
-
component: vue-component # 组件名称
|
|
24
|
-
props: # 组件的属性值
|
|
25
|
-
src: ./frontend_src_user
|
|
26
|
-
url: url
|
|
27
|
-
admin-frontend: # 服务名称
|
|
28
|
-
component: vue-component # 组件名称
|
|
29
|
-
props: # 组件的属性值
|
|
30
|
-
src: ./frontend_src_admin
|
|
31
|
-
url: url
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
通过该 Yaml 文件可以看出以下信息:
|
|
35
|
-
1. 该应用的名字是`FullStack`,将会使用密钥`xxx-account1`;
|
|
36
|
-
2. 该应用拥有三个服务:
|
|
37
|
-
- `backend`服务:使用了`django-component`组件
|
|
38
|
-
- `user—frontend`服务:使用了`vue-component`组件
|
|
39
|
-
- `admin-frontend`服务:使用了`vue-component`组件
|
|
40
|
-
|
|
41
|
-
如果此时`django-component`组件和`vue-component`组件支持的自定义命令为:
|
|
42
|
-
|
|
43
|
-
| | `django-component` | `vue-component` |
|
|
44
|
-
| --- | --- | --- |
|
|
45
|
-
| `deploy` | 支持 | 支持 |
|
|
46
|
-
| `remove` | 支持 | 支持 |
|
|
47
|
-
| `test` | 支持 | 不支持 |
|
|
48
|
-
|
|
49
|
-
则可以通过自定义命令实现[应用级操作](#应用级操作)和[服务级操作](#服务级操作)。
|
|
50
|
-
|
|
51
|
-
## 应用级操作
|
|
52
|
-
|
|
53
|
-
在当前项目下,可以执行`s [自定义命令]`实现应用纬度的操作。
|
|
54
|
-
|
|
55
|
-
- 执行`s deploy`或者`s remove`时,由于`backend`、`user—frontend`、`admin-frontend`三个服务对应的组件,均支持`deploy`和`remove`方法,所以此时系统会按照[Serverless User Model所定义的服务顺序](../../../spec/zh/0.0.1/serverless_user_model/3.user_model.md#服务顺序),进行三个服务分别对应的组件的`deploy`或`remove`操作;**此时,系统的`exit code`为0;**
|
|
56
|
-
- 执行`s test`时,由于`user—frontend`、`admin-frontend`两个服务对应的组件并不支持`test`方法,所以此时系统会执行`backend`对应组件(`django-component`)的`test`操作;**此时,系统会对`user—frontend`、`admin-frontend`两个服务进行警告,但是并不会报错,最终的`exit code`为0;**
|
|
57
|
-
- 如果在执行相关的命令时,`backend`、`user—frontend`、`admin-frontend`三个服务任何一个服务在执行过程中出现了错误,系统则会报错,并终止下一步的操作,**此时,系统的`exit code`为101;**
|
|
58
|
-
|
|
59
|
-
> 关于Serverless Devs开发者工具,涉及到的 Exit Code,可以参考[开发者工具设计文档](../tool.md)
|
|
60
|
-
|
|
61
|
-
## 服务级操作
|
|
62
|
-
|
|
63
|
-
在当前项目下,可以执行`s [服务名] [自定义命令]`实现服务级操作。
|
|
64
|
-
|
|
65
|
-
- 执行`s backend deploy`等,可以针对服务`backend`进行`deploy`相关的操作,**如果顺利完成与其操作,系统的`exit code`为0;否则,出现错误,系统的`exit code`为101**;
|
|
66
|
-
- 执行`s admin-frontend test`是,由于服务`admin-frontend`对应的`test`方法是不存在的,**此时系统将会认为是未找到组件方法,系统的`exit code`为100**;
|
|
67
|
-
|
|
68
|
-
## 注意事项
|
|
69
|
-
|
|
70
|
-
在上面[应用级操作](#应用级操作)和[服务级操作](#服务级操作)中,我们不难发现,同样是某些组件不包括对应方法,但是在[应用级操作](#应用级操作)和[服务级操作](#服务级操作)中的表现形式却不同,这里的设计思路主要是为了保证[应用级操作](#应用级操作)的流畅性。所以其规律通常如下:
|
|
71
|
-
|
|
72
|
-
1. [应用级操作](#应用级操作)更多是一种批量操作,会按照[Serverless User Model所定义的服务顺序](../../../spec/zh/0.0.1/serverless_user_model/3.user_model.md#服务顺序)对应用下的所有服务进行分别操作;所以,此时如果出现某个服务对应的组件不包括当前方法,会以"批量操作"作为理由,跳过该服务,进行警告后继续执行,**此时,系统的`exit code`为0;**
|
|
73
|
-
2. [服务级操作](#服务级操作)更多是一种针对某个应用下的某个服务的特定操作,此时如果找不到对应的方法,则意味着本次操作没有意义,将会惊醒错误报告,**此时,系统的`exit code`为100;**
|
package/docs/zh/command/init.md
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
# Init 命令
|
|
2
|
-
|
|
3
|
-
`init`命令是初始化Serverless项目的脚手架。
|
|
4
|
-
|
|
5
|
-
- [前言](#前言)
|
|
6
|
-
- [命令解析](#命令解析)
|
|
7
|
-
- [参数解析](#参数解析)
|
|
8
|
-
- [初始化项目](#初始化项目)
|
|
9
|
-
- [引导式初始化](#引导式初始化)
|
|
10
|
-
- [直接初始化](#直接初始化)
|
|
11
|
-
- [初始化Registry应用](#初始化Registry应用)
|
|
12
|
-
- [初始化仓库应用](#初始化仓库应用)
|
|
13
|
-
|
|
14
|
-
## 命令解析
|
|
15
|
-
|
|
16
|
-
当执行`s init -h`之后,可以进行相关帮助信息的查看:
|
|
17
|
-
|
|
18
|
-
```shell script
|
|
19
|
-
$ s init -h
|
|
20
|
-
Usage: s init [options] [name | url]
|
|
21
|
-
|
|
22
|
-
Initialize a new project based on a template. You can initialize the application that conforms to the serverless devs project specification through GitHub, or you can initialize the application provided by the source by configuring the source.
|
|
23
|
-
|
|
24
|
-
Example:
|
|
25
|
-
$ s init
|
|
26
|
-
$ s init project
|
|
27
|
-
$ s init project -d my_dir
|
|
28
|
-
$ s init git@github.com:foo/bar.git
|
|
29
|
-
$ s init https://github.com/foo/bar.git
|
|
30
|
-
|
|
31
|
-
🚀 More Application: https://github.com/Serverless-Devs/Serverless-Devs/blob/master/docs/zh/awesome.md
|
|
32
|
-
|
|
33
|
-
Options:
|
|
34
|
-
-d, --dir [dir] Where to output the initialized app into (default: ./<ProjectName> )
|
|
35
|
-
-r, --registry [url] Use specify registry
|
|
36
|
-
-h, --help Display help for command
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### 参数解析
|
|
40
|
-
|
|
41
|
-
| 参数全称 | 参数缩写 | 默认取值 | 参数含义 |
|
|
42
|
-
|-----|-----|-----|-----|
|
|
43
|
-
| dir | d | `./<ProjectName>` | 项目初始化的路径/目录 |
|
|
44
|
-
| registry | -r | http://registry.devsapp.cn/simple | 源配置地址,类似于Python中指定pip源,或者Node.js中指定NPM源 |
|
|
45
|
-
|
|
46
|
-
### 初始化项目
|
|
47
|
-
|
|
48
|
-
#### 引导式初始化
|
|
49
|
-
|
|
50
|
-
通过`s init`可以直接进入项目初始化的引导模块:
|
|
51
|
-
|
|
52
|
-
```shell script
|
|
53
|
-
$ s init
|
|
54
|
-
|
|
55
|
-
🚀 Serverless Awesome: https://github.com/Serverless-Devs/package-awesome
|
|
56
|
-
|
|
57
|
-
? Hello Serverless for Cloud Vendors (Use arrow keys or type to search)
|
|
58
|
-
❯ Alibaba Cloud Serverless
|
|
59
|
-
AWS Cloud Serverless
|
|
60
|
-
Baidu Cloud Serverless
|
|
61
|
-
Huawei Cloud Serverless
|
|
62
|
-
Tencent Cloud Serverless
|
|
63
|
-
Dev Template for Serverless Devs
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
此时只需要选择对应的选项,按照引导进行操作,即可。例如选择`Alibaba Cloud Serverless`,就可以看到阿里云Serverless产品下的应用模板分类:
|
|
67
|
-
|
|
68
|
-
```shell script
|
|
69
|
-
? Please select an Serverless-Devs Application (Use arrow keys or type to search)
|
|
70
|
-
❯ Quick start [Deploy a Hello World function to FaaS]
|
|
71
|
-
Container example [Deploy function to FaaS with custom-container]
|
|
72
|
-
Web Framework [Deploy a web framework to FaaS]
|
|
73
|
-
Static website [Deploy a static website]
|
|
74
|
-
Best practice [Experience serverless project]
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
此时可以继续选择某分类下的具体应用进行初始化,例如选择`fc-runtime-starter`之后,可以看到该分类下的具体模板应用:
|
|
78
|
-
|
|
79
|
-
```shell script
|
|
80
|
-
? Which template do you like? (Use arrow keys or type to search)
|
|
81
|
-
❯ [HTTP] Node.js 12
|
|
82
|
-
[HTTP] Python3
|
|
83
|
-
[HTTP] Java8
|
|
84
|
-
[HTTP] PHP7
|
|
85
|
-
[HTTP] C++ (custom)
|
|
86
|
-
[Event] Node.js 12
|
|
87
|
-
[Event] Python3
|
|
88
|
-
(Move up and down to reveal more choices)
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
选择`fc-http-nodejs`即可完成创建:
|
|
92
|
-
|
|
93
|
-
```shell script
|
|
94
|
-
$ s init
|
|
95
|
-
|
|
96
|
-
🚀 Serverless Awesome: https://github.com/Serverless-Devs/package-awesome
|
|
97
|
-
|
|
98
|
-
? Hello Serverless for Cloud Vendors Alibaba Cloud Serverless
|
|
99
|
-
? Please select an Serverless-Devs Application fc-runtime-starter - 快速部署一个 FC 函数
|
|
100
|
-
? Please select an templete fc-http-nodejs - 快速部署一个 nodejs12 http函数
|
|
101
|
-
|
|
102
|
-
......
|
|
103
|
-
|
|
104
|
-
💞 Document ❤ Star:https://github.com/Serverless-Devs/Serverless-Devs
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
更多关于默认源对应的应用信息,可以参考[Package Awesome](https://github.com/Serverless-Devs/package-awesome)
|
|
108
|
-
|
|
109
|
-
#### 直接初始化
|
|
110
|
-
|
|
111
|
-
通过`s init [name | url]`,可以从配置的`Registry`或者指定的仓库`Url`获取模板项目。
|
|
112
|
-
|
|
113
|
-
##### 初始化Registry应用
|
|
114
|
-
|
|
115
|
-
以默认的`Registry`为例,可以初始化相对应的案例项目:`start-fc-http-nodejs12`,可以通过`s init start-fc-http-nodejs12`命令来进行:
|
|
116
|
-
|
|
117
|
-
```shell script
|
|
118
|
-
$ s init start-fc-http-nodejs12
|
|
119
|
-
|
|
120
|
-
🚀 Serverless Awesome: https://github.com/Serverless-Devs/package-awesome
|
|
121
|
-
|
|
122
|
-
? Please input your project name (init dir) start-fc-http-nodejs12
|
|
123
|
-
✔ file decompression completed
|
|
124
|
-
|
|
125
|
-
......
|
|
126
|
-
|
|
127
|
-
💞 Document ❤ Star:https://github.com/Serverless-Devs/Serverless-Devs
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
##### 初始化仓库应用
|
|
131
|
-
|
|
132
|
-
以Github仓库 `https://github.com/devsapp/puppeteer-app` 为例,可以通过`s init git@github.com:devsapp/puppeteer-app.git`命令初始化该案例项目:
|
|
133
|
-
|
|
134
|
-
```shell script
|
|
135
|
-
$ s init git@github.com:devsapp/puppeteer-app.git
|
|
136
|
-
|
|
137
|
-
🚀 Serverless Awesome: https://github.com/Serverless-Devs/package-awesome
|
|
138
|
-
|
|
139
|
-
Cloning into 'puppeteer-app'...
|
|
140
|
-
remote: Enumerating objects: 35, done.
|
|
141
|
-
remote: Counting objects: 100% (35/35), done.
|
|
142
|
-
remote: Compressing objects: 100% (23/23), done.
|
|
143
|
-
remote: Total 35 (delta 10), reused 30 (delta 6), pack-reused 0
|
|
144
|
-
Receiving objects: 100% (35/35), 6.59 KiB | 3.30 MiB/s, done.
|
|
145
|
-
Resolving deltas: 100% (10/10), done.
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# 命令操作文档
|
|
2
|
-
|
|
3
|
-
- [前言](#前言)
|
|
4
|
-
- [全局参数](#全局参数)
|
|
5
|
-
- [命令详情](#命令详情)
|
|
6
|
-
- [config: 密钥配置](./config.md)
|
|
7
|
-
- [init: 项目初始化](./init.md)
|
|
8
|
-
- [cli: 纯命令行模式](./cli.md)
|
|
9
|
-
- [clean: 工具清理](./clean.md)
|
|
10
|
-
- [component: 组件信息](./component.md)
|
|
11
|
-
- [set: 工具配置](./set.md)
|
|
12
|
-
- [custom: 自定义命令](./custom.md)
|
|
13
|
-
|
|
14
|
-
## 前言
|
|
15
|
-
|
|
16
|
-
Serverless Devs 可以通过`-h`唤起对应命令的帮助文档,例如查看 `s` 命令的帮助信息可以是:`s -h`
|
|
17
|
-
|
|
18
|
-
当使用者使用命令行工具时,可以通过`s`命令,查看整体帮助信息:
|
|
19
|
-
|
|
20
|
-
```shell script
|
|
21
|
-
$ s
|
|
22
|
-
Usage: s [options] [command]
|
|
23
|
-
|
|
24
|
-
_________ .__
|
|
25
|
-
/ _____/ ______________ __ ___________| | ____ ______ ______
|
|
26
|
-
\_____ \_/ __ \_ __ \ \/ // __ \_ __ \ | _/ __ \ / ___// ___/
|
|
27
|
-
/ \ ___/| | \/\ /\ ___/| | \/ |_\ ___/ \___ \ \___ \
|
|
28
|
-
/_________/\_____>__| \_/ \_____>__| |____/\_____>______>______>
|
|
29
|
-
|
|
30
|
-
Welcome to the Serverless Devs.
|
|
31
|
-
|
|
32
|
-
More:
|
|
33
|
-
📘 Documents: https://github.com/Serverless-Devs/Serverless-Devs/tree/master/docs
|
|
34
|
-
🙌 Discussions: https://github.com/Serverless-Devs/Serverless-Devs/discussions
|
|
35
|
-
📦 Applications: https://github.com/Serverless-Devs/Serverless-Devs/blob/master/docs/zh/awesome.md
|
|
36
|
-
|
|
37
|
-
Quick start:
|
|
38
|
-
🍻 Can perform [s init] fast experience
|
|
39
|
-
|
|
40
|
-
Options:
|
|
41
|
-
-t, --template [templatePath] Specify the template file
|
|
42
|
-
-a, --access [aliasName] Specify the access alias name
|
|
43
|
-
--skip-actions Skip the extends section
|
|
44
|
-
--debug Open debug model
|
|
45
|
-
-v, --version Output the version number
|
|
46
|
-
-h, --help Display help for command
|
|
47
|
-
|
|
48
|
-
Commands:
|
|
49
|
-
config 👤 Configure venders account.
|
|
50
|
-
init 💞 Initializing a serverless project.
|
|
51
|
-
cli 🐚 Command line operation without yaml mode.
|
|
52
|
-
set 🔧 Settings for the tool.
|
|
53
|
-
clean 💥 Clean up the environment.
|
|
54
|
-
component 🔌 Installed component information.
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## 全局参数
|
|
58
|
-
|
|
59
|
-
| 参数全称 | 参数缩写 | 默认取值 | 参数含义 | 备注 |
|
|
60
|
-
|-----|-----|-----|-----|-----|
|
|
61
|
-
| template | t | `s.yaml`/`s.yml` | 指定资源描述文件 | 可选`yaml`和`JSON`两种格式 |
|
|
62
|
-
| access | a | `yaml`中所指定的`access`信息/`default` | 指定本次部署时的密钥信息 | 可以使用通过[config命令](./command/config.md#config-add-命令)配置的密钥信息,以及[配置到环境变量的密钥信息](./command/config.md#通过环境变量配置密钥信息) |
|
|
63
|
-
| skip-actions | - | - | 跳过`yaml`所设置的`actions`模块 | - |
|
|
64
|
-
| debug | - | - | 开启`Debug`模式 | 开启`Debug`模式后可以查看到更多的工具执行过程信息 |
|
|
65
|
-
| version | v | - | 查看版本信息 | - |
|
|
66
|
-
| help | h | - | 查看帮助信息 | - |
|
|
67
|
-
|
|
68
|
-
## 命令详情
|
|
69
|
-
|
|
70
|
-
- [config: 密钥配置](./config.md)
|
|
71
|
-
- [init: 项目初始化](./init.md)
|
|
72
|
-
- [cli: 纯命令行模式](./cli.md)
|
|
73
|
-
- [clean: 工具清理](./clean.md)
|
|
74
|
-
- [set: 工具配置](./set.md)
|
|
75
|
-
- [component: 组件信息](./component.md)
|
|
76
|
-
- [custom: 自定义命令](./custom.md)
|