This repository has been archived by the owner on Aug 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
50 lines (42 loc) · 1.6 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
'use strict'
var path = require('path');
module.exports = function(grunt) {
var _ = grunt.util._;
// By default, we load all local tasks from the tasks directory.
grunt.file.expand('tasks/*').forEach(function(task) {
grunt.loadTasks(task);
});
// Populate the config object
var config = {};
grunt.file.expand('tasks/config/*').forEach(function(configPath) {
// Get the grunt-task name to put in the config which is based on the
// name of the config file
var configName = configPath.match(/\/([^\/]*)\.js/)[1];
var option = require(path.join(__dirname + '/' + configPath))(grunt);
config[configName] = _.extend(config[configName] || {}, option);
});
grunt.initConfig(_.extend({
pkg: grunt.file.readJSON('package.json'),
releaseName: '<%= pkg.name %>-<%= pkg.version %>',
releaseMessage: '<%= pkg.name %> release <%= pkg.version %>'
}, config));
// load npm tasks
var npmTasks = [
'grunt-contrib-connect',
'grunt-mocha-phantomjs',
'grunt-contrib-copy',
'grunt-concurrent',
'grunt-open',
'grunt-contrib-uglify',
'grunt-version'
];
npmTasks.forEach(function(taskName) {
if (!grunt.task._tasks[taskName]) {
grunt.loadNpmTasks(taskName);
}
});
grunt.registerTask('build', ['lint:dev', 'copy', 'uglify', 'version:all']);
grunt.registerTask('test', ['build', 'connect:test', 'mocha_phantomjs']);
grunt.registerTask('test:browser', ['build', 'concurrent:tests']);
grunt.registerTask('default', 'build');
};