-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathGruntfile.coffee
58 lines (48 loc) · 1.43 KB
/
Gruntfile.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
path = require('path')
config = (grunt) ->
clean: ['tmp', 'dist']
browserify:
release:
files:
'dist/mixpanel_data_export.js': ['src/mixpanel_data_export.js']
options:
browserifyOptions:
standalone: 'MixpanelExport'
exclude: ['xmlhttprequest', 'request']
tests:
src: [ './test/karmaBundle.js' ],
dest: './tmp/browserified_tests.js',
options:
external: [ '../../' ],
debug: true
uglify:
release:
files:
'dist/mixpanel_data_export.min.js': ['dist/mixpanel_data_export.js']
compress:
release:
options:
mode: 'gzip'
files: [
expand: true,
src: ['dist/*.min.js'],
ext: '.min.gz.js'
]
shell:
generateTestList:
command: 'mkdir -p ./tmp && find test -name \'*.js\' | sed -e \'s/$/");/\' | sed -e \'s/^/require("..\\//\' > tmp/tests_to_browserify.js'
mochaTest:
test:
options:
reporter: 'spec',
src: ['test/**/*.js']
module.exports = (grunt) ->
grunt.initConfig( config(grunt) )
grunt.loadNpmTasks('grunt-contrib-uglify')
grunt.loadNpmTasks('grunt-contrib-compress')
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.registerTask('default', ['release']);
grunt.registerTask('build', ['browserify', 'uglify', 'compress:release']);