-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
95 lines (92 loc) · 3.26 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/** Gruntfile for [capataz]().
*/
var path = require('path');
module.exports = function(grunt) {
var SOURCE_FILES = ['__prologue__',
'server',
'stores/Store', 'stores/MemoryStore', 'stores/FileStore',
'__epilogue__'].map(function (path) {
return 'src/capataz_node/'+ path +'.js';
});
// Init config. ////////////////////////////////////////////////////////////////////////////////////
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: { ///////////////////////////////////////////////////////////////////////////////////
build: ["build"]
},
concat: { //////////////////////////////////////////////////////////////////////////////////
options: {
separator: '\n\n',
sourceMap: true
},
build: {
src: SOURCE_FILES,
dest: 'build/capataz_node.js'
},
},
copy: { ////////////////////////////////////////////////////////////////////////////////////
build: {
files: [{ src: 'static/**', dest: 'build/', expand: true },
{ src: 'node_modules/requirejs/require.js',
dest: 'build/static/require.js', nonull: true },
{ src: 'node_modules/sermat/build/sermat-amd-min.js',
dest: 'build/static/sermat.js', nonull: true },
{ src: 'node_modules/sermat/build/sermat-amd-min.js.map',
dest: 'build/static/sermat.js.map', nonull: true },
{ src: 'node_modules/creatartis-base/build/creatartis-base.min.js',
dest: 'build/static/creatartis-base.js', nonull: true },
{ src: 'node_modules/creatartis-base/build/creatartis-base.min.js.map',
dest: 'build/static/creatartis-base.js.map', nonull: true }
]
}
},
jshint: { //////////////////////////////////////////////////////////////////////////////////
build: {
options: { // Check <http://jshint.com/docs/options/>.
loopfunc: true,
boss: true
},
src: ['src/capataz_*.js', 'build/capataz_node.js'],
},
},
uglify: { //////////////////////////////////////////////////////////////////////////////////
options: {
banner: '//! <%= pkg.name %> <%= pkg.version %>\n',
report: 'min'
},
capataz_node: {
src: './build/capataz_node.js',
dest: './build/capataz_node.min.js'
},
capataz_browser: {
src: './src/capataz_browser.js',
dest: './build/static/capataz_browser.js'
},
capataz_worker: {
src: './src/capataz_worker.js',
dest: './build/static/capataz_worker.js'
}
},
mochaTest: { ///////////////////////////////////////////////////////////////////////////////
test: {
options: {
reporter: 'spec'
},
src: ['tests/specs/*.test.js']
}
}
});
// Load tasks. /////////////////////////////////////////////////////////////////////////////////////
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-test');
// Register tasks. /////////////////////////////////////////////////////////////////////////////////
grunt.registerTask('compile', ['clean:build', 'copy:build', 'concat:build', 'jshint:build',
'uglify']);
grunt.registerTask('test', ['mochaTest:test']);
grunt.registerTask('build', ['compile', 'test']);
grunt.registerTask('default', ['build']);
};