You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.3 KiB
71 lines
1.3 KiB
2 years ago
|
module.exports = function(grunt) {
|
||
|
grunt.initConfig({
|
||
|
pkg: grunt.file.readJSON('package.json'),
|
||
|
meta: {
|
||
|
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd HH:MM:ss") %> */'
|
||
|
},
|
||
|
|
||
|
githooks: {
|
||
|
options: {
|
||
|
hashbang: '#!/bin/sh',
|
||
|
template: 'install/template/shell.hb',
|
||
|
startMarker: '# GRUNT-GITHOOKS START',
|
||
|
endMarker: '# GRUNT-GITHOOKS END'
|
||
|
},
|
||
|
all: {
|
||
|
'pre-commit': 'pre-commit'
|
||
|
}
|
||
|
},
|
||
|
|
||
|
eslint: {
|
||
|
options: {
|
||
|
quiet: true
|
||
|
},
|
||
|
target: ['src/**/*.js']
|
||
|
},
|
||
|
|
||
|
mocha: {
|
||
|
all: {
|
||
|
src: ['test/*.html'],
|
||
|
},
|
||
|
options: {
|
||
|
run: true,
|
||
|
growlOnSuccess: false
|
||
|
}
|
||
|
},
|
||
|
|
||
|
// Minifies JS files
|
||
|
uglify: {
|
||
|
options: {
|
||
|
output: {
|
||
|
comments: /^!|@preserve|@license|@cc_on/i
|
||
|
},
|
||
|
sourceMap: true,
|
||
|
footer: '\n'
|
||
|
},
|
||
|
dist: {
|
||
|
files: [{
|
||
|
expand: true,
|
||
|
cwd: 'src',
|
||
|
src: ['*.js','!*.min.js'],
|
||
|
dest: 'dist',
|
||
|
ext: '.min.js',
|
||
|
extDot: 'last'
|
||
|
}]
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
// Load tasks
|
||
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||
|
grunt.loadNpmTasks('grunt-mocha');
|
||
|
grunt.loadNpmTasks('grunt-eslint');
|
||
|
grunt.loadNpmTasks('grunt-githooks');
|
||
|
|
||
|
// Default task.
|
||
|
grunt.registerTask('lint', [ 'eslint' ]);
|
||
|
grunt.registerTask('test', [ 'lint', 'mocha' ]);
|
||
|
grunt.registerTask('pre-commit', [ 'test' ]);
|
||
|
grunt.registerTask('default', [ 'test', 'uglify' ]);
|
||
|
};
|