made initial base structure

This commit is contained in:
Philipp Kunz 2016-02-12 04:49:31 +01:00
parent aad645619c
commit e7b0b77987
14 changed files with 215 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
.idea/
coverage/
ts/*.js
ts/*.js.map
ts/typings/
node_modules

27
index.d.ts vendored Normal file
View File

@ -0,0 +1,27 @@
/// <reference path="ts/typings/main.d.ts" />
declare module TaskbufferPlugins {
var init: () => void;
}
declare class Task {
task: any;
state: string;
idle: boolean;
preTask: Task;
afterTask: Task;
constructor(taskArg: any, optionsArg: {
preTask?: Task;
afterTask?: Task;
});
trigger(): void;
triggerBuffered(): void;
}
declare class TaskChain extends Task {
constructor(taskArrayArg: Task[]);
}
declare module TaskbufferTask {
var init: () => (taskArg: any, options?: any) => Task;
}
declare module TaskbufferTaskchain {
var init: () => any;
}
declare var plugins: void;

63
index.js Normal file
View File

@ -0,0 +1,63 @@
#!/usr/bin/env node
/// <reference path="./index.ts" />
var TaskbufferPlugins;
(function (TaskbufferPlugins) {
TaskbufferPlugins.init = function () {
var plugins = {
q: require("q")
};
};
})(TaskbufferPlugins || (TaskbufferPlugins = {}));
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
/// <reference path="./index.ts" />
var Task = (function () {
function Task(taskArg, optionsArg) {
this.task = taskArg;
}
Task.prototype.trigger = function () { };
;
Task.prototype.triggerBuffered = function () {
};
return Task;
})();
var TaskChain = (function (_super) {
__extends(TaskChain, _super);
function TaskChain(taskArrayArg) {
_super.call(this, {
task: function () { }
});
}
return TaskChain;
})(Task);
/// <reference path="./index.ts" />
var TaskbufferTask;
(function (TaskbufferTask) {
TaskbufferTask.init = function () {
var task = function (taskArg, options) {
var task = taskArg;
return new Task(task, options);
};
return task;
};
})(TaskbufferTask || (TaskbufferTask = {}));
/// <reference path="./index.ts" />
var TaskbufferTaskchain;
(function (TaskbufferTaskchain) {
TaskbufferTaskchain.init = function () {
var taskChain = function (taskArrayArg) {
return new TaskChain();
};
return taskChain();
};
})(TaskbufferTaskchain || (TaskbufferTaskchain = {}));
/// <reference path="./typings/main.d.ts" />
/// <reference path="./taskbuffer.plugins.ts" />
/// <reference path="./taskbuffer.classes.ts" />
/// <reference path="./taskbuffer.task.ts" />
/// <reference path="./taskbuffer.taskchain.ts" />
var plugins = TaskbufferPlugins.init();

32
package.json Normal file
View File

@ -0,0 +1,32 @@
{
"name": "taskbuffer",
"version": "0.0.0",
"description": "manage triggers and execution of tasks with promises",
"main": "index.js",
"scripts": {
"test": "(npmts)"
},
"repository": {
"type": "git",
"url": "git+https://github.com/pushrocks/taskbuffer.git"
},
"keywords": [
"gulp",
"tasks",
"watch",
"buffer"
],
"author": "Lossless GmbH",
"license": "MIT",
"bugs": {
"url": "https://github.com/pushrocks/taskbuffer/issues"
},
"homepage": "https://github.com/pushrocks/taskbuffer#readme",
"dependencies": {
"npmts": "^2.2.3",
"q": "^1.4.1"
},
"devDependencies": {
"should": "^8.2.2"
}
}

2
test/test.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
/// <reference path="ts/typings/main.d.ts" />
declare var taskbuffer: any;

11
test/test.js Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env node
/// <reference path="./typings/main.d.ts" />
var taskbuffer = require("../index.js");
describe("taskbuffer.task", function () {
describe(".task", function () {
it("should return a new task", function () {
var myTask = taskbuffer.task();
});
});
});

6
ts/index.ts Normal file
View File

@ -0,0 +1,6 @@
/// <reference path="./typings/main.d.ts" />
/// <reference path="./taskbuffer.plugins.ts" />
/// <reference path="./taskbuffer.classes.ts" />
/// <reference path="./taskbuffer.task.ts" />
/// <reference path="./taskbuffer.taskchain.ts" />
var plugins = TaskbufferPlugins.init();

24
ts/taskbuffer.classes.ts Normal file
View File

@ -0,0 +1,24 @@
/// <reference path="./index.ts" />
class Task {
task:any;
state:string;
idle:boolean;
preTask:Task;
afterTask:Task;
constructor(taskArg,optionsArg:{preTask?:Task,afterTask?:Task}){
this.task = taskArg;
}
trigger(){};
triggerBuffered(){
}
}
class TaskChain extends Task {
constructor(taskArrayArg:Task[]){
super({
task:function(){}
});
}
}

8
ts/taskbuffer.plugins.ts Normal file
View File

@ -0,0 +1,8 @@
/// <reference path="./index.ts" />
module TaskbufferPlugins {
export var init = function(){
var plugins = {
q: require("q")
}
}
}

View File

@ -0,0 +1 @@
/// <reference path="./index.ts" />

10
ts/taskbuffer.task.ts Normal file
View File

@ -0,0 +1,10 @@
/// <reference path="./index.ts" />
module TaskbufferTask {
export var init = function(){
var task = function(taskArg,options?){
var task = taskArg
return new Task(task,options);
};
return task;
}
}

View File

@ -0,0 +1,9 @@
/// <reference path="./index.ts" />
module TaskbufferTaskchain {
export var init = function(){
var taskChain = function(taskArrayArg:Task[]){
return new TaskChain();
};
return taskChain();
}
}

9
ts/test.ts Normal file
View File

@ -0,0 +1,9 @@
/// <reference path="./typings/main.d.ts" />
var taskbuffer = require("../index.js");
describe("taskbuffer.task",function(){
describe(".task",function(){
it("should return a new task",function(){
var myTask = taskbuffer.task();
})
});
});

7
ts/typings.json Normal file
View File

@ -0,0 +1,7 @@
{
"ambientDependencies": {
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts",
"mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts"
}
}