File tree Expand file tree Collapse file tree 8 files changed +36
-54
lines changed Expand file tree Collapse file tree 8 files changed +36
-54
lines changed Original file line number Diff line number Diff line change 1010 "node" : true ,
1111 "laxbreak" : true ,
1212 "globals" : {
13- "console" : true ,
14- "it" : true ,
15- "describe" : true ,
16- "before" : true ,
17- "after" : true ,
18- "assert" : true ,
19- "mock" : true ,
20- "Vue" : true ,
21- "$" : true ,
22- "mockHTMLEvent" : true ,
23- "mockMouseEvent" : true ,
24- "mockKeyEvent" : true ,
25- "casper" : true
13+ "console" : true
2614 }
2715}
Original file line number Diff line number Diff line change @@ -9,7 +9,10 @@ module.exports = function( grunt ) {
99 reporter : require ( 'jshint-stylish' ) ,
1010 jshintrc : true
1111 } ,
12- dev : {
12+ build : {
13+ src : [ 'Gruntfile.js' , 'tasks/*.js' ]
14+ } ,
15+ src : {
1316 src : 'src/**/*.js'
1417 } ,
1518 test : {
@@ -61,8 +64,7 @@ module.exports = function( grunt ) {
6164 grunt . registerTask ( 'default' , [
6265 'jshint' ,
6366 'build' ,
64- 'test' ,
65- 'size'
67+ 'test'
6668 ] )
6769
6870}
Original file line number Diff line number Diff line change 2424 "devDependencies" : {
2525 "grunt" : " ~0.4.2" ,
2626 "grunt-contrib-watch" : " ~0.5.3" ,
27- "grunt-component-build" : " ~0.4.1" ,
2827 "grunt-contrib-jshint" : " ~0.8.0" ,
29- "grunt-contrib-uglify" : " ~0.2.7" ,
3028 "grunt-mocha" : " ~0.4.6" ,
3129 "jscoverage" : " ~0.3.8" ,
3230 "jshint-stylish" : " ~0.1.4" ,
3331 "semver" : " ~2.2.1" ,
3432 "shell-task" : " ~0.1.1" ,
35- "load-grunt-tasks" : " ~0.2.1"
33+ "map-stream" : " 0.0.4" ,
34+ "uglify-js" : " ~2.4.8" ,
35+ "vinyl-fs" : " git://github.com/wearefractal/vinyl-fs" ,
36+ "gulp-component" : " ~0.1.3"
3637 }
3738}
Original file line number Diff line number Diff line change @@ -60,11 +60,16 @@ function uglify (file, cb) {
6060function gzip ( file , cb ) {
6161 zlib . gzip ( file . contents , function ( err , buf ) {
6262 file . contents = buf
63+ file . path = file . path + '.gz'
6364 cb ( err , file )
6465 } )
6566}
6667
6768function size ( file , cb ) {
68- console . log ( file . relative + ': ' + ( file . contents . length / 1024 ) . toFixed ( 2 ) + 'kb' )
69+ console . log ( blue ( file . relative + ': ' ) + ( file . contents . length / 1024 ) . toFixed ( 2 ) + 'kb' )
6970 cb ( null , file )
71+ }
72+
73+ function blue ( str ) {
74+ return '\x1b[1m\x1b[34m' + str + '\x1b[39m\x1b[22m'
7075}
Original file line number Diff line number Diff line change 1- var gulp = require ( 'vinyl-fs' ) ,
1+ var fs = require ( 'vinyl-fs' ) ,
22 component = require ( 'gulp-component' )
33
44module . exports = function ( grunt ) {
55 grunt . registerTask ( 'dev' , function ( ) {
6- gulp . src ( './component.json' )
6+ fs . src ( './component.json' )
77 . pipe ( component . scripts ( {
88 standalone : 'Vue' ,
99 name : 'vue'
1010 } ) )
11- . pipe ( gulp . dest ( './dist' ) )
11+ . pipe ( fs . dest ( './dist' ) )
1212 . on ( 'end' , this . async ( ) )
1313 } )
1414}
Original file line number Diff line number Diff line change 1- var gulp = require ( 'vinyl-fs' ) ,
1+ var fs = require ( 'vinyl-fs' ) ,
22 component = require ( 'gulp-component' ) ,
3- jsc = require ( 'gulp-jscoverage' )
3+ jsc = require ( 'jscoverage' ) ,
4+ map = require ( 'map-stream' )
45
56module . exports = function ( grunt ) {
67 grunt . registerTask ( 'instrument' , function ( ) {
7- gulp . src ( './component.json' )
8+ fs . src ( './component.json' )
89 . pipe ( component . scripts ( {
9- name : 'vue.test'
10+ name : 'vue.test-cov '
1011 } ) )
11- . pipe ( jsc ( ) )
12- . pipe ( gulp . dest ( './test' ) )
12+ . pipe ( map ( function ( file , cb ) {
13+ file . contents = new Buffer ( jsc . process ( file . path , file . contents . toString ( ) ) )
14+ cb ( null , file )
15+ } ) )
16+ . pipe ( fs . dest ( './test' ) )
1317 . on ( 'end' , this . async ( ) )
1418 } )
1519}
Original file line number Diff line number Diff line change @@ -6,10 +6,11 @@ module.exports = function (grunt) {
66
77 grunt . registerTask ( 'version' , function ( version ) {
88 ; [ 'package' , 'bower' , 'component' ] . forEach ( function ( file ) {
9- file = './' + file + '.json'
9+ file = file + '.json'
1010 var json = grunt . file . read ( file )
1111 json = json . replace ( / " v e r s i o n " \s * : \s * " ( .+ ?) " / , '"version": "' + version + '"' )
1212 grunt . file . write ( file , json )
13+ console . log ( 'updated ' + blue ( file ) )
1314 } )
1415 } )
1516
@@ -42,11 +43,7 @@ module.exports = function (grunt) {
4243 output : process . stdout
4344 } ) . question ( 'Releasing version v' + next + '. Continue? (Y/n)' , function ( answer ) {
4445 if ( ! answer || answer . toLowerCase ( ) === 'y' ) {
45- console . log (
46- '\n\x1b[1m\x1b[34m' +
47- 'Releasing: v' + next +
48- '\x1b[39m\x1b[22m'
49- )
46+ console . log ( blue ( 'Releasing: v' + next ) )
5047 grunt . task . run ( [
5148 'jshint' ,
5249 'build:' + next ,
@@ -58,4 +55,8 @@ module.exports = function (grunt) {
5855 done ( )
5956 } )
6057 } )
58+ }
59+
60+ function blue ( str ) {
61+ return '\x1b[1m\x1b[34m' + str + '\x1b[39m\x1b[22m'
6162}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments