Skip to content

Commit

Permalink
commit by Serverless devs docs 1-10-2024 2:8:20
Browse files Browse the repository at this point in the history
  • Loading branch information
serverless-devs committed Jan 10, 2024
1 parent 0da3761 commit f73d7a7
Show file tree
Hide file tree
Showing 17 changed files with 592 additions and 94 deletions.
2 changes: 1 addition & 1 deletion content/en/serverless-devs/cicd.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm install
- run: npm install -g @serverless-devs/s
Expand Down
23 changes: 21 additions & 2 deletions content/en/serverless-devs/command/clean.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ position: 3
category: 'Commands'
---
# Clean Command

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.

- [Command Overview](#command-overview)
- [Parameters](#parameters)
- [Usage Examples](#usage-examples)
- [Parameters](#parameters)
- [Usage Examples](#usage-examples)
- [Cautions](#cautions)

## Command Overview

To access help information, execute `s clean -h`:

```shell script
$ s clean -h
Usage: s clean [options]
Expand All @@ -30,39 +35,53 @@ Options:
--component [componentName] Remove component (like: fc, [email protected])
-h, --help Display help for command
```

### Parameters

Navigate through the command's options with ease, each tailored for a specific aspect of the clean-up process:
| Parameter | Abbreviation | Required | Description |
|-----|-----|-----|-----|
| all | | Optional | Initiates a comprehensive environment clean-up |
| logs | | Optional | Targets log files for cleaning |
| cache | | Optional | Specifies and removes a <dirName> within the cache |
| component | | Optional | Deletes a particular component (e.g., fc, [email protected]) |

### Usage Examples

To purge a specific component, employ the `--component` flag alongside the name of the component:

```shell script
$ s clean --component fc api
[2023-******][INFO][s_cli] Component [fc api] has been cleaned up successfully.
```

For cache removal, utilize the `--cache` option as demonstrated below:

```shell script
$ s clean --cache
[2023-******][INFO][s_cli] Cache cleaned up successfully.
```

Log file clean-up can be achieved through the `--logs` parameter:

```shell script
$ s clean --logs
[2023-******][INFO][s_cli] Logs cleaned up successfully.
```

For an all-encompassing clean-up, the `--all` parameter is at your disposal:

```shell script
$ s clean --all
[2023-******][INFO][s_cli] Component cleaned up successfully.
[2023-******][INFO][s_cli] Cache cleaned up successfully.
[2023-******][INFO][s_cli] Logs cleaned up successfully.
[2023-******][INFO][s_cli] The environment of Serverless Devs has been cleaned up successfully.
```

## Cautions

Please note the following protocols when executing a component-specific clean-up:

1. The system will first assess if there are any corresponding components within the current Registry cache and proceed to clear them.
2. Following that, the system will purge the ultimate Registry cache, the Github Registry, eradicating any components that match the criteria.
31 changes: 26 additions & 5 deletions content/en/serverless-devs/command/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@ position: 4
category: 'Commands'
---
# Cli Command

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.
- [Command Breakdown](#command-breakdown)

- [Command Overview](#command-overview)
- [Common Usage Patterns](#common-usage-patterns)
- [General Component Support](#general-component-support)
- [Specific Component Support](#specific-component-support)
- [General Component Support](#general-component-support)
- [Specific Component Support](#specific-component-support)

> 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.
## Command Breakdown
>
## Command Overview

Executing `s cli -h` displays the relevant help information:

```shell script
$ s cli -h
Usage: s cli [options]
Expand All @@ -27,14 +33,20 @@ Options:
-p, --props <jsonString> JSON string of props
-h, --help Display help for command
```

Typical usage involves:

```shell script
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]
```

## Common Usage Patterns

### General Component Support

In Cli mode, you can support components by using the `-p, --props [jsonString]` parameter.
For instance, a Serverless Devs application might be described like so:

```yaml
edition: 3.0.0
access: "myaccess"
Expand All @@ -51,23 +63,32 @@ resources:
hosts:
- host: auto
```
This setup's `website-starter` segment can normally be deployed with `s website-starter deploy`.
However, to deploy via `cli` mode, you bypass the Yaml file and directly input complete parameter details on the command line:

```shell script
s cli devsapp/website deploy -p "{\"bucket\":\"testbucket\",\"src\":{\"codeUri\":\"./\",\"publishDir\":\"./build\",\"index\":\"index.html\"},\"region\":\"cn-hangzhou\",\"hosts\":[{\"host\":\"auto\"}]}" -a myaccess
```

### Specific Component Support

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:

- Listing functions within a specified service and region:

```shell script
s cli fc api listFunctions --service-name my-service --region cn-beijing -a myaccess
```

- Updating function code via the command line:

```shell script
s cli fc api updateFunction --region cn-hangzhou --serviceName fc-deploy-service --functionName http-trigger-function --code '{"zipFile":"./"}'
```

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:

```shell script
s cli fc sync --region cn-shanghai --service-name myService --type config
```

8 changes: 4 additions & 4 deletions content/en/serverless-devs/command/component.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ category: 'Command'

`component` is used to get the details of installed components.

- [Command Parse](#Command-Parse)
- [Parameter](#Parameter)
- [Example](#Example)
- [Command Overview](#command-overview)
- [Parameter](#parameter)
- [Example](#example)

## Command Parse
## Command Overview

When we execute `s component -h`, we can get help information:

Expand Down
Loading

0 comments on commit f73d7a7

Please sign in to comment.