@anttiviljami/serverless-stack-output

中文文档
0.3.1发布于 2018/12/16MITCommonJS近 30 天下载 2822

处理 AWS 云格式堆栈输出的无服务器插件

中文使用文档
文档目录10 节
  1. 使用量
  2. 安装
  3. 配置
  4. 处理器
  5. 文件格式
  6. 许可证
  7. 捐款
  8. 示例
  9. 无服务器. yml
  10. 堆栈输出

无服务器堆栈输出插件

npm license CircleCI Coveralls

A 类 无服务器 插件将您的 AWS CloudFormation Stack 输出存储于 JSON/YAML/TOML 文件, 或将输出传递给 JavaScript 函数进行进一步处理 .

使用量

安装

$ > yarn add serverless-stack-output
$ > npm install serverless-stack-output

配置

plugins:
  - serverless-stack-output

custom:
  output:
    handler: scripts/output.handler # Same syntax as you already know
    file: .build/stack.toml # toml, yaml, yml, and json format is available

处理器

根据上面的配置, 插件将搜索一个文件 scripts/output.js 内容如下:

function handler (data, serverless, options) {
  console.log('Received Stack Output', data)
}

module.exports = { handler }

文件格式

用一个名字命名你的档案 .json, (中文(简体) ), .toml, (中文(简体) ), .yaml,或 .yml 扩展名,插件将注意格式化您的输出。 请确定要保存文件的位置是否存在 !

许可证

可以随意使用代码,它使用 麻省理工学院许可证。 。 。 .

捐款

欢迎你们为这个项目出力

为了保证你有一个愉快的经验, 请阅读 行为守则它概述了核心价值观,相信并将使共同工作成为更幸福的经历.

示例

插件在无服务器功能的情况下,以及在使用自定义 CloudFormation 资源时,效果很好. 以下示例配置将部署 AWS Lambda 函数, API Gateway, SQS Quue, 有 AccessKey 和 SecretKey 的 IAM 用户, 以及一个静态值 :

无服务器. yml

service: sls-stack-output-example

plugins:
  - serverless-stack-output

package:
  exclude:
    - node_modules/**

custom:
  output:
    handler: scripts/output.handler
    file: .build/stack.toml

provider:
  name: aws
  runtime: nodejs6.10

functions:
  example:
    handler: functions/example.handle
    events:
      - http:
          path: example
          method: get
          cors: true

resources:
  Resources:
    ExampleQueue:
      Type: AWS::SQS::Queue
      Properties:
        QueueName: example-queue
    ExampleUser:
      Type: "AWS::IAM::User"
      Properties:
        UserName: example-user
        Policies:
          - PolicyName: ExampleUserSQSPolicy
            PolicyDocument:
              Version: '2012-10-17'
              Statement:
                - Effect: "Allow"
                  Action:
                    - sqs:SendMessage
                  Resource:
                    - {"Fn::Join": [":", ["arn:aws:sqs:*", {"Ref": "AWS::AccountId"}, "example-queue"]]}
    ExampleUserKey:
      Type: AWS::IAM::AccessKey
      Properties:
        UserName:
          Ref: ExampleUser
  Outputs:
    ExampleUserKey:
      Value:
        Ref: ExampleUserKey
    ExampleUserSecret:
      Value: {"Fn::GetAtt": ["ExampleUserKey", "SecretAccessKey"]}
    ExampleStaticValue:
      Value: example-static-value

堆栈输出

移动

ExampleUserSecret = "YourUserSecretKey"
ExampleUserKey = "YourUserAccessKey"
ExampleLambdaFunctionQualifiedArn = "arn:aws:lambda:us-east-1:AccountID:function:sls-stack-output-example-dev-example:9"
ExampleStaticValue = "example-static-value"
ServiceEndpoint = "https://APIGatewayID.execute-api.us-east-1.amazonaws.com/dev"
ServerlessDeploymentBucketName = "sls-stack-output-example-serverlessdeploymentbuck-BucketID"

也门

ExampleUserSecret: YourUserSecretKey
ExampleUserKey: YourUserAccessKey
ExampleLambdaFunctionQualifiedArn: 'arn:aws:lambda:us-east-1:AccountID:function:sls-stack-output-example-dev-example:9'
ExampleStaticValue: example-static-value
ServiceEndpoint: 'https://APIGatewayID.execute-api.us-east-1.amazonaws.com/dev'
ServerlessDeploymentBucketName: sls-stack-output-example-serverlessdeploymentbuck-BucketID

贾森

{
  "ExampleUserSecret": "YourUserSecretKey",
  "ExampleUserKey": "YourUserAccessKey",
  "ExampleLambdaFunctionQualifiedArn": "arn:aws:lambda:us-east-1:AccountID:function:sls-stack-output-example-dev-example:9",
  "ExampleStaticValue": "example-static-value",
  "ServiceEndpoint": "https://APIGatewayID.execute-api.us-east-1.amazonaws.com/dev",
  "ServerlessDeploymentBucketName": "sls-stack-output-example-serverlessdeploymentbuck-BucketID"
}

版本与发布记录

@anttiviljami/serverless-stack-output 共发布 4 个版本,首次发布于 2018/12/11;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.3.1latest2018/12/167 年前
0.3.02018/12/117 年前
0.2.52018/12/117 年前
0.2.42018/12/117 年前

关于 @anttiviljami/serverless-stack-output 的常见问题

@anttiviljami/serverless-stack-output 是什么?

处理 AWS 云格式堆栈输出的无服务器插件

如何安装 @anttiviljami/serverless-stack-output?

在项目目录运行 npm install @anttiviljami/serverless-stack-output,或使用 pnpm add / yarn add / bun add。

@anttiviljami/serverless-stack-output 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/anttiviljami__serverless-stack-output 是否存在。

@anttiviljami/serverless-stack-output 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@anttiviljami/serverless-stack-output 可以商用吗?

@anttiviljami/serverless-stack-output 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@anttiviljami/serverless-stack-output 的下载量有多少?

根据 npm 官方下载统计,@anttiviljami/serverless-stack-output 在 2026/10/06 – 2026/11/04 这 30 天内被下载 2,822 次,日均约 94 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@anttiviljami/serverless-stack-output 还在维护吗?

最新版本 0.3.1 发布于 2018/12/16(7 年前);至今共发布 4 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/12/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。