restructure

This commit is contained in:
Philipp Kunz 2016-01-30 04:57:24 +01:00
parent f83eb035c2
commit 7c6b5afd5f
23 changed files with 48 additions and 2329 deletions

3
.gitignore vendored
View File

@ -1,6 +1,7 @@
.idea/
.c9/
node_modules/
test/node_modules
test/**/node_modules/
test/**/typings/
ts/*.js
ts/*.js.map

View File

@ -1,6 +1,6 @@
.idea/
support
compile
test
test/
examples
.gitignore

View File

@ -9,7 +9,7 @@
},
"scripts": {
"test": "(cd compile && node compile.js)",
"testm": "(npm test) && (cd test/ && node ../index.js)",
"testm": "(npm test) && (cd test/assets && node ../../index.js)",
"release": "(git add -A && git commit -m 'update' && git push origin master && npm version patch && npm publish)"
},
"repository": {
@ -34,6 +34,8 @@
"gulp-tsd": "^0.1.0",
"gulp-typescript": "2.10.0",
"merge2": "0.3.6",
"mocha": "^2.4.5",
"q": "^1.4.1",
"smartcli": "0.0.11"
}
}

1
test/assets/ts/test.js Normal file
View File

@ -0,0 +1 @@
//# sourceMappingURL=test.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":""}

0
test/assets/ts/test.ts Normal file
View File

View File

@ -1,123 +0,0 @@
// Type definitions for Colors.js 0.6.0-1
// Project: https://github.com/Marak/colors.js
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "colors" {
interface Color {
(text: string): string;
black: Color;
red: Color;
green: Color;
yellow: Color;
blue: Color;
magenta: Color;
cyan: Color;
white: Color;
gray: Color;
grey: Color;
bgBlack: Color;
bgRed: Color;
bgGreen: Color;
bgYellow: Color;
bgBlue: Color;
bgMagenta: Color;
bgCyan: Color;
bgWhite: Color;
reset: Color;
bold: Color;
dim: Color;
italic: Color;
underline: Color;
inverse: Color;
hidden: Color;
strikethrough: Color;
rainbow: Color;
zebra: Color;
america: Color;
trap: Color;
random: Color;
}
module e {
export function setTheme(theme:any): void;
export var black: Color;
export var red: Color;
export var green: Color;
export var yellow: Color;
export var blue: Color;
export var magenta: Color;
export var cyan: Color;
export var white: Color;
export var gray: Color;
export var grey: Color;
export var bgBlack: Color;
export var bgRed: Color;
export var bgGreen: Color;
export var bgYellow: Color;
export var bgBlue: Color;
export var bgMagenta: Color;
export var bgCyan: Color;
export var bgWhite: Color;
export var reset: Color;
export var bold: Color;
export var dim: Color;
export var italic: Color;
export var underline: Color;
export var inverse: Color;
export var hidden: Color;
export var strikethrough: Color;
export var rainbow: Color;
export var zebra: Color;
export var america: Color;
export var trap: Color;
export var random: Color;
}
export = e;
}
interface String {
black: string;
red: string;
green: string;
yellow: string;
blue: string;
magenta: string;
cyan: string;
white: string;
gray: string;
grey: string;
bgBlack: string;
bgRed: string;
bgGreen: string;
bgYellow: string;
bgBlue: string;
bgMagenta: string;
bgCyan: string;
bgWhite: string;
reset: string;
bold: string;
dim: string;
italic: string;
underline: string;
inverse: string;
hidden: string;
strikethrough: string;
rainbow: string;
zebra: string;
america: string;
trap: string;
random: string;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
/// <reference path="colors/colors.d.ts" />
/// <reference path="node/node.d.ts" />
/// <reference path="vinyl/vinyl.d.ts" />

View File

@ -1,109 +0,0 @@
// Type definitions for vinyl 0.4.3
// Project: https://github.com/wearefractal/vinyl
// Definitions by: vvakame <https://github.com/vvakame/>, jedmao <https://github.com/jedmao>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module 'vinyl' {
import fs = require('fs');
/**
* A virtual file format.
*/
class File {
constructor(options?: {
/**
* Default: process.cwd()
*/
cwd?: string;
/**
* Used for relative pathing. Typically where a glob starts.
*/
base?: string;
/**
* Full path to the file.
*/
path?: string;
/**
* Path history. Has no effect if options.path is passed.
*/
history?: string[];
/**
* The result of an fs.stat call. See fs.Stats for more information.
*/
stat?: fs.Stats;
/**
* File contents.
* Type: Buffer, Stream, or null
*/
contents?: Buffer | NodeJS.ReadWriteStream;
});
/**
* Default: process.cwd()
*/
public cwd: string;
/**
* Used for relative pathing. Typically where a glob starts.
*/
public base: string;
/**
* Full path to the file.
*/
public path: string;
public stat: fs.Stats;
/**
* Type: Buffer|Stream|null (Default: null)
*/
public contents: Buffer | NodeJS.ReadableStream;
/**
* Returns path.relative for the file base and file path.
* Example:
* var file = new File({
* cwd: "/",
* base: "/test/",
* path: "/test/file.js"
* });
* console.log(file.relative); // file.js
*/
public relative: string;
public isBuffer(): boolean;
public isStream(): boolean;
public isNull(): boolean;
public isDirectory(): boolean;
/**
* Returns a new File object with all attributes cloned. Custom attributes are deep-cloned.
*/
public clone(opts?: { contents?: boolean }): File;
/**
* If file.contents is a Buffer, it will write it to the stream.
* If file.contents is a Stream, it will pipe it to the stream.
* If file.contents is null, it will do nothing.
*/
public pipe<T extends NodeJS.ReadWriteStream>(
stream: T,
opts?: {
/**
* If false, the destination stream will not be ended (same as node core).
*/
end?: boolean;
}
): T;
/**
* Returns a pretty String interpretation of the File. Useful for console.log.
*/
public inspect(): string;
}
export = File;
}

View File

@ -5,6 +5,8 @@
/// <reference path="./npmts.options.ts" />
/// <reference path="./npmts.custom.ts" />
/// <reference path="./npmts.default.ts" />
/// <reference path="./npmts.tests.ts" />
/// <reference path="./npmts.promisechain.ts" />
var plugins = NpmtsPlugins.init();
var paths = NpmtsPaths.init();

View File

@ -39,7 +39,7 @@ module NpmtsDefault {
.pipe(plugins.g.typescript({
out: "test.js"
}))
.pipe(plugins.gulp.dest(paths.cwd))
.pipe(plugins.gulp.dest(paths.testDir))
});
plugins.gulp.task("defaultCleanup",function(cb){

View File

@ -6,6 +6,7 @@ module NpmtsPaths {
paths.tsd = plugins.path.join(paths.cwd,"ts/tsd.json");
paths.indexTS = plugins.path.join(paths.cwd,"ts/index.ts");
paths.testTS = plugins.path.join(paths.cwd,"ts/test.ts");
paths.testDir = plugins.path.join(paths.cwd,"test/");
return paths;
}
}

View File

@ -3,6 +3,7 @@ module NpmtsPlugins {
export var init = function() {
var plugins = {
beautylog: require("beautylog"),
fs: require("fs"),
gulp: require("gulp"),
g: {
insert: require("gulp-insert"),
@ -12,7 +13,9 @@ module NpmtsPlugins {
},
mergeStream: require("merge2"),
mocha: require("mocha"),
path: require("path"),
q:require("q"),
smartcli: require("smartcli")
};
return plugins;

6
ts/npmts.promisechain.ts Normal file
View File

@ -0,0 +1,6 @@
/// <reference path="./index.ts" />
module NpmtsPromisechain {
export var init = function(){
}
}

27
ts/npmts.tests.ts Normal file
View File

@ -0,0 +1,27 @@
/// <reference path="./index.ts" />
module NpmtsTests {
export var init = function() {
// Instantiate a Mocha instance.
var mocha = new plugins.mocha();
var testDir = 'some/dir/test';
// Add each .js file to the mocha instance
plugins.fs.readdirSync(testDir).filter(function(file){
// Only keep the .js files
return file.substr(-3) === '.js';
}).forEach(function(file){
mocha.addFile(
plugins.path.join(testDir, file)
);
});
// Run the tests.
mocha.run(function(failures){
process.on('exit', function () {
process.exit(failures);
});
});
}
}