-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
134 lines (130 loc) · 2.68 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
* periodicjs.ext.install
* http://github.com/typesettin/periodicjs.ext.install
*
* Copyright (c) 2014 Yaw Joseph Etse. All rights reserved.
*/
'use strict';
var path = require('path');
module.exports = function (grunt) {
grunt.initConfig({
simplemocha: {
options: {
globals: ['should'],
timeout: 3000,
ignoreLeaks: false,
ui: 'bdd',
reporter: 'spec'
},
all: {
src: 'test/**/*.js'
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'index.js',
'controller/**/*.js',
'resources/**/*.js',
'test/**/*.js',
]
},
jsbeautifier: {
files: ['<%= jshint.all %>'],
options: {
config: '.jsbeautify'
}
},
jsdoc: {
dist: {
src: [
'index.js',
'controller/**/*.js',
'resources/**/*.js',
],
options: {
destination: 'doc/html',
configure: 'jsdoc.json'
}
}
},
browserify: {
dist: {
files: [{
expand: true,
cwd: 'resources',
src: ['**/*_src.js'],
dest: 'public',
rename: function (dest, src) {
var finallocation = path.join(dest, src);
finallocation = finallocation.replace('_src', '_build');
finallocation = finallocation.replace('resources', 'public');
finallocation = path.resolve(finallocation);
return finallocation;
}
}],
options: {}
}
},
uglify: {
options: {
sourceMap: true,
compress: {
drop_console: false
}
},
all: {
files: [{
expand: true,
cwd: 'public',
src: ['**/*_build.js'],
dest: 'public',
rename: function (dest, src) {
var finallocation = path.join(dest, src);
finallocation = finallocation.replace('_build', '.min');
finallocation = path.resolve(finallocation);
return finallocation;
}
}]
}
},
copy: {
main: {
cwd: 'public',
expand: true,
src: '**/*.*',
dest: '../../public/extensions/periodicjs.ext.install',
},
},
watch: {
scripts: {
// files: '**/*.js',
files: [
'Gruntfile.js',
'index.js',
'controller/**/*.js',
'resources/**/*.js',
'test/**/*.js',
],
tasks: ['lint', 'packagejs', 'copy', /*'doc',*/ 'test'],
options: {
interrupt: true
}
}
}
});
// Loading dependencies
for (var key in grunt.file.readJSON('package.json').devDependencies) {
if (key.indexOf('grunt') === 0 && key !== 'grunt') {
grunt.loadNpmTasks(key);
}
}
grunt.registerTask('default', ['jshint', 'simplemocha']);
grunt.registerTask('lint', 'jshint', 'jsbeautifier');
grunt.registerTask('packagejs', ['browserify', 'uglify']);
grunt.registerTask('doc', 'jsdoc');
grunt.registerTask('test', 'simplemocha');
};