1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-01 13:13:36 +01:00

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'), merge = require('merge-stream'),
browserify = require('browserify'), browserify = require('browserify'),
source = require('vinyl-source-stream'), source = require('vinyl-source-stream'),
googleWebFonts = require('gulp-google-webfonts'); googleWebFonts = require('gulp-google-webfonts'),
webpack = require('webpack-stream');
var paths = {}; var paths = {};
paths.dist = './dist/'; paths.dist = './dist/';
@ -29,7 +30,7 @@ gulp.task('lint', function () {
gulp.task('build', function (cb) { gulp.task('build', function (cb) {
return runSequence( return runSequence(
'clean', 'clean',
['browserify', 'lib', 'less', 'lint', 'webfonts'], ['browserify', 'webpack', 'lib', 'less', 'lint', 'webfonts'],
cb); cb);
}); });
@ -131,13 +132,41 @@ gulp.task('lib', ['clean:lib'], function () {
return merge(tasks); 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' }) return browserify(paths.npmDir + 'tldjs/index.js', { standalone: 'tldjs' })
.bundle() .bundle()
.pipe(source('tld.js')) .pipe(source('tld.js'))
.pipe(gulp.dest(paths.libDir + 'tldjs')); .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 () { gulp.task('less', function () {
return gulp.src(paths.lessDir + 'popup.less') return gulp.src(paths.lessDir + 'popup.less')

View File

@ -32,6 +32,8 @@
"browserify": "13.1.1", "browserify": "13.1.1",
"vinyl-source-stream": "1.1.0", "vinyl-source-stream": "1.1.0",
"gulp-google-webfonts": "0.0.14", "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/jquery/jquery.js",
"lib/q/q.js", "lib/q/q.js",
"lib/tldjs/tld.js", "lib/tldjs/tld.js",
"scripts/forge.js", "lib/forge/forge.js",
"models/api/requestModels.js", "models/api/requestModels.js",
"models/api/responseModels.js", "models/api/responseModels.js",
"models/dataModels.js", "models/dataModels.js",

File diff suppressed because it is too large Load Diff