build forge from npm using webpack

This commit is contained in:
Kyle Spearrin 2017-02-08 00:18:26 -05:00
parent e3bc6443dd
commit d684227883
4 changed files with 36 additions and 29993 deletions

View File

@ -9,7 +9,8 @@
merge = require('merge-stream'),
browserify = require('browserify'),
source = require('vinyl-source-stream'),
googleWebFonts = require('gulp-google-webfonts');
googleWebFonts = require('gulp-google-webfonts'),
webpack = require('webpack-stream');
var paths = {};
paths.dist = './dist/';
@ -29,7 +30,7 @@ gulp.task('lint', function () {
gulp.task('build', function (cb) {
return runSequence(
'clean',
['browserify', 'lib', 'less', 'lint', 'webfonts'],
['browserify', 'webpack', 'lib', 'less', 'lint', 'webfonts'],
cb);
});
@ -131,13 +132,41 @@ gulp.task('lib', ['clean:lib'], function () {
return merge(tasks);
});
gulp.task('browserify', function () {
gulp.task('browserify', ['browserify:tldjs']);
gulp.task('browserify:tldjs', function () {
return browserify(paths.npmDir + 'tldjs/index.js', { standalone: 'tldjs' })
.bundle()
.pipe(source('tld.js'))
.pipe(gulp.dest(paths.libDir + 'tldjs'));
});
gulp.task('webpack', ['webpack:forge']);
gulp.task('webpack:forge', function () {
var forgeDir = paths.npmDir + '/node-forge/lib/';
return gulp.src([
forgeDir + 'pbkdf2.js',
forgeDir + 'aes.js',
forgeDir + 'hmac.js',
forgeDir + 'sha256.js',
forgeDir + 'random.js',
forgeDir + 'forge.js'
]).pipe(webpack({
output: {
filename: 'forge.js',
library: 'forge',
libraryTarget: 'umd'
},
node: {
Buffer: false,
process: false,
crypto: false,
setImmediate: false
}
})).pipe(gulp.dest(paths.libDir + 'forge'));
});
gulp.task('less', function () {
return gulp.src(paths.lessDir + 'popup.less')

View File

@ -32,6 +32,8 @@
"browserify": "13.1.1",
"vinyl-source-stream": "1.1.0",
"gulp-google-webfonts": "0.0.14",
"ng-infinite-scroll": "1.3.0"
"ng-infinite-scroll": "1.3.0",
"node-forge": "0.7.0",
"webpack-stream": "3.2.0"
}
}

View File

@ -33,7 +33,7 @@
"lib/jquery/jquery.js",
"lib/q/q.js",
"lib/tldjs/tld.js",
"scripts/forge.js",
"lib/forge/forge.js",
"models/api/requestModels.js",
"models/api/responseModels.js",
"models/dataModels.js",

File diff suppressed because it is too large Load Diff