1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-22 17:02:17 -05:00

Stub node buffer using browserify ignore, src maps in tests

This commit is contained in:
Tankred Hase 2014-10-14 12:32:00 +02:00 committed by Felix Hammerl
parent c120818792
commit 2cb008c8c3

View File

@ -6,6 +6,14 @@ module.exports = function(grunt) {
var version = grunt.option('release'), var version = grunt.option('release'),
zipName = (version) ? version : 'DEV'; zipName = (version) ? version : 'DEV';
var browserifyOpt = {
exclude: ['openpgp', 'node-forge', 'net', 'tls', 'crypto'], // node apis not required at build time
ignore: ['buffer'], // node apis to be stubbed for runtime
browserifyOptions: {
debug: true
}
};
// Project configuration. // Project configuration.
grunt.initConfig({ grunt.initConfig({
@ -104,29 +112,19 @@ module.exports = function(grunt) {
files: { files: {
'dist/js/app.browserified.js': ['src/js/app.js'] 'dist/js/app.browserified.js': ['src/js/app.js']
}, },
options: { options: browserifyOpt
external: ['openpgp', 'node-forge', 'net', 'tls', 'crypto'], // node.js apis not required at build time
browserifyOptions: {
debug: true
}
}
}, },
pbkdf2Worker: { pbkdf2Worker: {
files: { files: {
'dist/js/pbkdf2-worker.browserified.js': ['src/js/crypto/pbkdf2-worker.js'] 'dist/js/pbkdf2-worker.browserified.js': ['src/js/crypto/pbkdf2-worker.js']
} },
options: browserifyOpt
}, },
mailreaderWorker: { mailreaderWorker: {
files: { files: {
'dist/js/mailreader-parser-worker.browserified.js': ['node_modules/mailreader/src/mailreader-parser-worker-browserify.js'] 'dist/js/mailreader-parser-worker.browserified.js': ['node_modules/mailreader/src/mailreader-parser-worker-browserify.js']
}, },
options: { options: browserifyOpt
external: ['buffer'], // node.js apis not required at build time
browserifyOptions: {
debug: true
}
}
}, },
unitTest: { unitTest: {
files: { files: {
@ -168,9 +166,7 @@ module.exports = function(grunt) {
'test/main.js' 'test/main.js'
] ]
}, },
options: { options: browserifyOpt
external: ['openpgp', 'node-forge', 'net', 'tls', 'crypto']
}
}, },
integrationTest: { integrationTest: {
files: { files: {
@ -180,17 +176,28 @@ module.exports = function(grunt) {
] ]
}, },
options: { options: {
external: ['openpgp', 'node-forge', 'net', 'tls', 'crypto'] exclude: browserifyOpt.exclude,
//ignore: ['buffer'], // comment in after browsercrow and browsersmtp use current npm deps
browserifyOptions: browserifyOpt.browserifyOptions
} }
} }
}, },
exorcise: { exorcise: {
bundle: { app: {
options: {},
files: { files: {
'dist/js/app.browserified.js.map': ['dist/js/app.browserified.js'], 'dist/js/app.browserified.js.map': ['dist/js/app.browserified.js'],
} }
},
unitTest: {
files: {
'test/unit/index.browserified.js.map': ['test/unit/index.browserified.js'],
}
},
integrationTest: {
files: {
'test/integration/index.browserified.js.map': ['test/integration/index.browserified.js'],
}
} }
}, },
@ -263,8 +270,9 @@ module.exports = function(grunt) {
}, },
options: { options: {
mangle: false, mangle: false,
compress: false,
sourceMap: true, sourceMap: true,
sourceMapIn: 'test/unit/index.browserified.js.map',
sourceMapIncludeSources: true,
sourceMapName: 'test/unit/index.js.map' sourceMapName: 'test/unit/index.js.map'
} }
}, },
@ -280,8 +288,9 @@ module.exports = function(grunt) {
}, },
options: { options: {
mangle: false, mangle: false,
compress: false,
sourceMap: true, sourceMap: true,
sourceMapIn: 'test/integration/index.browserified.js.map',
sourceMapIncludeSources: true,
sourceMapName: 'test/integration/index.js.map' sourceMapName: 'test/integration/index.js.map'
} }
}, },