New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

grunt-auto-release

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-auto-release - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

package.json
{
"name": "grunt-auto-release",
"description": "Grunt plugin for automatic releasing.",
"version": "0.0.2",
"version": "0.0.3",
"homepage": "https://github.com/vojtajina/grunt-auto-release",

@@ -6,0 +6,0 @@ "author": {

@@ -11,2 +11,3 @@ var GITHUB_REPO_REGEXP = /github\.com\/([\w-\.]+)\/([\w-\.]+)\.git/;

module.exports = function(grunt) {

@@ -35,25 +36,31 @@

queue.shift()(value);
queue.shift()(value, next, finish);
};
var runCmd = function(cmd, msg, fn) {
queue.push(function() {
var execCmd = function(cmd, msg, fn) {
if (msg) {
grunt.verbose.write(msg + '...');
}
exec(cmd, function(err, output) {
if (err) {
return grunt.fatal(err.message.replace(/\n$/, '.'));
}
if (msg) {
grunt.verbose.write(msg + '...');
grunt.verbose.ok();
}
exec(cmd, function(err, output) {
if (err) {
return grunt.fatal(err.message.replace(/\n$/, '.'));
}
fn(output);
});
};
if (msg) {
grunt.verbose.ok();
}
var runCmd = function(cmd, msg, fn) {
queue.push(function(valueFromPreviousCmd, next, finish) {
execCmd(cmd, msg, function(output) {
if (fn) {
output = fn(output);
fn(output, next, finish);
} else {
next(output);
}
next(output);
});

@@ -63,2 +70,8 @@ });

var runCmdIf = function(condition, cmd, msg, fn) {
if (condition) {
runCmd(cmd, msg, fn);
}
}
var run = function(fn) {

@@ -74,9 +87,32 @@ queue.push(fn);

// checkout the branch and pull from remote
runCmd('git checkout ' + opts.branch, 'Switching to ' + opts.branch);
runCmd('git pull ' + opts.remote + ' ' + opts.branch, 'Pulling from ' + opts.remote);
runCmd('git show -s --format=%H HEAD', null, function(sha) {
return sha.replace('\n', '');
// check if there are any new changes
runCmd('git describe --tags --abbrev=0', 'Getting the previous tag', function(tag, next, finish) {
var latestTag = tag.replace('\n', '');
execCmd('git log --grep="^feat|^fix" -E --oneline ' + latestTag + '..HEAD | wc -l', 'Checking for new changes since ' + latestTag, function(output) {
var newChangesCount = parseInt(output, 10);
if (!newChangesCount) {
grunt.log.ok('Nothing to release since ' + latestTag + '.');
return finish();
}
grunt.log.ok('There are ' + newChangesCount + ' new changes since ' + latestTag + '.');
return next();
});
});
runIf(opts.checkTravisBuild, function(latestCommit) {
// check Travis build
runCmdIf(opts.checkTravisBuild, 'git show -s --format=%H HEAD', null, function(sha, next) {
return next(sha.replace('\n', ''));
});
runIf(opts.checkTravisBuild, function(latestCommit, next, finish) {
grunt.verbose.write('Fetching status from GitHub/Travis...');

@@ -113,3 +149,7 @@

grunt.fatal('Travis build for ' + opts.githubUser + '/' + opts.githubRepo + '/' + latestCommit + ' failed (' + response[0].state + ').');
if (response[0].state === 'pending') {
return grunt.fatal('Travis build for ' + opts.githubUser + '/' + opts.githubRepo + '/' + latestCommit + ' is pending.');
}
return grunt.fatal('Travis build for ' + opts.githubUser + '/' + opts.githubRepo + '/' + latestCommit + ' failed (' + response[0].state + ').');
});

@@ -119,16 +159,7 @@ });

runCmd('git describe --tags --abbrev=0', 'Getting the previous tag', function(tag) {
var latestTag = tag.replace('\n', '');
runCmd('git log --grep="^feat|^fix" -E --oneline ' + latestTag + '..HEAD | wc -l', 'Checking for new changes since ' + latestTag + '...', function(output) {
var newChangesCount = parseInt(output, 10);
if (!newChangesCount) {
grunt.log.ok('Nothing to release since ' + latestTag + '.');
} else {
grunt.log.ok('There are ' + newChangesCount + ' new changes to release.');
grunt.task.run([opts.releaseTask]);
}
});
// RELEASE
run(function(_, next) {
grunt.task.run([opts.releaseTask]);
next();
});

@@ -135,0 +166,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc