dawson-snippets
Advanced tools
Comparing version 0.17.0 to 0.17.1
@@ -1,2 +0,1 @@ | ||
const test = require('ava'); | ||
@@ -6,2 +5,3 @@ const merge = require('lodash/merge'); | ||
const s3Bucket = require('../s3-bucket'); | ||
const s3BucketVersioning = require('../s3-bucket-versioning'); | ||
const s3BucketCors = require('../s3-bucket-cors'); | ||
@@ -39,2 +39,34 @@ const s3BucketNotification = require('../s3-bucket-notification'); | ||
/* s3BucketVersioning */ | ||
const VERSIONED_BUCKET = { | ||
Resources: { | ||
AdminBucket: { | ||
Type: 'AWS::S3::Bucket', | ||
Properties: { | ||
VersioningConfiguration: { | ||
Status: 'Enabled' | ||
} | ||
}, | ||
DeletionPolicy: 'Retain' | ||
} | ||
}, | ||
Outputs: { | ||
AdminBucket: { | ||
Value: { Ref: 'AdminBucket' } | ||
} | ||
} | ||
}; | ||
test('AdminBucket', t => { | ||
t.deepEqual(VERSIONED_BUCKET, { | ||
Resources: s3BucketVersioning({ bucketLogicalName: 'AdminBucket' }), | ||
Outputs: { | ||
AdminBucket: { | ||
Value: { Ref: 'AdminBucket' } | ||
} | ||
} | ||
}); | ||
}); | ||
/* *** */ | ||
/* s3BucketCors */ | ||
@@ -41,0 +73,0 @@ const USER_BUCKET = { |
@@ -29,5 +29,3 @@ const lambdaNameTemplate = tableLogicalName => | ||
Action: ['s3:PutObject'], | ||
Resource: [ | ||
{ 'Fn::Sub': `arn:aws:s3:::\${${bucketLogicalName}}/*` } | ||
] | ||
Resource: [{ 'Fn::Sub': `arn:aws:s3:::\${${bucketLogicalName}}/*` }] | ||
}, | ||
@@ -69,3 +67,6 @@ { | ||
}, | ||
[`${lambdaNameTemplate(tableLogicalName)}Role`]: lambdaRoleTemplate(tableLogicalName, bucketLogicalName), | ||
[`${lambdaNameTemplate(tableLogicalName)}Role`]: lambdaRoleTemplate( | ||
tableLogicalName, | ||
bucketLogicalName | ||
), | ||
[lambdaName]: { | ||
@@ -129,2 +130,2 @@ Type: 'AWS::Lambda::Function', | ||
}; | ||
} | ||
}; |
{ | ||
"name": "dawson-snippets", | ||
"version": "0.17.0", | ||
"version": "0.17.1", | ||
"description": "Snippets for CloudFormation templates", | ||
@@ -10,3 +10,4 @@ "repository": { | ||
"scripts": { | ||
"test": "ava" | ||
"test": "ava", | ||
"format": "prettier-eslint --write **/*.js" | ||
}, | ||
@@ -19,4 +20,22 @@ "author": "Simone Lusenti <simone@plasticpanda.com>", | ||
"homepage": "https://github.com/dawson-org/dawson-snippets#readme", | ||
"eslintConfig": { | ||
"extends": [ | ||
"semistandard" | ||
], | ||
"rules": { | ||
"object-curly-spacing": [ | ||
2, | ||
"always" | ||
] | ||
} | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.18.1" | ||
"ava": "^0.18.1", | ||
"eslint": "^3.15.0", | ||
"eslint-config-semistandard": "^7.0.0", | ||
"eslint-config-standard": "^6.2.1", | ||
"eslint-plugin-promise": "^3.4.1", | ||
"eslint-plugin-standard": "^2.0.1", | ||
"lodash": "^4.17.4", | ||
"prettier": "^0.17.0" | ||
}, | ||
@@ -23,0 +42,0 @@ "engines": { |
@@ -14,4 +14,15 @@ # dawson-snippets | ||
For usage instructions see the README files in each folder. | ||
Snippets are composable and are designed to be merged using `lodash.merge` or any similar deep-merge function. Snippets provides Resources objects that you can attach to a dawson application using [processCFTemplate() or customTemplateFragment()](https://github.com/dawson-org/dawson-cli/blob/master/docs/README.md#6-working-with-the-template). | ||
Snippets are composable and are designed to be merged using `lodash.merge` or any similar deep-merge function. Snippets provides `Resources` objects that you can attach to a `dawson` application using [processCFTemplate() or customTemplateFragment()](https://github.com/dawson-org/dawson-cli/blob/master/docs/README.md#6-working-with-the-template). | ||
`dawson-snippets` is dependency-free; it should be used with the `dawson` package of the same version (major.minor). | ||
### Resource Names | ||
Many snippets will take one or many `logicalName` parameter(s). Each `*LogicalName` you provide must be **unique** in a whole `CloudFormation Template`. | ||
Resources Physical Names will be created automatically by `CloudFormation`. | ||
Resources Physical (real) Names and ARNs should be accessed using `Ref`, `Fn::Sub`, `Fn::GetAtt` functions and shall never be hardcoded into your apps. | ||
## License | ||
@@ -18,0 +29,0 @@ |
@@ -1,3 +0,2 @@ | ||
const makePolicyLogicalName = bucketLogicalName => | ||
`${bucketLogicalName}Policy`; | ||
const makePolicyLogicalName = bucketLogicalName => `${bucketLogicalName}Policy`; | ||
@@ -4,0 +3,0 @@ module.exports = params => { |
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
191789
27
896
36
0
8
2