forked from angular-ui/ui-codemirror
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gruntFile.js
140 lines (124 loc) · 3.53 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
135
136
137
138
139
140
module.exports = function (grunt) {
'use strict';
require('load-grunt-tasks')(grunt);
// Default task.
grunt.registerTask('default', ['jshint', 'karma:unit']);
grunt.registerTask('serve', ['connect:continuous', 'karma:continuous', 'watch']);
grunt.registerTask('dist', ['ngAnnotate', 'uglify']);
// HACK TO ACCESS TO THE COMPONENT-PUBLISHER
function fakeTargetTask(prefix){
return function(){
if (this.args.length !== 1) {
return grunt.log.fail('Just give the name of the ' + prefix + ' you want like :\ngrunt ' + prefix + ':bower');
}
var done = this.async();
var spawn = require('child_process').spawn;
spawn('./node_modules/.bin/gulp', [ prefix, '--branch='+this.args[0] ].concat(grunt.option.flags()), {
cwd : './node_modules/angular-ui-publisher',
stdio: 'inherit'
}).on('close', done);
};
}
grunt.registerTask('build', fakeTargetTask('build'));
grunt.registerTask('publish', fakeTargetTask('publish'));
//
// Project configuration.
grunt.initConfig({
bower: 'bower_components',
dist : '<%= bower %>/angular-ui-docs',
pkg: grunt.file.readJSON('package.json'),
meta: {
banner: ['/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' * @version v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>',
' * @link <%= pkg.homepage %>',
' * @license <%= pkg.license %>',
' */',
''].join('\n')
},
watch: {
src: {
files: ['src/*'],
tasks: ['jshint:src', 'karma:unit:run', 'dist', 'build:gh-pages']
},
test: {
files: ['test/*.js'],
tasks: ['jshint:test', 'karma:unit:run']
},
demo: {
files: ['demo/*', 'publish.js'],
tasks: ['jshint', 'build:gh-pages']
},
livereload: {
files: ['out/built/gh-pages/**/*'],
options: { livereload: true }
}
},
karma: {
unit: {configFile: 'test/karma.conf.js', singleRun: true},
server: {configFile: 'test/karma.conf.js'},
continuous: {configFile: 'test/karma.conf.js', background: true }
},
connect: {
options: {
base : 'out/built/gh-pages',
open: true,
livereload: true
},
server: { options: { keepalive: true } },
continuous: { options: { keepalive: false } }
},
jshint: {
src: {
files:{ src : ['src/*.js', 'demo/**/*.js'] },
options: { jshintrc: '.jshintrc' }
},
test: {
files:{ src : [ 'test/*.spec.js', 'publish.js', 'gruntFile.js'] },
options: grunt.util._.extend({}, grunt.file.readJSON('.jshintrc'), {
node: true,
globals: {
angular: false,
inject: false,
jQuery: false,
jasmine: false,
afterEach: false,
beforeEach: false,
ddescribe: false,
describe: false,
expect: false,
iit: false,
it: false,
spyOn: false,
xdescribe: false,
xit: false
}
})
}
},
uglify: {
options: {banner: '<%= meta.banner %>'},
build: {
expand: true,
cwd: 'dist',
src: ['*.js'],
ext: '.min.js',
dest: 'dist'
}
},
ngAnnotate: {
main: {
expand: true,
cwd: 'src',
src: ['*.js'],
dest: 'dist'
}
},
changelog: {
options: {
dest: 'CHANGELOG.md',
from: grunt.option('from')
}
}
});
};