forked from mbenford/ngTagsInput
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
99 lines (92 loc) · 2.82 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
module.exports = grunt => {
function loadConfig(path) {
let glob = require('glob');
let object = {};
glob.sync('*', { cwd: path }).forEach(option => {
let key = option.replace(/\.js$/, '');
let data = require(path + option);
object[key] = typeof data === 'function' ? data(grunt) : data;
});
return object;
}
const config = {
pkg: grunt.file.readJSON('package.json'),
bowerDirectory: '../ngTagsInput-bower',
bowerFile: '<%= bowerDirectory %>/bower.json',
websiteDirectory: '../ngTagsInput-website',
websiteConfigFile: '<%= websiteDirectory %>/_config.yml',
files: {
js: {
src: 'src/init.js',
out: 'build/<%= pkg.name %>.js',
outMin: 'build/<%= pkg.name %>.min.js'
},
css: {
main: {
src: 'scss/main.scss',
out: 'build/<%= pkg.name %>.css',
outMin: 'build/<%= pkg.name %>.min.css'
},
bootstrap: {
src: 'scss/bootstrap/main.scss',
out: 'build/<%= pkg.name %>.bootstrap.css',
outMin: 'build/<%= pkg.name %>.bootstrap.min.css'
}
},
html: {
src: 'templates/*.html',
out: 'build/tmp/compiled-templates.js'
},
zip: {
unminified: 'build/<%= pkg.name %>.zip',
minified: 'build/<%= pkg.name %>.min.zip'
},
tgz: {
npm: 'build/<%= pkg.name %>.tgz'
},
spec: {
src: 'test/*.spec.js'
}
},
banners: {
unminified:
`/*!
* <%= pkg.prettyName %> v<%= pkg.version %>
* <%= pkg.homepage %>
*
* Copyright (c) 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>
* License: <%= pkg.license %>
*
* Generated at <%= grunt.template.today("yyyy-mm-dd HH:MM:ss o") %>
*/`,
minified: '/*! <%= pkg.prettyName %> v<%= pkg.version %> License: <%= pkg.license %> */'
}
};
grunt.util._.extend(config, loadConfig('./grunt/options/'));
grunt.initConfig(config);
require('load-grunt-tasks')(grunt);
grunt.loadTasks('grunt/tasks');
grunt.loadNpmTasks('remap-istanbul');
grunt.registerTask('lint', ['eslint']);
grunt.registerTask('test', ['lint', 'clean', 'ngtemplates', 'rollup', 'karma:local']);
grunt.registerTask('coverage', ['test', 'remapIstanbul', 'open:coverage']);
grunt.registerTask('docs', ['clean:build', 'dgeni']);
grunt.registerTask('travis', ['pack', 'compress', 'copy:travis', 'coveralls']);
grunt.registerTask('javascript-only', ['test', 'uglify']);
grunt.registerTask('css-only', ['sass', 'cssmin']);
grunt.registerTask('release', [
'pack',
'compress',
'changelog',
'replace:changelog',
'shell:git',
'copy:bower',
'update-bower-version',
'shell:git_bower',
'dgeni',
'copy:website',
'update-website-version',
'shell:git_website'
]);
grunt.registerTask('default', ['pack']);
};