@serverless-devs/s 2.0.95 → 2.0.97-beta.11

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 (147) hide show
  1. package/Makefile +23 -0
  2. package/lib/clean/index.js +39 -32
  3. package/lib/cli/cli-manager.js +12 -18
  4. package/lib/cli/index.js +59 -54
  5. package/lib/component/index.js +54 -144
  6. package/lib/config/add/index.js +45 -38
  7. package/lib/config/delete/index.js +53 -48
  8. package/lib/config/get/index.js +50 -43
  9. package/lib/config/index.js +40 -33
  10. package/lib/core/command/command-manager.js +9 -11
  11. package/lib/core/component/hook.js +4 -4
  12. package/lib/core/component/index.js +13 -13
  13. package/lib/error/human-error.js +5 -5
  14. package/lib/error/human-warning.js +4 -4
  15. package/lib/error/index.js +38 -45
  16. package/lib/index.js +116 -120
  17. package/lib/init/index.js +104 -97
  18. package/lib/init/init-manager.js +66 -19
  19. package/lib/onboarding/index.js +5 -5
  20. package/lib/set/analysis/index.js +43 -36
  21. package/lib/set/index.js +40 -33
  22. package/lib/set/locale/index.js +55 -50
  23. package/lib/set/registry/index.js +54 -49
  24. package/lib/set/workspace/index.js +44 -37
  25. package/lib/specification/parse.js +11 -15
  26. package/lib/update-notifier/index.js +17 -17
  27. package/lib/utils/command-util.js +74 -57
  28. package/lib/utils/common.js +98 -13
  29. package/lib/utils/index.js +3 -3
  30. package/package.json +5 -4
  31. package/readme.md +8 -3
  32. package/.eslintrc.json +0 -112
  33. package/.prettierrc.json +0 -11
  34. package/CODE_OF_CONDUCT.md +0 -5
  35. package/CONTRIBUTING.md +0 -189
  36. package/CONTRIBUTORS.md +0 -148
  37. package/docs/readme.md +0 -94
  38. package/docs/zh/awesome.md +0 -20
  39. package/docs/zh/cicd.md +0 -231
  40. package/docs/zh/cli_design.md +0 -100
  41. package/docs/zh/command/clean.md +0 -63
  42. package/docs/zh/command/cli.md +0 -92
  43. package/docs/zh/command/component.md +0 -76
  44. package/docs/zh/command/config.md +0 -278
  45. package/docs/zh/command/custom.md +0 -73
  46. package/docs/zh/command/init.md +0 -148
  47. package/docs/zh/command/readme.md +0 -76
  48. package/docs/zh/command/set.md +0 -195
  49. package/docs/zh/default_provider_config/alibabacloud.md +0 -82
  50. package/docs/zh/default_provider_config/aws.md +0 -12
  51. package/docs/zh/default_provider_config/azure.md +0 -9
  52. package/docs/zh/default_provider_config/baiducloud.md +0 -8
  53. package/docs/zh/default_provider_config/gcp.md +0 -21
  54. package/docs/zh/default_provider_config/huaweicloud.md +0 -52
  55. package/docs/zh/default_provider_config/readme.md +0 -9
  56. package/docs/zh/default_provider_config/tencentcloud.md +0 -41
  57. package/docs/zh/install.md +0 -52
  58. package/docs/zh/package_dev.md +0 -142
  59. package/docs/zh/quick_start.md +0 -297
  60. package/docs/zh/readme.md +0 -90
  61. package/docs/zh/tool.md +0 -80
  62. package/docs/zh/yaml.md +0 -207
  63. package/docs/zh/yaml_and_cli.md +0 -67
  64. package/jest.setup.ts +0 -37
  65. package/lib/clean/index.d.ts +0 -1
  66. package/lib/cli/cli-manager.d.ts +0 -13
  67. package/lib/cli/index.d.ts +0 -2
  68. package/lib/component/index.d.ts +0 -1
  69. package/lib/config/add/index.d.ts +0 -1
  70. package/lib/config/common/common.d.ts +0 -46
  71. package/lib/config/delete/index.d.ts +0 -2
  72. package/lib/config/get/index.d.ts +0 -1
  73. package/lib/config/index.d.ts +0 -2
  74. package/lib/constants/index.d.ts +0 -0
  75. package/lib/constants/static-variable.d.ts +0 -4
  76. package/lib/core/command/command-manager.d.ts +0 -12
  77. package/lib/core/component/hook.d.ts +0 -17
  78. package/lib/core/component/index.d.ts +0 -53
  79. package/lib/core/index.d.ts +0 -2
  80. package/lib/core/plugin/index.d.ts +0 -13
  81. package/lib/entiry/cli.d.ts +0 -27
  82. package/lib/entiry/index.d.ts +0 -2
  83. package/lib/error/command-error.d.ts +0 -5
  84. package/lib/error/config-delete-error.d.ts +0 -5
  85. package/lib/error/config-error.d.ts +0 -5
  86. package/lib/error/config-get-error.d.ts +0 -5
  87. package/lib/error/human-error.d.ts +0 -13
  88. package/lib/error/human-warning.d.ts +0 -8
  89. package/lib/error/index.d.ts +0 -17
  90. package/lib/error/init-error.d.ts +0 -5
  91. package/lib/error/serverless-error.d.ts +0 -4
  92. package/lib/execDaemon.d.ts +0 -6
  93. package/lib/index.d.ts +0 -2
  94. package/lib/init/index.d.ts +0 -2
  95. package/lib/init/init-config.d.ts +0 -43
  96. package/lib/init/init-manager.d.ts +0 -17
  97. package/lib/onboarding/index.d.ts +0 -2
  98. package/lib/set/analysis/index.d.ts +0 -1
  99. package/lib/set/index.d.ts +0 -1
  100. package/lib/set/locale/index.d.ts +0 -1
  101. package/lib/set/registry/index.d.ts +0 -10
  102. package/lib/set/workspace/index.d.ts +0 -1
  103. package/lib/specification/analysis.d.ts +0 -12
  104. package/lib/specification/index.d.ts +0 -4
  105. package/lib/specification/parse.d.ts +0 -24
  106. package/lib/specification/version.d.ts +0 -35
  107. package/lib/update-notifier/index.d.ts +0 -10
  108. package/lib/utils/command-util.d.ts +0 -18
  109. package/lib/utils/common.d.ts +0 -28
  110. package/lib/utils/core.d.ts +0 -3
  111. package/lib/utils/handler-set-config.d.ts +0 -19
  112. package/lib/utils/i18n/en.d.ts +0 -44
  113. package/lib/utils/i18n/index.d.ts +0 -2
  114. package/lib/utils/i18n/zh.d.ts +0 -44
  115. package/lib/utils/index.d.ts +0 -9
  116. package/lib/utils/logger.d.ts +0 -11
  117. package/lib/utils/storage.d.ts +0 -8
  118. package/lib/utils/url-parser.d.ts +0 -15
  119. package/spec/readme.md +0 -59
  120. package/spec/zh/0.0.1/readme.md +0 -47
  121. package/spec/zh/0.0.1/serverless_package_model/1.purpose_and_goals.md +0 -3
  122. package/spec/zh/0.0.1/serverless_package_model/2.overview_and_terminology.md +0 -14
  123. package/spec/zh/0.0.1/serverless_package_model/3.package_model.md +0 -434
  124. package/spec/zh/0.0.1/serverless_package_model/4.application_scopes.md +0 -3
  125. package/spec/zh/0.0.1/serverless_package_model/5.design_principles.md +0 -3
  126. package/spec/zh/0.0.1/serverless_package_model/readme.md +0 -12
  127. package/spec/zh/0.0.1/serverless_registry_model/1.purpose_and_goals.md +0 -18
  128. package/spec/zh/0.0.1/serverless_registry_model/2.overview_and_terminology.md +0 -18
  129. package/spec/zh/0.0.1/serverless_registry_model/3.registry_model.md +0 -61
  130. package/spec/zh/0.0.1/serverless_registry_model/4.application_scopes.md +0 -6
  131. package/spec/zh/0.0.1/serverless_registry_model/5.design_principles.md +0 -3
  132. package/spec/zh/0.0.1/serverless_registry_model/readme.md +0 -12
  133. package/spec/zh/0.0.1/serverless_user_model/1.purpose_and_goals.md +0 -3
  134. package/spec/zh/0.0.1/serverless_user_model/2.overview_and_terminology.md +0 -16
  135. package/spec/zh/0.0.1/serverless_user_model/3.user_model.md +0 -218
  136. package/spec/zh/0.0.1/serverless_user_model/4.application_scopes.md +0 -4
  137. package/spec/zh/0.0.1/serverless_user_model/5.design_principles.md +0 -3
  138. package/spec/zh/0.0.1/serverless_user_model/readme.md +0 -12
  139. package/test/ci.sh +0 -33
  140. package/test/cli/cli-manager.test.ts +0 -64
  141. package/test/config/get.test.ts +0 -12
  142. package/test/helloworld.test.ts +0 -7
  143. package/test/start-fc-http-nodejs12/code/index.js +0 -47
  144. package/test/start-fc-http-nodejs12/s.yaml +0 -38
  145. package/test/utils/index.test.ts +0 -8
  146. package/test/utils/storage.test.ts +0 -19
  147. package/tsconfig.json +0 -37
package/docs/zh/cicd.md DELETED
@@ -1,231 +0,0 @@
1
- # 与 CI/CD 平台/工具集成
2
-
3
- - [与 Github Action 的集成](#与-github-action-的集成)
4
- - [与 Gitee Go 的集成](#与-gitee-go-的集成)
5
- - [与 Jenkins 的集成](#与-jenkins-的集成)
6
- - [与云效的集成](#与云效的集成)
7
- - [注意事项](#注意事项)
8
-
9
- ## 与 Github Action 的集成
10
-
11
- 在 Github Action 的 Yaml 文件中,可以增加 Serverless Devs 的相关下载、配置以及命令执行相关能力。
12
-
13
- 例如,在仓库中可以创建该文件`.github/workflows/publish.yml`,文件内容:
14
-
15
- ```yaml
16
- name: Serverless Devs Project CI/CD
17
-
18
- on:
19
- push:
20
- branches: [ master ]
21
-
22
- jobs:
23
- serverless-devs-cd:
24
- runs-on: ubuntu-latest
25
- steps:
26
- - uses: actions/checkout@v2
27
- - uses: actions/setup-node@v2
28
- with:
29
- node-version: 12
30
- registry-url: https://registry.npmjs.org/
31
- - run: npm install
32
- - run: npm install -g @serverless-devs/s
33
- - run: s config add --AccountID ${{secrets.AccountID}} --AccessKeyID ${{secrets.AccessKeyID}} --AccessKeySecret ${{secrets.AccessKeySecret}} -a default
34
- - run: s deploy
35
- ```
36
-
37
- 主要包括几个部分的内容:
38
- - `run: npm install -g @serverless-devs/s`:
39
- 通过NPM安装最新版本的 Serverless Devs 开发者工具;
40
- - `run: s config add --AccountID ${{secrets.AccountID}} --AccessKeyID ${{secrets.AccessKeyID}} --AccessKeySecret ${{secrets.AccessKeySecret}} -a default`
41
- 通过`config`命令进行密钥等信息的配置;
42
- - `run: s deploy`
43
- 执行某些命令,例如通过`deploy`进行项目的部署,或者`build`等命令进行构建等;
44
-
45
- 关于密钥的配置:密钥信息的获取是通过`${{secrets.*}}`进行获取的,所以此时,需要将所需要的密钥和对应的`Key`配置到 Github Secrets 中,例如在上面的案例中,需要`AccountID`,`AccessKeyID`,`AccessKeySecret`等三个密钥的 Key ,我们就可以配置相关的内容:
46
-
47
- 1. 将密钥信息配置到Github Secrets中
48
- ![](https://user-images.githubusercontent.com/21079031/120761131-71f28080-c547-11eb-9bb8-e08dafabb4ee.png)
49
-
50
- 2. 我们创建多对密钥信息:
51
- ![](https://user-images.githubusercontent.com/21079031/120761249-93ec0300-c547-11eb-9c0d-904fb85b4201.png)
52
- 例如,我此处配置了三对密钥:
53
- ![](https://user-images.githubusercontent.com/21079031/120761347-ae25e100-c547-11eb-9bcd-4fc742671bc5.png)
54
-
55
- > 关于密钥配置的部分注意内容,可以参考文末的[注意事项](#注意事项)
56
-
57
- ## 与 Gitee Go 的集成
58
-
59
- 在开启 Gitee Go 的服务之后,在流水线的 Yaml 文件中,可以增加 Serverless Devs 的相关下载、配置以及命令执行相关能力。
60
-
61
- 例如,在仓库中可以创建该文件`.github/workflows/publish.yml`,文件内容:
62
-
63
- ```yaml
64
- name: serverless-devs
65
- displayName: 'Serverless Devs Project CI/CD'
66
- triggers: # 流水线触发器配置
67
- push: # 设置 master 分支 在产生代码 push 时精确触发(PRECISE)构建
68
- - matchType: PRECISE
69
- branch: master
70
- commitMessage: '' # 通过匹配当前提交的 CommitMessage 决定是否执行流水线
71
- stages: # 构建阶段配置
72
- - stage: # 定义一个 ID 标识为 deploy-stage ,名为「 Deploy Stage 」的阶段
73
- name: deploy-stage
74
- displayName: 'Deploy Stage'
75
- failFast: false # 允许快速失败,即当 Stage 中有任务失败时,直接结束整个 Stage
76
-
77
- steps: # 构建步骤配置
78
- - step: npmbuild@1 # 采用 npm 编译环境
79
- name: deploy-step # 定义一个 ID 标识为 deploy-step ,名为「 Deploy Step 」的阶段
80
- displayName: 'Deploy Step'
81
- inputs: # 构建输入参数设定
82
- nodeVersion: 14.15 # 指定 node 环境版本为 14.15
83
- goals: | # 安装依赖,配置相关主题、部署参数并发布部署
84
- node -v
85
- npm -v
86
- npm install -g @serverless-devs/s
87
- s config add --AccountID $ACCOUNTID --AccessKeyID $ACCESSKEYID --AccessKeySecret $ACCESSKEYSECRET -a default
88
- s deploy
89
- ```
90
-
91
- 主要包括几个部分的内容:
92
- - `npm install -g @serverless-devs/s`:
93
- 通过NPM安装最新版本的 Serverless Devs 开发者工具;
94
- - `s config add --AccountID $ACCOUNTID --AccessKeyID $ACCESSKEYID --AccessKeySecret $ACCESSKEYSECRET -a default`
95
- 通过`config`命令进行密钥等信息的配置;
96
- - `s deploy`
97
- 执行某些命令,例如通过`deploy`进行项目的部署,或者`build`等命令进行构建等;
98
-
99
- 关于密钥的配置:密钥信息的获取是通过`$*`进行获取的,所以此时,需要将所需要的密钥和对应的`Key`配置到 Gitee 的环境变量管理即可,例如在上面的案例中,需要`ACCOUNTID`,`ACCESSKEYID`,`ACCESSKEYSECRET`等三个密钥的 Key ,我们就可以配置相关的内容:
100
-
101
- 1. 找到 Gitee 的环境变量管理
102
- ![](https://user-images.githubusercontent.com/21079031/124716639-e5b4ee00-df36-11eb-9dc8-cf2d8eb30e51.png)
103
-
104
- 2. 我们创建多对密钥信息:
105
- ![](https://user-images.githubusercontent.com/21079031/124719394-aa67ee80-df39-11eb-84ad-944ccf0486ba.png)
106
- 例如,我此处配置了三对密钥:
107
- ![](https://user-images.githubusercontent.com/21079031/124719496-c9ff1700-df39-11eb-8ef6-4ccae28caefc.png)
108
-
109
- > 关于密钥配置的部分注意内容,可以参考文末的[注意事项](#注意事项)
110
-
111
-
112
- ## 与 Jenkins 的集成
113
-
114
- 在准备将 Serverless Devs 集成到 Jenkins 之前,需要先基于 [Jenkins 官网](https://www.jenkins.io/zh/doc/pipeline/tour/getting-started/) 安装并运行 Jenkins。
115
-
116
- 本地启动 Jenkins 后,通过浏览器进入链接 `http://localhost:8080` 配置完成基础设置后,需要新增 Credentials 设置,如下图所示:
117
-
118
- ![](https://img.alicdn.com/imgextra/i2/O1CN01tSgoo71Ne62AMGxqh_!!6000000001594-2-tps-3582-1048.png)
119
-
120
- 此时可以根据需要,增加密钥信息,以阿里云为例,新增三个全局凭据:
121
-
122
- ```
123
- jenkins-alicloud-account-id : 阿里云 accountId
124
-
125
- jenkins-alicloud-access-key-id : 阿里云 accessKeyId
126
-
127
- jenkins-alicloud-access-key-secret : 阿里云 accessKeySecret
128
- ```
129
-
130
- > 新增 Credentials 的教程可以参考[这里](https://www.jenkins.io/zh/doc/book/using/using-credentials/)。
131
-
132
- 此时,可以对自身的 Serverless Devs 项目进行完善:
133
-
134
- - 创建文件`Jenkinsfile`
135
- ```
136
- pipeline {
137
- agent {
138
- docker {
139
- image 'maven:3.3-jdk-8'
140
- }
141
- }
142
-
143
- environment {
144
- ALICLOUD_ACCESS = 'default'
145
- ALICLOUD_ACCOUNT_ID = credentials('jenkins-alicloud-account-id')
146
- ALICLOUD_ACCESS_KEY_ID = credentials('jenkins-alicloud-access-key-id')
147
- ALICLOUD_ACCESS_KEY_SECRET = credentials('jenkins-alicloud-access-key-secret')
148
- }
149
-
150
- stages {
151
- stage('Setup') {
152
- steps {
153
- sh 'scripts/setup.sh'
154
- }
155
- }
156
- }
157
- }
158
- ```
159
- 主要的内容包括两个部分:
160
- - environment 部分,主要是根据上面步骤配置的密钥信息,进行密钥的处理;
161
- - stages 部分,这里面会有一个部分是`sh 'scripts/setup.sh'`,即运行`scripts/setup.sh`文件,进行相关内容的准备和配置;
162
- - 准备`scripts/setup.sh`文件,只需要在项目下,创建该文件即可:
163
- ```shell script
164
- #!/usr/bin/env bash
165
-
166
- echo $(pwd)
167
- curl -o- -L http://cli.so/install.sh | bash
168
-
169
- source ~/.bashrc
170
-
171
- echo $ALICLOUD_ACCOUNT_ID
172
- s config add --AccountID $ALICLOUD_ACCOUNT_ID --AccessKeyID $ALICLOUD_ACCESS_KEY_ID --AccessKeySecret $ALICLOUD_ACCESS_KEY_SECRET -a $ALICLOUD_ACCESS
173
-
174
- (cd code && mvn package && echo $(pwd))
175
-
176
- s deploy -y --use-local --access $ALICLOUD_ACCESS
177
- ```
178
- 在该文件中,主要包括了几个部分:
179
- - `curl -o- -L http://cli.so/install.sh | bash`
180
- 下载并安装 Serverless Devs 开发者工具
181
- - `s config add --AccountID $ALICLOUD_ACCOUNT_ID --AccessKeyID $ALICLOUD_ACCESS_KEY_ID --AccessKeySecret $ALICLOUD_ACCESS_KEY_SECRET -a $ALICLOUD_ACCESS`
182
- 配置密钥信息等内容
183
- - `s deploy -y --use-local --access $ALICLOUD_ACCESS`
184
- 执行某些命令,例如通过`deploy`进行项目的部署,或者`build`等命令进行构建等;
185
-
186
-
187
- 完成密钥配置之后,可以创建一个 Jenkins 流水线,该流水线的源是目标 github 地址。接下来,就可以开始运行 Jenkins 流水线,运行结束后,就可以得到相关的内容结果。
188
-
189
- > 关于密钥配置的部分注意内容,可以参考文末的[注意事项](#注意事项)
190
-
191
-
192
- ## 与云效的集成
193
-
194
- 在云效中,可以直接选择Serverless Devs开发者工具,并在自定义命令中,输入以下内容即可:
195
-
196
- ```
197
- # input your command here
198
- npm install -g @serverless-devs/s
199
- s config add --AccountID ${ACCOUNTID} --AccessKeyID ${ACCESSKEYID} --AccessKeySecret ${ACCESSKEYSECRET} -a default
200
- s deploy
201
- ```
202
-
203
- 这里主要包括三个部分:
204
-
205
- - `npm install -g @serverless-devs/s`:
206
- 通过NPM安装最新版本的 Serverless Devs 开发者工具(虽然云效中已经拥有了相关版本的Serverless Devs,但是实际上,这个版本可能比较老旧,所以可以通过该命令安装最新版本);
207
- - `s config add --AccountID ${ACCOUNTID} --AccessKeyID ${ACCESSKEYID} --AccessKeySecret ${ACCESSKEYSECRET} -a default`
208
- 通过`config`命令进行密钥等信息的配置;
209
- - `s deploy`
210
- 执行某些命令,例如通过`deploy`进行项目的部署,或者`build`等命令进行构建等;
211
-
212
- 效果如下:
213
-
214
- ![image](https://user-images.githubusercontent.com/21079031/144697943-2ce9ea56-7af8-4c3b-945b-6897e6d744b5.png)
215
-
216
- 由于在命令中,引用了三个重要的环境变量:`ACCOUNTID`, `ACCESSKEYID`, `ACCESSKEYSECRET`,所以还需要在环境变量中,增加类似的内容:
217
-
218
- ![image](https://user-images.githubusercontent.com/21079031/144699074-3dad63d7-835f-4eb8-bd95-662de683dbbc.png)
219
-
220
-
221
-
222
- ## 注意事项
223
-
224
- - 在配置密钥的时候,使用了`s config add`命令,此时在最后有一个参数是`-a default`,代表的是给该密钥一个叫`default`的别名,这个别名要和项目所设定的使用密钥保持一致,例如在`s.yaml`中的`access`字段;
225
- - 如果在当前应用在,涉及到了配置部署到不同的平台或者账号下,可能会涉及到配置多个密钥信息,此时需要给不同的密钥不同的别名,并且在`s.yaml`中进行使用;
226
- - 如果想要配置更为灵活的密钥信息,可以考虑通过`-il`和`-kl`参数获取,例如同时配置两对密钥,并且使用自定义 Key :
227
- ```yaml
228
- s config add -kl tempToken1,tempToken2 -il tempValue1,tempValue2 -a website_access
229
- s config add -kl tempToken3,tempToken4 -il tempValue3,tempValue4 -a fc_access
230
- ```
231
-
@@ -1,100 +0,0 @@
1
- # 命令行设计规范
2
-
3
- Serverless Devs 作为 Serverless 领域的开发者工具,其输出的标准化和规范化会在一定程度上对用户体验有比较明显的影响。
4
-
5
- 本文档将会通过一些文字和案例,对Serverless Devs的命令行工具输出,进行规范化升级。
6
-
7
- ## 规范详情
8
-
9
- 输出格式的规范目标是:
10
-
11
- - 更清晰
12
- - 更简约
13
- - 不影响功能实用
14
-
15
- 基于以上三个原则,我们可以通过正常输出的形式、异常输出的形式等分别进行举例说明
16
-
17
- ### 基本输出
18
-
19
- 基本输出的形式,整体上包括两个部分:
20
-
21
- 1. 项目执行阶段
22
-
23
- 项目执行阶段主要包括一个基本格式:
24
-
25
- ```
26
- ⌛ Steps for process
27
- ====================
28
- ```
29
-
30
- 采用重写机制,不断的更新输出内容,每个项目执行完成可以输出相对应的结果,示例:
31
-
32
- ```
33
- ⌛ Steps for process
34
- ====================
35
- ✔ Pre-action completed (10s)
36
- ```
37
-
38
- 2. 结果输出阶段
39
-
40
- 项目执行阶段主要包括一个基本格式:
41
-
42
- ```
43
- 🚀 Result for process
44
- ====================
45
- ```
46
-
47
- 具体的项目输出采用`Yaml`的格式进行输出,输出时,项目名称要加下划线,如果没有输出则直接结束项目,示例:
48
-
49
- ```
50
- 🚀 Result for process
51
- ====================
52
- ✔ MyProject deployed (11s)
53
- fc-deploy-test:
54
- region: cn-hangzhou
55
- service:
56
- name: fc-deploy-service
57
- memorySize: 128
58
- ```
59
-
60
- #### 单项目输出示例
61
-
62
- ![render1629447409205](https://user-images.githubusercontent.com/21079031/130204631-174a5af5-5550-4e7f-bc3b-d6d23681ce61.gif)
63
-
64
-
65
- #### 多项目输出示例
66
-
67
- ![render1629448703505](https://user-images.githubusercontent.com/21079031/130206222-8674550e-2ecf-4e19-9dac-d81a8ab11b02.gif)
68
-
69
-
70
- ### 调试模式
71
-
72
- 当用户使用`--debug`进入到调试模式,则会打印非常详细的信息在控制台,但是这些信息将会以灰色形式打印出来,以保持整体的层次感:
73
-
74
- ![render1629448900851](https://user-images.githubusercontent.com/21079031/130206327-b25c444f-d336-4dc3-8dfe-39a5329e4b13.gif)
75
-
76
-
77
-
78
- ### 错误输出
79
-
80
- 当执行出现错误时,Serverless Devs要做到感知并输出相对应的内容:
81
-
82
- ```
83
- ⌛ Steps for process
84
- ====================
85
- ✔ MyProject pre-action completed (10s)
86
- ✖ MyProject failed to deploy:
87
-
88
- Error Message:
89
- t[r] is not a function
90
-
91
- Env: darwin, node v15.14.0
92
- Docs: https://github.com/serverless-devs/docs
93
- Bugs: https://github.com/Serverless-Devs/Serverless-Devs/issues
94
- Logs: ~/demo/demo/demo/s.log
95
- ```
96
-
97
- 动态效果为:
98
-
99
- ![render1629447327225](https://user-images.githubusercontent.com/21079031/130204744-be670d4b-0c1a-4128-aafe-3e8871b3ef58.gif)
100
-
@@ -1,63 +0,0 @@
1
- # Clean 命令
2
-
3
- `clean`命令是清理 Serverless Devs 的缓存相关功能,可以通过该命令清理环境、不用的依赖包以及相关的缓存内容。
4
-
5
- - [命令解析](#命令解析)
6
- - [参数解析](#参数解析)
7
- - [操作案例](#操作案例)
8
-
9
- ## 命令解析
10
-
11
- 当我们执行`s clean -h`之后,可以进行相关帮助信息的查看:
12
-
13
- ```shell script
14
- $ s clean -h
15
- Usage: s cli [options]
16
-
17
- Clean up the cache related functions of serverless devs. You can clean up the environment, unused dependent packages and related cache contents through this command.
18
-
19
- Example:
20
- $ s clean --component fc-api
21
- $ s clean --all
22
-
23
- Tips:
24
- Get all installed component: s component
25
-
26
- 📖 Document: https://github.com/Serverless-Devs/Serverless-Devs/tree/master/docs/zh/command/clean.md
27
-
28
- Options:
29
- --all Clean up the environment
30
- --cache [dirName] Delete the <dirName> file in the cache
31
- --component [componentName] Remove component (like: fc, fc@0.0.1)
32
- -h, --help Display help for command
33
- ```
34
-
35
- ### 参数解析
36
-
37
- | 参数全称 | 参数缩写 | 是否必填 | 参数含义 |
38
- |-----|-----|-----|-----|
39
- | all | | 选填 | 清理环境 |
40
- | cache | | 选填 | 删除缓存里的的<dirName>文件 |
41
- | component | | 选填 | 删除指定的组件,可以是组件名,也可以是[组件名@版本号] |
42
-
43
- ### 操作案例
44
-
45
- 如果想要清理掉某个组件,可以通过`--component`参数与具体的组件名进行清理,例如:
46
-
47
- ```shell script
48
- $ s clean --component fc-api
49
- Component [fc-api] has been cleaned up successfully.
50
- ```
51
-
52
- 如果想要清理整体环境,可以直接通过`--all`参数进行,例如:
53
-
54
- ```shell script
55
- $ s clean --all
56
- The environment of Serverless Devs has been cleaned up successfully.
57
- ```
58
-
59
- ## 注意事项
60
-
61
- 在进行指定组件的清理时,系统会按照指定的逻辑进行组件的清理:
62
- 1. 系统先会确定当前设置的 Registry 缓存中,存在的符合条件的组件,并进行清理;
63
- 2. 系统将会对系统的最终 Registry 缓存中(Github Registry),存在的符合条件的组件,并进行清理;
@@ -1,92 +0,0 @@
1
- # Cli 命令
2
-
3
- `cli`命令是去Yaml化的命令行模式,即可以通过命令行直接使用 Serverless Devs 的组件,而不需要依赖Yaml文件。
4
-
5
- - [命令解析](#命令解析)
6
- - [常见模式](#常见模式)
7
- - [通用组件的支持](#通用组件的支持)
8
- - [特定组件的支持](#特定组件的支持)
9
-
10
- > Yaml 模式与 Cli 模式的区别和试用场景,可以参考文档[Yaml 模式 Cli 模式对比](./../yaml_and_cli.md)
11
-
12
- ## 命令解析
13
-
14
- 当我们执行`s cli -h`之后,可以进行相关帮助信息的查看:
15
-
16
- ```shell script
17
- $ s cli -h
18
- Usage: s cli [component] [method] [options]
19
-
20
- Directly use serverless devs to use components, develop and manage applications without yaml configuration.
21
-
22
- Example:
23
- $ s cli fc-api listServices
24
- $ s cli fc-api listFunctions --service-name my-service
25
- $ s cli fc-api deploy -p "{/"function/": /"function-name/"}"
26
-
27
- 📖 Document: https://github.com/Serverless-Devs/Serverless-Devs/tree/master/docs/zh/command/cli.md
28
-
29
- Options:
30
- -a, --access [aliasName] Specify the access alias name
31
- -p, --props [jsonString] The json string of props
32
- -h, --help Display help for command
33
- ```
34
-
35
- 使用方法主要是:
36
-
37
- ```shell script
38
- s cli [组件名称,例如fc,fc-api等] [组件的方法] -p/--props [该方法对应的Yaml属性(JSON字符串)] -a/--access [指定密钥信息] [其他设定]
39
- ```
40
-
41
-
42
- ## 常见模式
43
-
44
- ### 通用组件的支持
45
-
46
- 在`cli`模式下,可以通过`-p, --props [jsonString]`参数对组件进行通用的支持。
47
-
48
- 例如,某Serverless Devs应用可以通过以下`s.yaml`描述:
49
-
50
- ```yaml
51
- edition: 1.0.0
52
- access: "myaccess"
53
-
54
- services:
55
- website-starter:
56
- component: devsapp/website
57
- props:
58
- bucket: testbucket
59
- src:
60
- codeUri: ./
61
- publishDir: ./build
62
- index: index.html
63
- region: cn-hangzhou
64
- hosts:
65
- - host: auto
66
- ```
67
-
68
- 并且,可以通过`s website-starter deploy`,将`website-starter`部分进行部署。
69
-
70
- 此时,如果通过`cli`模式进行部署,可以不需要依赖上述Yaml,但是需要在命令行中,写上完整的参数信息:
71
-
72
- ```shell script
73
- s cli devsapp/website deploy -p "{\"bucket\":\"testbucket\",\"src\":{\"codeUri\":\"./\",\"publishDir\":\"./build\",\"index\":\"index.html\"},\"region\":\"cn-hangzhou\",\"hosts\":[{\"host\":\"auto\"}]}" -a myaccess
74
- ```
75
-
76
- ### 特定组件的支持
77
-
78
- 在 Serverless Devs 目前已经存在的组件中,已经有一些比较优秀且针对 Cli 模式设计的组件,例如`fc-api`组件,就是一款命令行模式优先的组件,通过该组件,可以快速的使用阿里云函数计算的一些接口,进行操作,例如:
79
-
80
- - 查看阿里云函数计算的某个地区下某个服务下的函数列表:
81
- ```shell script
82
- s cli fc-api listFunctions --service-name my-service --region cn-beijing -a myaccess
83
- ```
84
- - 通过纯命令行形式,对函数进行代码更新:
85
- ```shell script
86
- s cli fc-api updateFunction --region cn-hangzhou --serviceName fc-deploy-service --functionName http-trigger-function --code '{"zipFile":"./"}'
87
- ```
88
-
89
- 除此之外,很多组件可以即对 Yaml 模式有比较好的支持,也会在某些情况下对 纯命令行模式,进行额外优化设计,例如 `fc` 组件的线上线下资源同步操作:
90
- ```shell script
91
- s cli fc sync --region cn-shanghai --service-name myService --type config
92
- ```
@@ -1,76 +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
- devsapp/fc 阿里云函数计算基础组件 100 MB 0.1.27
64
- fc-api 函数计算api操作组件 100 MB 0.0.44
65
-
66
- 🔎 github registry [https://api.github.com/repos]
67
- Component Description Size Version
68
- fc 阿里云函数计算基础组件 100 MB 0.1.27
69
- devsapp/fc 阿里云函数计算基础组件 100 MB 0.1.27
70
-
71
- ```
72
-
73
-
74
- ## 注意事项
75
-
76
- 在查询组件时,系统只会显示当前 Registry 与默认的 Github Reigstry 信息。如果需要查看其他 Reigstry 的信息,需要先通过`s set registry`进行 Reigstry 的切换