Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-aws

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-aws - npm Package Compare versions

Comparing version 0.5.4 to 0.6.0

tasks/services/sns.js

14

example/Gruntfile.js

@@ -32,6 +32,18 @@

invalidate: {}
},
sns: {
options: {
accessKeyId: "<%= aws.accessKeyId %>",
secretAccessKey: "<%= aws.secretAccessKey %>",
region: "...",
target: "...",
message: "...",
subject: "..."
}
}
});
grunt.registerTask("default", ["s3"]);
};
};

2

package.json
{
"name": "grunt-aws",
"description": "A Grunt interface into the Amazon Node.JS SDK",
"version": "0.5.4",
"version": "0.6.0",
"homepage": "https://github.com/jpillora/grunt-aws",

@@ -6,0 +6,0 @@ "author": {

@@ -32,2 +32,3 @@ # grunt-aws

* [CloudFront `"cloudfront"`](#the-cloudfront-task)
* [SNS `"sns"`](#the-sns-task)

@@ -70,7 +71,7 @@ -----

#### `accessKeyId` *required* (String)
#### `accessKeyId` *required* (String)
Amazon access key id
#### `secretAccessKey` *required* (String)
#### `secretAccessKey` *required* (String)

@@ -83,2 +84,6 @@ Amazon secret access key

#### `sessionToken` (String)
Amazon session token, required if you're using temporary access keys
#### `region` (String)

@@ -141,2 +146,12 @@

### CopyFile (String)
Default `None`
Path to copy filewithin S3. ex. `my-bucket2/output/d.txt`
### CopyFrom (String)
Default `None`
Path to copy all files within S3. ex. `my-bucket2/output/`
#### `cache` (Boolean)

@@ -157,3 +172,3 @@

from `grunt-aws` on one machine then it can be `Infinity`
if you like. To disable cache, set it to `0`.
if you like. To disable cache, set it to `0`.

@@ -177,3 +192,3 @@ #### `headers` (Object)

* `ServerSideEncryption` (`"AES256"`)
* `StorageClass` (`"STANDARD"` or `"REDUCED_REDUNDANCY"`)
* `StorageClass` (`"STANDARD"` or `"REDUCED_REDUNDANCY"`)
* `WebsiteRedirectLocation`

@@ -198,3 +213,3 @@

Add a charset to your `Content-Type`. For example: `utf-8`.
Add a charset to every one of your `Content-Type`. For example: `utf-8`. If this is not set, then all text files will get charset of UTF-8 by default.

@@ -342,3 +357,3 @@ #### `mime` (Object)

},
//upload the public/ folder with a specific expiry date

@@ -352,3 +367,21 @@ beryLongTym: {

src: "public/**"
},
//Copy file directly from s3 bucket to a different bucket
copyFile: {
src: "build/c.txt",
dest: "output/d.txt",
options: {
copyFile: "my-bucket2/output/d.txt"
}
},
//Copy all files in directory
copyFiles: {
src: "public/**",
options: {
copyFrom: 'my-bucket2/public'
}
}
}

@@ -404,7 +437,7 @@ ```

#### `accessKeyId` *required* (String)
#### `accessKeyId` *required* (String)
Amazon access key id
#### `secretAccessKey` *required* (String)
#### `secretAccessKey` *required* (String)

@@ -417,5 +450,5 @@ Amazon secret access key

Each record requires `name`, `type` and `value` to be set. The `name` property is the new domain to be created. The `type` is the DNS type e.g. CNAME, ANAME, etc.. The `value` is a list of domain names or IP addresses that the DNS entry will resolve to.
Each record requires `name`, `type` and `value` to be set. The `name` property is the new domain to be created. The `type` is the DNS type e.g. CNAME, ANAME, etc.. The `value` is a list of domain names or IP addresses that the DNS entry will resolve to.
It is also possible to specify any of the additional options described in the [ResourceRecordSet section of the changeResourceRecordSets method](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Route53.html#changeResourceRecordSets-property). For example, `AliasTarget` could be used to set up an alias record.
It is also possible to specify any of the additional options described in the [ResourceRecordSet section of the changeResourceRecordSets method](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Route53.html#changeResourceRecordSets-property). For example, `AliasTarget` could be used to set up an alias record.

@@ -438,3 +471,3 @@ #### `TTL` (Number)

Number of Route53 operations that may be performed concurrently
Number of Route53 operations that may be performed concurrently

@@ -502,7 +535,7 @@ #### `cache` (Boolean)

#### `accessKeyId` *required* (String)
#### `accessKeyId` *required* (String)
Amazon access key id
#### `secretAccessKey` *required* (String)
#### `secretAccessKey` *required* (String)

@@ -531,10 +564,64 @@ Amazon secret access key

## The "sns" task
### Features
* Publish to a SNS topic
### Usage
To public a message
```js
grunt.initConfig({
aws: grunt.file.readJSON("credentials.json"),
cloudfront: {
options: {
accessKeyId: "<%= aws.accessKeyId %>",
secretAccessKey: "<%= aws.secretAccessKey %>",
region: '<%= aws.region %>',
target: 'AWS:ARN:XXXX:XXXX:XXXX',
message: 'You got it',
subject: 'A Notification'
}
}
});
```
### Options
#### `accessKeyId` *required* (String)
Amazon access key id
#### `secretAccessKey` *required* (String)
Amazon secret access key
#### `region` *required* (String)
The region that the Topic is hosted under
#### `target` *required* (String)
The AWS ARN for the topic
#### `message` *required* (String)
The message content for the notification
#### `subject` *required* (String)
The subject to use for the notification
### References
* [CloudFront AWS SDK API Docs](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudFront.html)
* [SNS AWS SDK API Docs](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SNS.html)
### Todo
* Add other SNS functionality
---
#### MIT License

@@ -562,6 +649,1 @@

SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@@ -32,2 +32,5 @@ var AWS = require("aws-sdk"),

//Action taking place.
var action = "Put"
//s3 task

@@ -71,2 +74,3 @@ grunt.registerMultiTask("s3", DESC, function() {

'secretAccessKey',
'sessionToken',
'region',

@@ -352,11 +356,27 @@ 'sslEnabled',

object.Key = dest;
object.Body = contents;
if(!object.ContentType)
object.ContentType = mime.lookup(dest);
// Set a default charset
if (opts.charset) object.ContentType += '; charset=' + opts.charset;
// Set the charset, default text type mime types to UTF-8
var charset = mime.charsets.lookup(object.ContentType, '') || opts.charset;
if (charset) object.ContentType += '; charset=' + charset;
//upload!
S3.putObject(object, putComplete);
if (opts.copyFrom || opts.copyFile) {
if (opts.copyFrom) {
var copySource = src.split('/');
copySource[0] = opts.copyFrom;
copySource = copySource.join('/');
} else {
copySource = opts.copyFile;
}
object.MetadataDirective = "REPLACE";
object.CopySource = copySource;
action = "Copy";
S3.copyObject(object, putComplete)
} else {
//upload!
object.Body = contents;
S3.putObject(object, putComplete);
}

@@ -367,3 +387,3 @@ function putComplete(err, results) {

}
grunt.log.ok(DRYRUN + "Put '" + dest + "'");
grunt.log.ok(DRYRUN + action + " '" + dest + "'");
if(!opts.dryRun)

@@ -373,2 +393,8 @@ stats.puts++;

cache.files[dest] = JSON.parse(results.ETag);
if(stats.puts % 5 == 0) {
// Periodically update the cache
CacheMgr.put(cache);
}
callback();

@@ -386,3 +412,3 @@ }

//all done
grunt.log.ok("Put " + stats.puts + " files");
grunt.log.ok(action + " " + stats.puts + " files");
if(opts.cache && (stats.puts || stats.dels || stats.refreshed || stats.newOptions))

@@ -389,0 +415,0 @@ CacheMgr.put(cache);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc