File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -75,8 +75,25 @@ module.exports = function(grunt) {
7575 'publish' ,
7676 'Perform final checks and publish Bower' ,
7777 function ( ) {
78+ var npmVersion = JSON . parse (
79+ childProcess . execSync ( 'npm version --json' ) . toString ( )
80+ ) . npm . split ( '.' ) ;
81+ var npmMajor = parseInt ( npmVersion [ 0 ] , 10 ) ;
82+ var npmMinor = parseInt ( npmVersion [ 1 ] , 10 ) ;
83+
7884 var jsonPackage = require ( './package' ) ;
7985
86+ if ( npmMajor !== 3 || npmMinor < 5 ) {
87+ grunt . log . writeln (
88+ 'You need to use at npm@3.5 to publish bower.'
89+ ) ;
90+ grunt . log . writeln (
91+ 'It is because npm 2.x produces too long paths that Windows does not handle and newer npm drops lib/node_modules'
92+ ) ;
93+ grunt . log . writeln ( 'Please upgrade it: npm install -g npm@3' ) ;
94+ process . exit ( 1 ) ;
95+ }
96+
8097 if (
8198 childProcess
8299 . execSync ( 'git rev-parse --abbrev-ref HEAD' )
@@ -200,7 +217,6 @@ module.exports = function(grunt) {
200217 inquirer . prompt ( questions , function ( answers ) {
201218 if (
202219 ! answers . review ||
203- ! answers . changelog ||
204220 ! answers . tests ||
205221 ! answers . publish
206222 ) {
@@ -218,7 +234,7 @@ module.exports = function(grunt) {
218234 '\nAlso, please remember to test published Bower one more time!'
219235 ) ;
220236 grunt . log . writeln (
221- '\nYou can promote this bower release with "npm dist-tag add bower@' + jsonPackage . version + ' latest" '
237+ '\nYou can promote this bower release with "npm dist-tag add bower@' + jsonPackage . version + ' latest'
222238 ) ;
223239 grunt . log . writeln ( '\nPublishing Bower...' ) ;
224240
You can’t perform that action at this time.
0 commit comments