Updated on 2023-10-19 GMT+08:00

Project Migration fun2s

fun2s is used to convert the configuration of a function into the s.yaml format so that it can be identified by Serverless Devs.

Command Parsing

You can run fun2s -h or fun2s --help to view the documentation.

Parameter Parsing

Table 1 Parameter description

Parameter Name

Abbreviation

Required in CLI

Description

region

-

Yes

Region

function-name

-

Yes

Function name

target

-

No

Path of the generated Serverless Devs configuration file (s.yaml by default)

This command also supports some global parameters, such as -a/--access and --debug. For details, see Global Parameters of Serverless Devs.

Examples

In the Funcraft project, run fun2s to convert a function into the YAML format. For example:
s cli fgs fun2s --region cn-north-4 --function-name fgs-deploy-test --target ./s.yml

Tips for next step
======================
* Deploy Function: s deploy -t ./s.yml

In this way, you can convert the original function configuration into s.yaml so that it complies with Serverless Devs specifications.

After conversion (s.yaml):
edition: 1.0.0
name: transform_fun
access: default
vars:
  region: cn-north-4
  functionName: fgs-deploy-test
services:
  component-test: #  Service name
    component: fgs # Component name
    props:
      region: ${vars.region}
      function:
        functionName: ${vars.functionName}
        handler: index.handler
        memorySize: 256
        timeout: 300
        runtime: Node.js14.18
        codeType: zip
        code:
          codeUri: ./code