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

shipit-utils

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shipit-utils - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

.npmignore

52

lib/register-task.js
/**
* Register a task from Grunt or Shipit instance.
* If optional description argument is used, and taskrunner is grunt
* pass along the description for the task.
*/
module.exports = function registerTask(gruntOrShipit, name, task) {
module.exports = function registerTask(gruntOrShipit, name, desc, task) {
var shipitMethod = 'blTask';

@@ -10,19 +12,41 @@

if (gruntOrShipit.registerTask) {
if (Array.isArray(task)) {
return gruntOrShipit.registerTask(name, task);
}
if (typeof desc !== 'string') {
if (Array.isArray(desc)) {
return gruntOrShipit.registerTask(name, desc);
}
return gruntOrShipit.registerTask(name, function() {
var done = this.async();
var promise = task();
return gruntOrShipit.registerTask(name, function() {
var done = this.async();
var promise = desc();
if (promise && promise.nodeify) {
promise.nodeify(done);
} else {
done();
if (promise && promise.nodeify) {
promise.nodeify(done);
} else {
done();
}
});
} else {
if (Array.isArray(task)) {
return gruntOrShipit.registerTask(name, desc, task);
}
});
return gruntOrShipit.registerTask(name, desc, function() {
var done = this.async();
var promise = task();
if (promise && promise.nodeify) {
promise.nodeify(done);
} else {
done();
}
});
}
}
return gruntOrShipit[shipitMethod](name, task);
};
// Manage calls not using description
if (typeof desc !== 'string') {
return gruntOrShipit[shipitMethod](name, desc);
} else {
return gruntOrShipit[shipitMethod](name, task);
}
};
{
"name": "shipit-utils",
"version": "1.3.1",
"version": "1.4.0",
"dependencies": {

@@ -5,0 +5,0 @@ "lodash": "^3.5.0"

@@ -25,5 +25,7 @@ # shipit-utils

### utils.registerTask(gruntOrShipit, name, task)
### utils.registerTask(gruntOrShipit, name, [description,] task)
Register a task, regardless of your context (Grunt or Shipit).
The description arguement is optional, and will only try to pass along a task description if you are using Grunt (it will be ignored if you are using Shipit).
##### task `Fn`|`Array<String>`

@@ -30,0 +32,0 @@ Task function or array of task names to run in order. *Note: If in a Grunt context and passing an array of task names, task will always be synchronous/blocking.*

@@ -52,2 +52,14 @@ var sinon = require('sinon');

});
it('should optionally register a Grunt task with desc.', function(done) {
utils.registerTask(grunt, 'test', 'something testy!', task);
expect(grunt.task.exists('test')).to.equal(true);
done();
});
it('should still register a Shipit task if there is a desc.', function(done) {
utils.registerTask(shipit, 'test', 'something testy!', task);
expect(shipit.hasTask('test')).to.equal(true);
done();
});
});

@@ -54,0 +66,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