@@ -6,6 +6,8 @@ module.exports = function (grunt) {
66 var replace = require ( 'rollup-plugin-replace' ) ;
77 var build = require ( './build.json' ) ;
88
9+ var exec = require ( 'child_process' ) . exec ;
10+
911 grunt . initConfig ( {
1012
1113 // Import package manifest
@@ -205,9 +207,10 @@ module.exports = function (grunt) {
205207
206208 bump : {
207209 options : {
208- files : [ 'package.json' , 'bower.json' ] ,
209- commitFiles : [ '-a' ] ,
210- pushTo : 'origin'
210+ files : [ 'package.json' , 'bower.json' ] ,
211+ commitFiles : [ '-a' ] ,
212+ pushTo : 'origin' ,
213+ updateConfigs : [ 'pkg' ]
211214 }
212215 }
213216 } ) ;
@@ -230,7 +233,13 @@ module.exports = function (grunt) {
230233 grunt . registerTask ( "build" , [ "clean" , "build-emoji" , "eslint" , "rollup" , "sass" , "uglify" , "string-replace" , "postcss" , "copy" ] ) ;
231234 grunt . registerTask ( "build-emoji" , [ "retinafy" , "sprite" , "sass" ] ) ;
232235 grunt . registerTask ( "dist" , [ "clean" , "eslint" , "rollup" , "sass" , "uglify" , "string-replace" , "postcss" , "copy" ] ) ;
233- grunt . registerTask ( "release" , function ( option ) {
234- grunt . task . run ( [ "bump-only:" + option , "dist" , "bump-commit" ] )
236+ grunt . registerTask ( "release" , function ( option ) {
237+ grunt . task . run ( [ "bump-only:" + option , "dist" , "changelog" , "bump-commit" ] ) ;
238+ exec ( 'npm publish' , function ( err , stdout , stderr ) {
239+ if ( err ) {
240+ grunt . fatal ( 'Can not publish to NPM:\n ' + stderr ) ;
241+ }
242+ grunt . log . ok ( 'Published to NPM ' ) ;
243+ } ) ;
235244 } )
236245} ;
0 commit comments