vue2/Gruntfile.js

101 lines
2.3 KiB
JavaScript
Raw Normal View History

var fs = require('fs'),
path = require('path'),
semver = require('semver')
2013-07-28 05:04:21 +08:00
module.exports = function( grunt ) {
2013-08-25 14:48:01 +08:00
2013-07-28 05:04:21 +08:00
grunt.initConfig({
2013-12-22 15:28:13 +08:00
pkg: grunt.file.readJSON('package.json'),
2013-11-13 04:44:31 +08:00
componentbuild: {
build: {
2013-11-13 04:44:31 +08:00
options: {
2013-12-08 06:29:17 +08:00
name: 'vue',
standalone: 'Vue'
2013-11-13 04:44:31 +08:00
},
src: '.',
dest: 'dist'
},
test: {
2013-11-13 04:44:31 +08:00
options: {
2013-12-08 06:29:17 +08:00
name: 'vue.test'
2013-11-13 04:44:31 +08:00
},
src: '.',
dest: 'test'
2013-07-28 05:04:21 +08:00
}
},
jshint: {
2013-11-03 08:43:07 +08:00
options: {
2013-11-13 04:44:31 +08:00
reporter: require('jshint-stylish'),
jshintrc: true
2013-11-03 08:43:07 +08:00
},
2013-10-17 23:30:35 +08:00
dev: {
2013-11-13 04:44:31 +08:00
src: ['src/**/*.js']
},
test: {
2013-11-13 04:44:31 +08:00
src: ['test/unit/specs/*.js', 'test/functional/specs/*.js']
2013-07-28 05:04:21 +08:00
}
},
mocha: {
test: {
src: ['test/unit/runner.html'],
2013-07-28 05:04:21 +08:00
options: {
2013-10-31 05:40:58 +08:00
log: true,
2013-07-28 05:04:21 +08:00
run: true
}
}
},
2013-08-08 03:44:07 +08:00
uglify: {
build: {
options: {
compress: true,
mangle: true,
banner:
2013-12-22 15:28:13 +08:00
'/*\n' +
' VueJS v<%= version %>\n' +
' (c) 2013 Evan You\n' +
' License: MIT\n' +
'*/\n'
2013-08-08 03:44:07 +08:00
},
files: {
2013-12-08 06:29:17 +08:00
'dist/vue.min.js': 'dist/vue.js'
2013-08-08 03:44:07 +08:00
}
}
},
2013-07-28 05:04:21 +08:00
watch: {
dev: {
2013-07-28 05:04:21 +08:00
files: ['src/**/*.js', 'component.json'],
2013-11-13 04:44:31 +08:00
tasks: ['componentbuild', 'jsc']
2013-07-28 05:04:21 +08:00
}
}
})
grunt.loadNpmTasks( 'grunt-contrib-watch' )
grunt.loadNpmTasks( 'grunt-contrib-jshint' )
2013-08-08 03:44:07 +08:00
grunt.loadNpmTasks( 'grunt-contrib-uglify' )
2013-07-28 05:04:21 +08:00
grunt.loadNpmTasks( 'grunt-component-build' )
grunt.loadNpmTasks( 'grunt-mocha' )
2013-08-10 18:52:14 +08:00
2013-12-22 15:28:13 +08:00
grunt.file.recurse('tasks', function (path) {
require('./' + path)(grunt)
2013-10-31 05:40:58 +08:00
})
grunt.registerTask( 'test', [
2013-11-13 04:44:31 +08:00
'componentbuild',
2013-10-31 05:40:58 +08:00
'jsc',
'mocha',
'casper'
])
grunt.registerTask( 'default', [
2013-11-19 05:55:37 +08:00
'jshint',
2013-12-22 15:28:13 +08:00
'test'
])
2013-07-28 05:04:21 +08:00
}