improve logging
This commit is contained in:
parent
870d24701c
commit
ef64874411
8
index.d.ts
vendored
8
index.d.ts
vendored
@ -4,8 +4,10 @@ declare module NpmtsPlugins {
|
||||
beautylog: any;
|
||||
gulp: any;
|
||||
g: {
|
||||
typescript: any;
|
||||
insert: any;
|
||||
sequence: any;
|
||||
tsd: any;
|
||||
typescript: any;
|
||||
};
|
||||
mergeStream: any;
|
||||
path: any;
|
||||
@ -22,8 +24,10 @@ declare var plugins: {
|
||||
beautylog: any;
|
||||
gulp: any;
|
||||
g: {
|
||||
typescript: any;
|
||||
insert: any;
|
||||
sequence: any;
|
||||
tsd: any;
|
||||
typescript: any;
|
||||
};
|
||||
mergeStream: any;
|
||||
path: any;
|
||||
|
28
index.js
28
index.js
@ -8,8 +8,10 @@ var NpmtsPlugins;
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
g: {
|
||||
typescript: require("gulp-typescript"),
|
||||
insert: require("gulp-insert")
|
||||
insert: require("gulp-insert"),
|
||||
sequence: require("gulp-sequence"),
|
||||
tsd: require("gulp-tsd"),
|
||||
typescript: require("gulp-typescript")
|
||||
},
|
||||
mergeStream: require("merge2"),
|
||||
path: require("path"),
|
||||
@ -25,6 +27,7 @@ var NpmtsPaths;
|
||||
NpmtsPaths.init = function () {
|
||||
var paths = {};
|
||||
paths.cwd = plugins.smartcli.get.cwd().path;
|
||||
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");
|
||||
return paths;
|
||||
@ -35,7 +38,15 @@ var NpmtsPaths;
|
||||
var NpmtsDefault;
|
||||
(function (NpmtsDefault) {
|
||||
NpmtsDefault.init = function () {
|
||||
plugins.gulp.task("indexTS", function () {
|
||||
plugins.gulp.task("defaultTsd", function (cb) {
|
||||
plugins.beautylog.log("now installing typings from" + " ts/tsd.json".blue);
|
||||
plugins.g.tsd({
|
||||
command: 'reinstall',
|
||||
config: paths.tsd
|
||||
}, cb);
|
||||
});
|
||||
plugins.gulp.task("defaultIndexTS", function () {
|
||||
plugins.beautylog.log("now compiling" + " ts/index.ts".blue);
|
||||
var tsResult = plugins.gulp.src(paths.indexTS)
|
||||
.pipe(plugins.g.typescript({
|
||||
out: "index.js",
|
||||
@ -48,15 +59,20 @@ var NpmtsDefault;
|
||||
.pipe(plugins.gulp.dest(paths.cwd))
|
||||
]);
|
||||
});
|
||||
plugins.gulp.task("testTS", function () {
|
||||
plugins.gulp.task("defaultTestTS", function () {
|
||||
plugins.beautylog.log("now compiling" + " ts/test.ts".blue);
|
||||
plugins.gulp.src(paths.testTS)
|
||||
.pipe(plugins.g.typescript({
|
||||
out: "test.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.cwd));
|
||||
});
|
||||
plugins.gulp.task("default", ["indexTS", "testTS"], function () {
|
||||
plugins.beautylog.success("TypeScript for this module was compiled successfully.");
|
||||
plugins.gulp.task("defaultCleanup", function (cb) {
|
||||
plugins.beautylog.success("TypeScript for this module compiled successfully.");
|
||||
cb();
|
||||
});
|
||||
plugins.gulp.task("default", function (cb) {
|
||||
plugins.g.sequence("defaultTsd", "defaultIndexTS", "defaultTestTS", "defaultCleanup", cb);
|
||||
});
|
||||
plugins.gulp.start.apply(plugins.gulp, ['default']);
|
||||
};
|
||||
|
@ -9,8 +9,8 @@
|
||||
},
|
||||
"scripts": {
|
||||
"test": "(cd compile && node compile.js)",
|
||||
"release": "(git add -A && git commit -m 'update' && git push origin master && npm version patch && npm publish)",
|
||||
"testm": "(cd test/ && node ../index.js)"
|
||||
"testm": "(npm test) && (cd test/ && node ../index.js)",
|
||||
"release": "(git add -A && git commit -m 'update' && git push origin master && npm version patch && npm publish)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
0
test/index.d.ts
vendored
Normal file
0
test/index.d.ts
vendored
Normal file
5
test/index.js
Normal file
5
test/index.js
Normal file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
(function () {
|
||||
console.log("test");
|
||||
}());
|
18
test/ts/tsd.json
Normal file
18
test/ts/tsd.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"version": "v4",
|
||||
"repo": "borisyankov/DefinitelyTyped",
|
||||
"ref": "master",
|
||||
"path": "typings",
|
||||
"bundle": "typings/tsd.d.ts",
|
||||
"installed": {
|
||||
"node/node.d.ts": {
|
||||
"commit": "78d36dd49b6b55b9fdfe61776a12bf05c8b07777"
|
||||
},
|
||||
"colors/colors.d.ts": {
|
||||
"commit": "09e37435ffb2c56a6f908081194a74756f24f99d"
|
||||
},
|
||||
"vinyl/vinyl.d.ts": {
|
||||
"commit": "78d36dd49b6b55b9fdfe61776a12bf05c8b07777"
|
||||
}
|
||||
}
|
||||
}
|
123
test/ts/typings/colors/colors.d.ts
vendored
Normal file
123
test/ts/typings/colors/colors.d.ts
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
// 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;
|
||||
}
|
2090
test/ts/typings/node/node.d.ts
vendored
Normal file
2090
test/ts/typings/node/node.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3
test/ts/typings/tsd.d.ts
vendored
Normal file
3
test/ts/typings/tsd.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/// <reference path="colors/colors.d.ts" />
|
||||
/// <reference path="node/node.d.ts" />
|
||||
/// <reference path="vinyl/vinyl.d.ts" />
|
109
test/ts/typings/vinyl/vinyl.d.ts
vendored
Normal file
109
test/ts/typings/vinyl/vinyl.d.ts
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
// 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;
|
||||
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
module NpmtsDefault {
|
||||
export var init = function() {
|
||||
plugins.gulp.task("defaultTsd",function(cb){
|
||||
plugins.beautylog.log("now installing typings from" + " ts/tsd.json".blue);
|
||||
plugins.g.tsd({
|
||||
command: 'reinstall',
|
||||
config: paths.tsd
|
||||
@ -11,6 +12,7 @@ module NpmtsDefault {
|
||||
|
||||
|
||||
plugins.gulp.task("defaultIndexTS", function(){
|
||||
plugins.beautylog.log("now compiling" + " ts/index.ts".blue);
|
||||
var tsResult = plugins.gulp.src(paths.indexTS)
|
||||
.pipe(plugins.g.typescript({
|
||||
out:"index.js",
|
||||
@ -26,6 +28,7 @@ module NpmtsDefault {
|
||||
});
|
||||
|
||||
plugins.gulp.task("defaultTestTS", function(){
|
||||
plugins.beautylog.log("now compiling" + " ts/test.ts".blue);
|
||||
plugins.gulp.src(paths.testTS)
|
||||
.pipe(plugins.g.typescript({
|
||||
out: "test.js"
|
||||
@ -33,9 +36,13 @@ module NpmtsDefault {
|
||||
.pipe(plugins.gulp.dest(paths.cwd))
|
||||
});
|
||||
|
||||
plugins.gulp.task("defaultCleanup",function(cb){
|
||||
plugins.beautylog.success("TypeScript for this module compiled successfully.");
|
||||
cb();
|
||||
});
|
||||
|
||||
plugins.gulp.task("default",function(cb){
|
||||
plugins.g.sequence("defaultTsd","defaultIndexTS","defaultTestTS");
|
||||
plugins.beautylog.success("TypeScript for this module was compiled successfully.");
|
||||
plugins.g.sequence("defaultTsd","defaultIndexTS","defaultTestTS","defaultCleanup",cb);
|
||||
});
|
||||
|
||||
plugins.gulp.start.apply(plugins.gulp, ['default']);
|
||||
|
@ -3,6 +3,7 @@ module NpmtsPaths {
|
||||
export var init = function() {
|
||||
var paths:any = {};
|
||||
paths.cwd = plugins.smartcli.get.cwd().path;
|
||||
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");
|
||||
return paths;
|
||||
|
Loading…
Reference in New Issue
Block a user