Comparing version 0.0.3 to 0.0.4
console.log('==Lambdakit=='); | ||
require('./lib/' + Object.keys(require('minimist')(process.argv.slice(2)))[1]); | ||
const args = require('minimist')(process.argv.slice(2)); | ||
require('./lib/' + Object.keys(args)[1]); |
'use-strict'; | ||
const _ = require('lodash'); | ||
const archiver = require('archiver'); | ||
@@ -10,9 +11,17 @@ const AWS = require('aws-sdk'); | ||
const Promise = require('es6-promise').Promise; | ||
const packageJson = require('../../package.json'); | ||
AWS.config.region = packageJson.lambdakit.region || 'us-east-1'; | ||
const root = __dirname + '/../../..'; | ||
const packageJson = require(root + '/package.json'); | ||
var lambdaRelDir = packageJson.lambdakit['path-to-lambdas']; | ||
var lambdaDir = fs.readdirSync(__dirname + '/../' + lambdaRelDir); | ||
var exportDir = __dirname + '/exports'; | ||
try { | ||
require(root + '/config.aws.lambda.js'); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
AWS.config.region = _.result(packageJson, 'lambdakit.region', 'us-east-1'); | ||
var lambdaRelDir = _.result(packageJson, 'lambdakit[\'path-to-lambdas\']', '/lib'); | ||
var lambdaDir = fs.readdirSync(root + '/' + lambdaRelDir); | ||
var exportDir = root + '/exports'; | ||
var currentLambda = lambdaDir[0]; | ||
@@ -26,3 +35,3 @@ var i = 0; | ||
.then(createArchive) | ||
.then(uploadLambda) | ||
// .then(uploadLambda) | ||
.then(function () { | ||
@@ -61,3 +70,3 @@ if (i < lambdaDir.length - 1) { | ||
Publish: true, | ||
ZipFile: fs.readFileSync(__dirname + '/exports/' + currentLambda + '.zip') | ||
ZipFile: fs.readFileSync(exportDir + '/' + currentLambda + '.zip') | ||
}; | ||
@@ -98,3 +107,3 @@ lambda.updateFunctionCode(params, function (err, data) { | ||
expand: true, | ||
cwd: __dirname + lambdaRelDir + '/' + currentLambda, | ||
cwd: root + '/' + lambdaRelDir + '/' + currentLambda, | ||
src: ['**/*'] | ||
@@ -101,0 +110,0 @@ }]); |
{ | ||
"name": "lambdakit", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "A strategy for working with lambdas.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -17,6 +17,8 @@ # Lambda kit | ||
This project has a detailed example in `./example`. To run the example, `cd` into that directory and `npm_install` and run commands from there. | ||
This project has a detailed example in `./example`. To run the example, `cd` into that directory, `npm_install`, run commands from there. | ||
To run a Lambda | ||
#### Run | ||
To run a Lambda, make a file called `event.js` that consists of `module.exports` of whatever input you’d give the lambda, which is often just JSON, then use the run command below with the name of the folder (and lambda). | ||
```bash | ||
@@ -26,2 +28,10 @@ node node_modules/lambdakit --run=weather | ||
#### Deploy | ||
To deploy, simply have the config in place (see below), then run the following command. It will `npm install` inside each lambda, wrap it up in a ZIP, then inject it into your AWS stack, *BAM*! Currently it rolls thru all lambdas. | ||
```bash | ||
node node_modules/lambdakit --deploy | ||
``` | ||
### Config | ||
@@ -61,2 +71,3 @@ | ||
- Test coverage | ||
- Deploy a single lambda | ||
- Compare diff to only push changed lambdas |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
8343
133
71
8