This commit is contained in:
2016-02-22 22:22:39 +01:00
parent d5407e33dd
commit 0bad43d726
69 changed files with 130228 additions and 4684 deletions

View File

@ -2,14 +2,14 @@
import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths");
export var run = function(configArg){
var done = plugins.q.defer();
var done = plugins.Q.defer();
var config = configArg;
plugins.beautylog.log("now running custom tasks");
var moduleStream = plugins.mergeStream({end: false});
var moduleStream = plugins.merge2({end: false});
/* -------------------------------------------------
* ----------- first install typings ---------------
* ----------------------------------------------- */
var typingsDone = plugins.q.defer();
var typingsDone = plugins.Q.defer();
var typingsCounter:number = 0;
var typingsCounterAdvance = function(){
typingsCounter++;

View File

@ -2,7 +2,7 @@
import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths");
export var run = function(){
var done = plugins.q.defer();
var done = plugins.Q.defer();
var config:any = {};
var configPath = plugins.path.join(paths.cwd,"npmts.json");
if(plugins.smartfile.checks.fileExistsSync(configPath)){

55
ts/npmts.jsdoc.ts Normal file
View File

@ -0,0 +1,55 @@
/// <reference path="./typings/main.d.ts" />
import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths");
var genJsdoc = function(){
var done = plugins.Q.defer();
plugins.beautylog.log("now generating " + "JsDoc documentation".blue);
plugins.gulp.src([
plugins.path.join(paths.cwd,"README.md"),
plugins.path.join(paths.distDir,"**/*.js")
])
.pipe(plugins.g.jsdoc3({
opts: {
destination: paths.docsDir
}
}, done.resolve));
return done.promise;
};
var publishDocs = function(){
var done = plugins.Q.defer();
var deployScript = "" +
"cd " + paths.docsDir + " " +
"&& git init " +
"&& git config user.name \"TRAVIS CI\" " +
"&& git config user.email \"travis@shipzone.io\" " +
"&& git add . " +
"&& git commit -m \"Deploy to GitHub Pages\" " +
"&& git push --force --quiet \"https://${GH_TOKEN}@${GH_REF}\" master:gh-pages > /dev/null 2>&1";
if(true || plugins.smartenv.getEnv().isTravis){
plugins.beautylog.log("now publishing docs to GitHub")
if (!plugins.shelljs.which('git')) {
plugins.beautylog.error('Git is not installed');
plugins.shelljs.exit(1);
} else if (plugins.shelljs.exec(deployScript).code !== 0) {
plugins.beautylog.error('Error: Git failed');
plugins.shelljs.exit(1);
}
done.resolve();
} else {
done.resolve();
}
return done.promise;
};
export var run = function(){
var done = plugins.Q.defer();
genJsdoc()
.then(publishDocs)
.then(done.resolve);
return done.promise;
};

View File

@ -1,7 +1,7 @@
/// <reference path="./typings/main.d.ts" />
import plugins = require("./npmts.plugins");
export var run = function(configArg){
var done = plugins.q.defer();
var done = plugins.Q.defer();
var config = configArg;
if (typeof config.coveralls === "undefined"){
config.coveralls = false;

View File

@ -2,8 +2,15 @@
import plugins = require("./npmts.plugins");
var paths:any = {};
paths.cwd = plugins.smartcli.get.cwd().path;
//Directories
paths.tsDir = plugins.path.join(paths.cwd,"ts/");
paths.distDir = plugins.path.join(paths.cwd,"dist/");
paths.docsDir = plugins.path.join(paths.cwd,"docs/");
paths.testDir = plugins.path.join(paths.cwd,"test/");
//Files
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/");
export = paths;

View File

@ -5,17 +5,22 @@ var plugins = {
gulp: require("gulp"),
g: {
coveralls: require("gulp-coveralls"),
gFunction: require("gulp-function"),
istanbul: require("gulp-istanbul"),
jsdoc3: require("gulp-jsdoc3"),
mocha: require("gulp-mocha"),
sourcemaps: require("gulp-sourcemaps"),
typescript: require("gulp-typescript")
},
mergeStream: require("merge2"),
merge2: require("merge2"),
projectinfo: require("projectinfo"),
sourceMapSupport:require("source-map-support").install(),
path: require("path"),
q:require("q"),
Q:require("q"),
shelljs: require("shelljs"),
smartcli: require("smartcli"),
smartenv: require("smartenv"),
smartfile: require("smartfile"),
typings: require("typings")
};

View File

@ -2,12 +2,14 @@
import NpmtsConfigFile = require("./npmts.configfile");
import NpmtsOptions = require("./npmts.options");
import NpmtsCompile = require("./npmts.compile");
import NpmtsJsdoc = require("./npmts.jsdoc");
import NpmtsTests = require("./npmts.tests");
export var run = function(){
var promisechain;
NpmtsConfigFile.run()
.then(NpmtsOptions.run)
.then(NpmtsCompile.run)
.then(NpmtsJsdoc.run)
.then(NpmtsTests.run);
return promisechain;
};

View File

@ -2,7 +2,7 @@
import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths");
export var run = function(configArg) {
var done = plugins.q.defer();
var done = plugins.Q.defer();
var config = configArg;
var istanbul = function () {
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"dist/*.js")])
@ -24,6 +24,7 @@ export var run = function(configArg) {
};
var coveralls = function(){
plugins.beautylog.log("now uploading coverage data to coveralls");
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"./coverage/lcov.info")])
.pipe(plugins.g.coveralls());
return stream;
@ -31,7 +32,7 @@ export var run = function(configArg) {
istanbul().on("finish",function(){
mocha().on("finish",function(){
if(process.env.TRAVIS && config.coveralls){
if(plugins.smartenv.getEnv().isTravis && config.coveralls){
coveralls().on("finish",function(){
done.resolve(config);
})

View File

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

View File

@ -1,125 +0,0 @@
// Compiled using typings@0.6.3
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/09e37435ffb2c56a6f908081194a74756f24f99d/colors/colors.d.ts
// 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,110 +0,0 @@
// Compiled using typings@0.6.3
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/78d36dd49b6b55b9fdfe61776a12bf05c8b07777/vinyl/vinyl.d.ts
// 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
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

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

View File

@ -1,125 +0,0 @@
// Compiled using typings@0.6.3
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/09e37435ffb2c56a6f908081194a74756f24f99d/colors/colors.d.ts
// 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,110 +0,0 @@
// Compiled using typings@0.6.3
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/78d36dd49b6b55b9fdfe61776a12bf05c8b07777/vinyl/vinyl.d.ts
// 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
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;
}