From e7b0b7798774a9ff7e5f829ba33c9551d52eacec Mon Sep 17 00:00:00 2001 From: PhilKunz Date: Fri, 12 Feb 2016 04:49:31 +0100 Subject: [PATCH] made initial base structure --- .gitignore | 6 ++++ index.d.ts | 27 +++++++++++++++ index.js | 63 +++++++++++++++++++++++++++++++++++ package.json | 32 ++++++++++++++++++ test/test.d.ts | 2 ++ test/test.js | 11 ++++++ ts/index.ts | 6 ++++ ts/taskbuffer.classes.ts | 24 +++++++++++++ ts/taskbuffer.plugins.ts | 8 +++++ ts/taskbuffer.promisechain.ts | 1 + ts/taskbuffer.task.ts | 10 ++++++ ts/taskbuffer.taskchain.ts | 9 +++++ ts/test.ts | 9 +++++ ts/typings.json | 7 ++++ 14 files changed, 215 insertions(+) create mode 100644 .gitignore create mode 100644 index.d.ts create mode 100644 index.js create mode 100644 package.json create mode 100644 test/test.d.ts create mode 100644 test/test.js create mode 100644 ts/index.ts create mode 100644 ts/taskbuffer.classes.ts create mode 100644 ts/taskbuffer.plugins.ts create mode 100644 ts/taskbuffer.promisechain.ts create mode 100644 ts/taskbuffer.task.ts create mode 100644 ts/taskbuffer.taskchain.ts create mode 100644 ts/test.ts create mode 100644 ts/typings.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1219f97 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.idea/ +coverage/ +ts/*.js +ts/*.js.map +ts/typings/ +node_modules diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..d7556f1 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,27 @@ +/// +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; diff --git a/index.js b/index.js new file mode 100644 index 0000000..4d07da6 --- /dev/null +++ b/index.js @@ -0,0 +1,63 @@ +#!/usr/bin/env node + +/// +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 __()); +}; +/// +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); +/// +var TaskbufferTask; +(function (TaskbufferTask) { + TaskbufferTask.init = function () { + var task = function (taskArg, options) { + var task = taskArg; + return new Task(task, options); + }; + return task; + }; +})(TaskbufferTask || (TaskbufferTask = {})); +/// +var TaskbufferTaskchain; +(function (TaskbufferTaskchain) { + TaskbufferTaskchain.init = function () { + var taskChain = function (taskArrayArg) { + return new TaskChain(); + }; + return taskChain(); + }; +})(TaskbufferTaskchain || (TaskbufferTaskchain = {})); +/// +/// +/// +/// +/// +var plugins = TaskbufferPlugins.init(); diff --git a/package.json b/package.json new file mode 100644 index 0000000..93f7875 --- /dev/null +++ b/package.json @@ -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" + } +} diff --git a/test/test.d.ts b/test/test.d.ts new file mode 100644 index 0000000..e353f62 --- /dev/null +++ b/test/test.d.ts @@ -0,0 +1,2 @@ +/// +declare var taskbuffer: any; diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000..850baa5 --- /dev/null +++ b/test/test.js @@ -0,0 +1,11 @@ +#!/usr/bin/env node + +/// +var taskbuffer = require("../index.js"); +describe("taskbuffer.task", function () { + describe(".task", function () { + it("should return a new task", function () { + var myTask = taskbuffer.task(); + }); + }); +}); diff --git a/ts/index.ts b/ts/index.ts new file mode 100644 index 0000000..ad93f9f --- /dev/null +++ b/ts/index.ts @@ -0,0 +1,6 @@ +/// +/// +/// +/// +/// +var plugins = TaskbufferPlugins.init(); \ No newline at end of file diff --git a/ts/taskbuffer.classes.ts b/ts/taskbuffer.classes.ts new file mode 100644 index 0000000..c479c22 --- /dev/null +++ b/ts/taskbuffer.classes.ts @@ -0,0 +1,24 @@ +/// +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(){} + }); + } +} \ No newline at end of file diff --git a/ts/taskbuffer.plugins.ts b/ts/taskbuffer.plugins.ts new file mode 100644 index 0000000..eff7eae --- /dev/null +++ b/ts/taskbuffer.plugins.ts @@ -0,0 +1,8 @@ +/// +module TaskbufferPlugins { + export var init = function(){ + var plugins = { + q: require("q") + } + } +} \ No newline at end of file diff --git a/ts/taskbuffer.promisechain.ts b/ts/taskbuffer.promisechain.ts new file mode 100644 index 0000000..019254e --- /dev/null +++ b/ts/taskbuffer.promisechain.ts @@ -0,0 +1 @@ +/// \ No newline at end of file diff --git a/ts/taskbuffer.task.ts b/ts/taskbuffer.task.ts new file mode 100644 index 0000000..40e4073 --- /dev/null +++ b/ts/taskbuffer.task.ts @@ -0,0 +1,10 @@ +/// +module TaskbufferTask { + export var init = function(){ + var task = function(taskArg,options?){ + var task = taskArg + return new Task(task,options); + }; + return task; + } +} \ No newline at end of file diff --git a/ts/taskbuffer.taskchain.ts b/ts/taskbuffer.taskchain.ts new file mode 100644 index 0000000..57dd881 --- /dev/null +++ b/ts/taskbuffer.taskchain.ts @@ -0,0 +1,9 @@ +/// +module TaskbufferTaskchain { + export var init = function(){ + var taskChain = function(taskArrayArg:Task[]){ + return new TaskChain(); + }; + return taskChain(); + } +} \ No newline at end of file diff --git a/ts/test.ts b/ts/test.ts new file mode 100644 index 0000000..42ded7c --- /dev/null +++ b/ts/test.ts @@ -0,0 +1,9 @@ +/// +var taskbuffer = require("../index.js"); +describe("taskbuffer.task",function(){ + describe(".task",function(){ + it("should return a new task",function(){ + var myTask = taskbuffer.task(); + }) + }); +}); \ No newline at end of file diff --git a/ts/typings.json b/ts/typings.json new file mode 100644 index 0000000..57323dd --- /dev/null +++ b/ts/typings.json @@ -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" + } +}