Skip to content

Commit

Permalink
Fix release script
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerun committed Apr 19, 2018
1 parent 1c15dea commit 51feb8f
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,25 @@ module.exports = function(grunt) {
'publish',
'Perform final checks and publish Bower',
function() {
var npmVersion = JSON.parse(
childProcess.execSync('npm version --json').toString()
).npm.split('.');
var npmMajor = parseInt(npmVersion[0], 10);
var npmMinor = parseInt(npmVersion[1], 10);

var jsonPackage = require('./package');

if (npmMajor !== 3 || npmMinor < 5) {
grunt.log.writeln(
'You need to use at [email protected] to publish bower.'
);
grunt.log.writeln(
'It is because npm 2.x produces too long paths that Windows does not handle and newer npm drops lib/node_modules'
);
grunt.log.writeln('Please upgrade it: npm install -g npm@3');
process.exit(1);
}

if (
childProcess
.execSync('git rev-parse --abbrev-ref HEAD')
Expand Down Expand Up @@ -200,7 +217,6 @@ module.exports = function(grunt) {
inquirer.prompt(questions, function(answers) {
if (
!answers.review ||
!answers.changelog ||
!answers.tests ||
!answers.publish
) {
Expand All @@ -218,7 +234,7 @@ module.exports = function(grunt) {
'\nAlso, please remember to test published Bower one more time!'
);
grunt.log.writeln(
'\nYou can promote this bower release with "npm dist-tag add bower@' + jsonPackage.version + ' latest"'
'\nYou can promote this bower release with "npm dist-tag add bower@' + jsonPackage.version + ' latest'
);
grunt.log.writeln('\nPublishing Bower...');

Expand Down

0 comments on commit 51feb8f

Please sign in to comment.