-
Notifications
You must be signed in to change notification settings - Fork 8
/
Gruntfile.js
67 lines (63 loc) · 1.85 KB
/
Gruntfile.js
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
59
60
61
62
63
64
65
66
67
var extend = require('extend');
module.exports = function (grunt) {
var compilerOptions = {
compilation_level: 'ADVANCED_OPTIMIZATIONS',
warning_level: 'VERBOSE',
summary_detail_level: 3,
language_in: 'ECMASCRIPT5_STRICT',
output_wrapper: '(function(){%output%}());',
use_types_for_optimization: true
};
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: ['build'],
mochaTest: {
test: {
src: ['test/**/*.js']
}
},
concat: {
test: {
src: ['adapters/ns.js', 'vendor/google/base.js', 'src/const.js', 'src/async.js', 'src/promise.js', 'polyfill.js', 'adapters/adapter.js'],
dest: 'build/promise.test.js'
},
test_compiled: {
src: ['adapters/ns.js', 'build/promise.js', 'adapters/adapter.js'],
dest: 'build/promise.test.js'
}
},
closurecompiler: {
compile: {
files: {
'build/promise.js': ['src/**/*.js', 'polyfill.js']
},
options: extend({}, compilerOptions)
},
debug: {
files: {
'build/promise.debug.js': ['src/**/*.js', 'polyfill.js']
},
options: extend({}, compilerOptions, {
debug: true,
formatting: ['PRETTY_PRINT', 'PRINT_INPUT_DELIMITER']
})
}
},
copy: {
dist: {
files: [
{
src: ['build/promise.js'],
dest: 'promise.js'
}
]
}
}
});
require('load-grunt-tasks')(grunt);
grunt.registerTask('compile', ['closurecompiler:compile']);
grunt.registerTask('debug', ['closurecompiler:debug']);
grunt.registerTask('default', ['compile']);
grunt.registerTask('test', grunt.option('compiled') ? ['compile', 'concat:test_compiled', 'mochaTest'] : ['concat:test', 'mochaTest']);
grunt.registerTask('dist', ['compile', 'copy']);
};