Skip to content

Commit 0da3761

Browse files
author
serverless-devs
committed
commit by Serverless devs docs 1-8-2024 11:45:32
1 parent dd8e1e1 commit 0da3761

File tree

16 files changed

+1142
-814
lines changed

16 files changed

+1142
-814
lines changed
Lines changed: 52 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,68 @@
11
---
2-
title: Clean command
3-
description: 'Clean command'
4-
position: 7
2+
title: Clean Command
3+
description: 'Clean Command'
4+
position: 3
55
category: 'Commands'
66
---
7-
8-
# Clean command
9-
10-
The `clean` command can be used to clean up the cache of Serverless Devs. You can use this command to clean up the environment, dependency packages that are not used, and the cache.
11-
12-
- [Command-description](#Command-description)
13-
- [Parameter description](#Parameter-description)
14-
- [Example](#Example)
15-
- [Precautions](#Precautions)
16-
17-
## Command description
18-
19-
After you execute the `s clean -h` command, we can view the help information:
20-
7+
# Clean Command
8+
The `s clean` command is designated to clear the cache and associated functionalities within Serverless Devs. With this command, you're able to cleanse the environment, eliminate unused dependencies, and remove relevant cached data.
9+
- [Command Overview](#command-overview)
10+
- [Parameters](#parameters)
11+
- [Usage Examples](#usage-examples)
12+
- [Cautions](#cautions)
13+
## Command Overview
14+
To access help information, execute `s clean -h`:
2115
```shell script
2216
$ s clean -h
23-
Usage: s cli [options]
24-
17+
Usage: s clean [options]
2518
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.
19+
Example:
20+
$ s clean --component fc api
21+
$ s clean --all
22+
Tips:
23+
Get all installed component: s component
2624

27-
Example:
28-
$ s clean --component fc-api
29-
$ s clean --all
30-
31-
Tips:
32-
Get all installed component: s component
33-
34-
📖 Document: https://github.com/Serverless-Devs/Serverless-Devs/tree/master/docs/en/command/clean.md
35-
25+
📖 Document: https://serverless.help/t/s/clean
3626
Options:
37-
--all Clean up the environment
38-
--cache [dirName] Delete the <dirName> file in the cache
39-
--component [componentName] Remove component (like: fc, fc@0.0.1)
40-
-h, --help Display help for command
27+
--all Clean up the environment
28+
--logs Clean logs
29+
--cache [dirName] Delete the <dirName> file in the cache
30+
--component [componentName] Remove component (like: fc, fc@0.0.1)
31+
-h, --help Display help for command
4132
```
42-
43-
### Parameter description
44-
33+
### Parameters
34+
Navigate through the command's options with ease, each tailored for a specific aspect of the clean-up process:
4535
| Parameter | Abbreviation | Required | Description |
4636
|-----|-----|-----|-----|
47-
| all | | No | Cleans the environment. |
48-
| cache | | No | Deletes the <dirName> files in the cache. |
49-
| component | | No | Deletes a component. You can use a component name or [Component name@Version]. |
50-
51-
52-
### Example
53-
54-
If you want to clean a component, you can specify the component name in the `--component` command. For example:
55-
37+
| all | | Optional | Initiates a comprehensive environment clean-up |
38+
| logs | | Optional | Targets log files for cleaning |
39+
| cache | | Optional | Specifies and removes a <dirName> within the cache |
40+
| component | | Optional | Deletes a particular component (e.g., fc, fc@0.0.1) |
41+
### Usage Examples
42+
To purge a specific component, employ the `--component` flag alongside the name of the component:
5643
```shell script
57-
$ s clean --component fc-api
58-
Component [fc-api] has been cleaned up successfully.
44+
$ s clean --component fc api
45+
[2023-******][INFO][s_cli] Component [fc api] has been cleaned up successfully.
5946
```
60-
61-
If you want to clean up the environment, you can use the `--all` parameter. For example:
62-
47+
For cache removal, utilize the `--cache` option as demonstrated below:
48+
```shell script
49+
$ s clean --cache
50+
[2023-******][INFO][s_cli] Cache cleaned up successfully.
51+
```
52+
Log file clean-up can be achieved through the `--logs` parameter:
53+
```shell script
54+
$ s clean --logs
55+
[2023-******][INFO][s_cli] Logs cleaned up successfully.
56+
```
57+
For an all-encompassing clean-up, the `--all` parameter is at your disposal:
6358
```shell script
6459
$ s clean --all
65-
The environment of Serverless Devs has been cleaned up successfully.
60+
[2023-******][INFO][s_cli] Component cleaned up successfully.
61+
[2023-******][INFO][s_cli] Cache cleaned up successfully.
62+
[2023-******][INFO][s_cli] Logs cleaned up successfully.
63+
[2023-******][INFO][s_cli] The environment of Serverless Devs has been cleaned up successfully.
6664
```
67-
68-
## Precautions
69-
When you clean up a component, the system follows the following logic:
70-
1. First, the system checks and cleans the components that meet the condition in the Registry cache.
71-
2. Then, the system checks and cleans the component that meets the condition in the GitHub Registry cache.
65+
## Cautions
66+
Please note the following protocols when executing a component-specific clean-up:
67+
1. The system will first assess if there are any corresponding components within the current Registry cache and proceed to clear them.
68+
2. Following that, the system will purge the ultimate Registry cache, the Github Registry, eradicating any components that match the criteria.
Lines changed: 44 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,44 @@
11
---
2-
title: Cli command
3-
description: 'Cli command'
2+
title: Cli Command
3+
description: 'Cli Command'
44
position: 4
55
category: 'Commands'
66
---
7-
8-
# Cli command
9-
10-
The `cli` command allows you to directly use Serverless Devs components in CLI mode, instead of the YAML mode.
11-
12-
- [Command description](#Command-description)
13-
- [Common modes](#Common-modes)
14-
- [Support for common components](#Support-for-common-components)
15-
- [Support for specific components](#Support-for-specific-components)
16-
17-
> For more information about the differences between the YAML mode and the CLI mode, see [Compare the YAML mode with the CLI mode](./../yaml_and_cli.md)
18-
19-
## Command description
20-
21-
After you run the `s cli -h` command, the following help information is returned:
22-
7+
# Cli Command
8+
The `cli` command provides a command line interface within Yamlized, allowing direct use of Serverless Devs components via the CLI without the dependence on Yaml files.
9+
- [Command Breakdown](#command-breakdown)
10+
- [Common Usage Patterns](#common-usage-patterns)
11+
- [General Component Support](#general-component-support)
12+
- [Specific Component Support](#specific-component-support)
13+
> For insights into the differences between Yaml mode and Cli mode, as well as their respective use cases, please consult the [Yaml Mode vs. Cli Mode Comparison](./../yaml_and_cli.md) document.
14+
## Command Breakdown
15+
Executing `s cli -h` displays the relevant help information:
2316
```shell script
2417
$ s cli -h
25-
Usage: s cli [component] [method] [options]
26-
27-
Directly use serverless devs to use components, develop and manage applications without yaml configuration.
18+
Usage: s cli [options]
19+
Utilize Serverless Devs components for application development and management without the need for yaml configuration.
20+
21+
Examples:
22+
$ s cli fc api ListServices
23+
$ s cli fc api ListFunctions --path '{"serviceName": "serviceName"}' --body '{"K1": "V1"}'
2824

29-
Example:
30-
$ s cli fc-api listServices
31-
$ s cli fc-api listFunctions --service-name my-service
32-
$ s cli fc-api deploy -p "{/"function/": /"function-name/"}"
33-
34-
📖 Document: https://github.com/Serverless-Devs/Serverless-Devs/tree/master/docs/en/command/cli.md
35-
25+
📖 Documentation: https://serverless.help/t/s/
3626
Options:
37-
-a, --access [aliasName] Specify the access alias name
38-
-p, --props [jsonString] The json string of props
39-
-h, --help Display help for command
27+
-p, --props <jsonString> JSON string of props
28+
-h, --help Display help for command
4029
```
41-
42-
Method:
43-
30+
Typical usage involves:
4431
```shell script
45-
s cli [The component name, such as fc or fc-api.] [The method of the component.] -p/--props [The YAML attribute (JSON string) of the method] -a/--access [The information about the specified key.] [Other settings]
32+
s cli [component name, e.g., fc, fc api, etc.] [component method] -p/--props [Yaml property equivalent for the method (JSON string)] -a/--access [specify key info] [additional settings]
4633
```
47-
48-
49-
## Common modes
50-
51-
### Support for common components
52-
53-
In `cli` mode, you can use the `-p, --props [jsonString]` parameter to configure general support for the component.
54-
55-
For example, you specify the following description in the `s.yaml` of a Serverless Devs application:
56-
57-
34+
## Common Usage Patterns
35+
### General Component Support
36+
In Cli mode, you can support components by using the `-p, --props [jsonString]` parameter.
37+
For instance, a Serverless Devs application might be described like so:
5838
```yaml
59-
edition: 1.0.0
39+
edition: 3.0.0
6040
access: "myaccess"
61-
62-
services:
41+
resources:
6342
website-starter:
6443
component: devsapp/website
6544
props:
@@ -72,29 +51,23 @@ services:
7251
hosts:
7352
- host: auto
7453
```
75-
76-
You can also use `s website-starter deploy` to deploy `website-starter`.
77-
78-
In this case, if you deploy website-starter in `cli` mode, the preceding YAML file is not required. However, you need to write the complete information about parameters in CLI mode. Example:
79-
54+
This setup's `website-starter` segment can normally be deployed with `s website-starter deploy`.
55+
However, to deploy via `cli` mode, you bypass the Yaml file and directly input complete parameter details on the command line:
8056
```shell script
8157
s cli devsapp/website deploy -p "{\"bucket\":\"testbucket\",\"src\":{\"codeUri\":\"./\",\"publishDir\":\"./build\",\"index\":\"index.html\"},\"region\":\"cn-hangzhou\",\"hosts\":[{\"host\":\"auto\"}]}" -a myaccess
8258
```
83-
84-
### Support for specific components
85-
86-
Among the existing components of Serverless Devs, some excellent components, such as the fc-api component, for CLI mode already exist. You can use this component together with Alibaba Cloud Function Compute API operations to perform specified actions:
87-
- If you want to view functions of a service in Alibaba Cloud Function Compute in a region, run the following command:
88-
```shell script
89-
s cli fc-api listFunctions --service-name my-service --region cn-beijing -a myaccess
90-
```
91-
- You can run the following command in CLI mode to update code for functions:
92-
```shell script
93-
s cli fc-api updateFunction --region cn-hangzhou --serviceName fc-deploy-service --functionName http-trigger-function --code '{"zipFile":"./"}'
94-
```
95-
96-
In addition, many components that use the YAML mode can deliver better performance. Under certain conditions, you can also perform additional optimization for CLI mode. For example, if you want to synchronize the on- and off-premises resources of the `fc` component, you can run the following command:
97-
59+
### Specific Component Support
60+
Serverless Devs offers several well-designed components that are optimized for Cli mode. For example, the `fc api` component is prioritized for command line usage, facilitating quick interactions with certain Aliyun Function Compute (FC) service interfaces, such as:
61+
- Listing functions within a specified service and region:
62+
```shell script
63+
s cli fc api listFunctions --service-name my-service --region cn-beijing -a myaccess
64+
```
65+
- Updating function code via the command line:
66+
```shell script
67+
s cli fc api updateFunction --region cn-hangzhou --serviceName fc-deploy-service --functionName http-trigger-function --code '{"zipFile":"./"}'
68+
```
69+
Furthermore, several components that typically support Yaml mode may also offer an optimized pure command line interface for specific operations. An example is the `fc` component, which provides commands for resource synchronization:
9870
```shell script
99-
s cli fc sync --region cn-shanghai --service-name myService --type config
100-
```
71+
s cli fc sync --region cn-shanghai --service-name myService --type config
72+
```
73+
Lines changed: 22 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,51 @@
11
---
2-
title: Component command
3-
description: 'Component command'
4-
position: 8
5-
category: 'Commands'
2+
title: Component Command
3+
description: 'Component Command'
4+
position: 5
5+
category: 'Command'
66
---
77

88
# Component command
99

10-
The `component` command is used to obtain the details of components that are installed.
10+
`component` is used to get the details of installed components.
1111

12-
- [Command description](#Command-description)
13-
- [Parameter description](#Parameter-description)
12+
- [Command Parse](#Command-Parse)
13+
- [Parameter](#Parameter)
1414
- [Example](#Example)
15-
- [Precautions](#Precautions)
1615

17-
## Command description
16+
## Command Parse
1817

19-
After you run the `s component -h` command, the following help information is returned:
18+
When we execute `s component -h`, we can get help information:
2019

2120
```shell script
2221
$ s component -h
2322
Usage: s component [options]
2423

2524
Get details of installed components.
25+
26+
Example:
27+
$ s component
2628

27-
Example:
28-
$ s component
29-
$ s component --component fc-api
30-
31-
📖 Document: https://github.com/Serverless-Devs/Serverless-Devs/tree/master/docs/en/command/component.md
29+
📖 Document: https://serverless.help/t/s/component
3230

3331
Options:
34-
--component <componentName> Gets the specified component information (like: fc, fc@0.0.1)
35-
-h, --help Display help for command
32+
-h, --help Display help for command.
3633
```
3734

38-
### Parameter description
35+
### Parameter
3936

40-
| Parameter | Abbreviation | Required | Description |
41-
|-----|-----|-----|-----|
42-
| name | | No | You can obtain the specified component information, such as the component name or [Component name @Version number] |
37+
No parameters are required.
4338

4439
### Example
4540

46-
If you want to obtain the information about a component, you can use the `--component` parameter. Example:
47-
48-
```shell script
49-
$ s component --component fc-api
50-
Component: fc
51-
Registry: serverless registry [http://registry.devsapp.cn/simple]
52-
Version: 0.1.27
53-
Size: 100 MB
54-
Description: 阿里云函数计算基础组件
55-
Path: ~/.s/components/fc
56-
Hompage: https://github.com/devsapp/fc
57-
58-
🙋 Delete the component, please use the command [s clean --component fc@0.1.27]
59-
```
41+
We can execute `s component` to get all installed components, for example:
6042

61-
If you want to obtain the information about all installed components, run the `s component` command. Example:
6243
```shell script
6344
$ s component
6445

65-
🔎 serverless registry [http://registry.devsapp.cn/simple]
66-
Component Description Size Version
67-
fc 阿里云函数计算基础组件 100 MB 0.1.27
68-
devsapp/fc 阿里云函数计算基础组件 100 MB 0.1.27
69-
fc-api 函数计算api操作组件 100 MB 0.0.44
70-
71-
🔎 github registry [https://api.github.com/repos]
72-
Component Description Size Version
73-
fc 阿里云函数计算基础组件 100 MB 0.1.27
74-
devsapp/fc 阿里云函数计算基础组件 100 MB 0.1.27
75-
46+
🔎 serverless registry [https://registry.serverless-devs.com]
47+
Component Version Size Description
48+
fc 0.1.27 100 MB Aliyun Function Compute Base Component
49+
devsapp/fc 0.1.27 100 MB Aliyun Function Compute Base Component
50+
fc api 0.0.44 100 MB Function Compute api operation component
7651
```
77-
78-
79-
## Precautions
80-
When you query a component, the system displays the information about the current registry and the default GitHub registry. If you need to view other registries, run the `s set registry` command to switch registries.

0 commit comments

Comments
 (0)