This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGruntfile.js
128 lines (121 loc) · 3.45 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
'use strict';
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-ngdocs');
// Project configuration.
grunt.util.linefeed = '\n';
grunt.initConfig(
{
ngversion: '1.2.21',
modules : [],//to be filled in by buildScript task
lessPaths: [],//to be filled in by buildLess task
pkg : grunt.file.readJSON('package.json'),
dist : 'dist',
dir : {
test: '<%= dist %>/test result/',
temp: '<%= dist %>/tmp'
},
filename : 'angular-directives-utils',
meta : {
modules: 'angular.module(\'ng-directives-utils\', [<%= srcModules %>]);',
banner : ['/*',
' * <%= pkg.name %>',
' * Version: <%= pkg.version %> - <%= grunt.template.today(\'yyyy-mm-dd\') %>',
' */\n'].join('\n'),
wrapFun: '(function(){\'use strict\';\n'
},
concat : {
script: {
options: {
banner : '<%= meta.banner %>\n<%= meta.wrapFun %><%= meta.modules %>\n<%= meta.templateModules %>\n',
footer : '}());',
process: function (src, filepath) {
return '// Source: ' + filepath + '\n' +
src.replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1');
}
},
src : [], //src filled in by buildScript task
dest : '<%= dist %>/<%= filename %>-<%= pkg.version %>.js'
}
},
uglify : {
options: {
banner: '<%= meta.banner %>'
},
dist : {
src : ['<%= concat.script.dest %>'],
dest: '<%= dist %>/<%= filename %>-<%= pkg.version %>.min.js'
}
},
jshint : {
files : ['Gruntfile.js', 'src/**/*.js', 'assets/**/*.js'],
options: {
jshintrc: '.jshintrc'
}
},
ngdocs : {
options: {
dest : 'dist/docs',
scripts : [
'lib/jQuery/1.11.1/jquery.js',
'lib/angularJs/<%=ngversion %>/angular.js',
'lib/angularJs/<%=ngversion %>/angular-animate.js',
'assets/docs/app.js',
'<%= concat.script.dest %>'
],
styles : [
'assets/docs/demo.css'
],
editExample: true,
title : 'angular-directives-utils',
html5Mode : false
},
api : {
src : ['src/**/*.js', 'src/**/*.ngdoc'],
title: 'API'
}
},
karma : {
relase: {
configFile: 'karma.conf.js',
options : {
singleRun : true,
htmlReporter : {
outputFile: '<%= dir.test %>/units.html'
},
coverageReporter: {
type: 'html',
dir : '<%= dir.test %>/coverage/'
},
reporters : ['dots', 'html', 'coverage'],
preprocessors : {
'src/**/*.js': 'coverage'
}
}
}
},
clean : {
all : ['<%= dist%>'],
doc : ['<%= dist%>/docs'],
test: ['<%= dist%>/test result'],
temp: ['<%= dir.temp%>']
}
});
// custom
var buildScript = require('./assets/grunt/buildScript');
grunt.registerTask('buildScript', 'Create bootstrap build script', buildScript);
// tasks
grunt.registerTask('build', ['buildScript']);
grunt.registerTask('doc', ['clean:doc', 'build', 'ngdocs']);
grunt.registerTask('test', ['karma']);
grunt.registerTask('release', ['jshint', 'test', 'build', 'clean:doc', 'ngdocs']);
// default
grunt.registerTask('default', ['release']);
return grunt;
}
;