Created
July 27, 2019 05:43
-
-
Save franzwong/505bc3a6103afe52636524507e21e281 to your computer and use it in GitHub Desktop.
Prepare lambda installation package with Gulp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { src, dest, series, parallel } = require('gulp'); | |
| const install = require('gulp-install'); | |
| const del = require('del'); | |
| const zip = require('gulp-zip'); | |
| const BUILD_DIR = 'build'; | |
| const packageInfo = require('./package.json'); | |
| function clean() { | |
| return del([ | |
| BUILD_DIR, | |
| ]); | |
| } | |
| function js() { | |
| return src('src/**/*.js') | |
| .pipe(dest(BUILD_DIR)); | |
| } | |
| function dependencies() { | |
| return src(['package.json', 'package-lock.json']) | |
| .pipe(dest(BUILD_DIR)) | |
| .pipe(install({ | |
| production:true | |
| })); | |
| } | |
| function package() { | |
| return src(`${BUILD_DIR}/**/*`) | |
| .pipe(zip(`${packageInfo.name}-${packageInfo.version}.zip`)) | |
| .pipe(dest('dist')); | |
| } | |
| exports.default = series( | |
| clean, | |
| parallel(js, dependencies), | |
| package, | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment