Preview Command

The preview command is used to preview the rendering results of Serverless Devs Yaml files.

Command Overview

After executing s preview -h, you can view the relevant help information:

Usage: s preview [options]
Application preview.
  
  Example:
    $ s preview
    
πŸ“–  Document: https://serverless.help/t/s/preview
Options:
  --env <envName>                 Specify the environment name
  -h, --help                      Display help for command

Parameter Analysis

Full ParameterAbbreviationRequiredMeaning
env-OptionalSpecify the environment for execution

Operational Examples

By executing the s preview command, you can view the rendering results of the resource description Yaml file. For example, if the original content of s.yaml is as follows:

edition: 3.0.0 #  Command line YAML specification version, following Semantic Versioning
name: framework #  Project name
access: "default"
vars:
  region: cn-huhehaote
resources:
  next_demo:
    component: fc3
    props: # Component properties
      region: ${vars.region}
      function:
        functionName: "next-start-hello"
        runtime: "nodejs16"
        code: ./code
        environmentVariables:
          name: ${this.name}
          code: ${this.props.function.code}
  demo:
    component: fc3
    props: # Component properties
      region: ${vars.region}
      function:
        functionName: "start-hello"
        runtime: "nodejs16"
        code: ./code

Then the result of executing s preview would be:

edition:   3.0.0
name:      framework
access:    default
vars: 
  region: cn-huhehaote
resources: 
  next_demo: 
    component: fc3
    props: 
      region:   cn-huhehaote
      function: 
        functionName:         next-start-hello
        runtime:              nodejs16
        code:                 ./code
        environmentVariables: 
          name:      next_demo
          code:      ./code
  demo: 
    component: fc3
    props: 
      region:   cn-huhehaote
      function: 
        functionName: start-hello
        runtime:      nodejs16
        code:         ./code
Edit this page on GitHub Updated at Fri, Mar 22, 2024