|
| 1 | + |
| 2 | +var gulp = require('gulp'), |
| 3 | + zip = require('gulp-zip'), |
| 4 | + del = require('del'), |
| 5 | + install = require('gulp-install'), |
| 6 | + awsLambda = require('node-aws-lambda'), |
| 7 | + path = require('path'); |
| 8 | + |
| 9 | +module.exports = function(gulp) { |
| 10 | + |
| 11 | + gulp.task('clean', function(cb) { |
| 12 | + return del(['./dist', './dist.zip'], cb); |
| 13 | + }); |
| 14 | + |
| 15 | + gulp.task('js', function() { |
| 16 | + return gulp.src('index.js') |
| 17 | + .pipe(gulp.dest('dist/')); |
| 18 | + }); |
| 19 | + |
| 20 | + gulp.task('node-mods', function() { |
| 21 | + return gulp.src('./package.json') |
| 22 | + .pipe(gulp.dest('dist/')) |
| 23 | + .pipe(install({production: true})); |
| 24 | + }); |
| 25 | + |
| 26 | + gulp.task('zip', function() { |
| 27 | + return gulp.src(['dist/**/*', '!dist/package.json']) |
| 28 | + .pipe(zip('dist.zip')) |
| 29 | + .pipe(gulp.dest('./')); |
| 30 | + }); |
| 31 | + |
| 32 | + gulp.task('upload', function(callback) { |
| 33 | + awsLambda.deploy('./dist.zip', require( path.join(process.cwd(), "lambda-config.js") ), callback); |
| 34 | + }); |
| 35 | + |
| 36 | +}; |
0 commit comments