Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![CircleCI](https://img.shields.io/circleci/project/github/sbstjn/serverless-stack-output.svg)](https://circleci.com/gh/sbstjn/serverless-stack-output)
[![Coveralls](https://img.shields.io/coveralls/sbstjn/serverless-stack-output.svg)](https://coveralls.io/github/sbstjn/serverless-stack-output)

A [serverless](https://serverless.com) plugin to store output from your AWS CloudFormation Stack in JSON/YAML/TOML files, or to pass the output to a JavaScript function for further processing.
A [serverless](https://serverless.com) plugin to store output from your AWS CloudFormation Stack in JSON/YAML/TOML/PROPERTIES files, or to pass the output to a JavaScript function for further processing.

## Usage

Expand All @@ -28,7 +28,7 @@ plugins:
custom:
output:
handler: scripts/output.handler # Same syntax as you already know
file: .build/stack.toml # toml, yaml, yml, and json format is available
file: .build/stack.toml # toml, yaml, yml, json, and properties format is available
```

### Handler
Expand All @@ -45,7 +45,7 @@ module.exports = { handler }

### File Formats

Just name your file with a `.json`, `.toml`, `.yaml`, or `.yml` extension, and the plugin will take care of formatting your output. Please make sure the location where you want to save the file exists!
Just name your file with a `.json`, `.toml`, `.yaml`, `.yml`, or `.properties` extension, and the plugin will take care of formatting your output. Please make sure the location where you want to save the file exists!

## License

Expand Down Expand Up @@ -161,4 +161,15 @@ ServerlessDeploymentBucketName: sls-stack-output-example-serverlessdeploymentbuc
"ServiceEndpoint": "https://APIGatewayID.execute-api.us-east-1.amazonaws.com/dev",
"ServerlessDeploymentBucketName": "sls-stack-output-example-serverlessdeploymentbuck-BucketID"
}
```
```

#### PROPERTIES

```properties
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
```
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"output"
],
"dependencies": {
"properties": "^1.2.1",
"tomlify-j0.4": "^2.0.0",
"yamljs": "^0.3.0"
},
Expand Down
2 changes: 2 additions & 0 deletions src/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export default class StackOutputFile {
case 'YAML':
case 'YML':
return require('yamljs').stringify(data)
case 'PROPERTIES':
return require('properties').stringify(data)
default:
throw new Error('No formatter found for `' + ext + '` extension')
}
Expand Down
1 change: 1 addition & 0 deletions test/file.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('File', () => {
{file: 'test.yml', valid: true, type: 'yaml', data: `foo: bar\n`},
{file: 'test.json', valid: true, type: 'json', data: `{\n "foo": "bar"\n}`},
{file: 'test.toml', valid: true, type: 'toml', data: 'foo = "bar"'},
{file: 'test.properties', valid: true, type: 'properties', data: 'foo = bar'},
{file: 'test.zip', valid: false}
],
(data) => {
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1821,6 +1821,11 @@ private@^0.1.6:
version "0.1.7"
resolved "https://registry.yarnpkg.com/private/-/private-0.1.7.tgz#68ce5e8a1ef0a23bb570cc28537b5332aba63ef1"

properties@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/properties/-/properties-1.2.1.tgz#0ee97a7fc020b1a2a55b8659eda4aa8d869094bd"
integrity sha1-Dul6f8AgsaKlW4ZZ7aSqjYaQlL0=

prr@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a"
Expand Down