gulpclass
Version:
Make a beautiful class-based gulpfiles with Typescript and Gulpfile.ts
63 lines • 2.01 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var MetadataStorage_1 = require("./MetadataStorage");
/**
* Registers a class from which tasks will be loaded.
* You can optionally specify your gulp instance if you want to register tasks specifically there.
*/
function Gulpclass(gulpInstance) {
return function (target) {
if (!gulpInstance)
gulpInstance = require("gulp");
MetadataStorage_1.defaultMetadataStorage.addGulpclassMetadata({
gulpInstance: gulpInstance,
classConstructor: target
});
};
}
exports.Gulpclass = Gulpclass;
/**
* Registers a task with the given name. If name is not specified then object's method name will be used.
*/
function Task(name, dependencies) {
return function (target, key) {
MetadataStorage_1.defaultMetadataStorage.addTaskMetadata({
classConstructor: target.constructor,
method: key,
name: name || key,
dependencies: dependencies || []
});
};
}
exports.Task = Task;
/**
* Tasks will be run in sequence when using this annotation.
*/
function SequenceTask(name) {
return function (target, key) {
MetadataStorage_1.defaultMetadataStorage.addTaskMetadata({
classConstructor: target.constructor,
method: key,
name: name || key,
dependencies: [],
isSequence: true
});
};
}
exports.SequenceTask = SequenceTask;
/**
* Tasks will be run merged when using this annotation.
*/
function MergedTask(name) {
return function (target, key) {
MetadataStorage_1.defaultMetadataStorage.addTaskMetadata({
classConstructor: target.constructor,
method: key,
name: name || key,
dependencies: [],
isMerge: true
});
};
}
exports.MergedTask = MergedTask;
//# sourceMappingURL=Decorators.js.map