recompile
This commit is contained in:
parent
1723193d27
commit
fcd2616a3c
4
dist/npmts.compile.js
vendored
4
dist/npmts.compile.js
vendored
@ -1,7 +1,6 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var helpers = require("./npmts.compile.helpers");
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
var compileTs = function (tsFileArrayArg, tsOptionsArg) {
|
||||
@ -20,7 +19,8 @@ var compileTs = function (tsFileArrayArg, tsOptionsArg) {
|
||||
};
|
||||
for (var keyArg in tsFileArrayArg) {
|
||||
if (helpers.checkOutputPath(tsFileArrayArg, keyArg)) {
|
||||
var tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"]);
|
||||
var filesToConvert = plugins.smartfile.fs.listFileTree(plugins.path.resolve(keyArg), "**/*.ts");
|
||||
plugins.tsn.compile(filesToConvert, tsFileArrayArg[keyArg]);
|
||||
}
|
||||
}
|
||||
return done.promise;
|
||||
|
4
dist/npmts.plugins.d.ts
vendored
4
dist/npmts.plugins.d.ts
vendored
@ -7,9 +7,6 @@ export declare let g: {
|
||||
jsdoc3: any;
|
||||
mocha: any;
|
||||
replace: any;
|
||||
sourcemaps: any;
|
||||
typescript: any;
|
||||
typings: any;
|
||||
};
|
||||
export declare let lodashObject: any;
|
||||
export declare let merge2: any;
|
||||
@ -25,3 +22,4 @@ export import smartfile = require("smartfile");
|
||||
export import smartpath = require("smartpath");
|
||||
export import smartstring = require("smartstring");
|
||||
export declare let sourceMapSupport: any;
|
||||
export import tsn = require("tsn");
|
||||
|
6
dist/npmts.plugins.js
vendored
6
dist/npmts.plugins.js
vendored
@ -7,10 +7,7 @@ exports.g = {
|
||||
istanbul: require("gulp-istanbul"),
|
||||
jsdoc3: require("gulp-jsdoc3"),
|
||||
mocha: require("gulp-mocha"),
|
||||
replace: require("gulp-replace"),
|
||||
sourcemaps: require("gulp-sourcemaps"),
|
||||
typescript: require("gulp-typescript"),
|
||||
typings: require("gulp-typings")
|
||||
replace: require("gulp-replace")
|
||||
};
|
||||
exports.lodashObject = require('lodash/fp/object');
|
||||
exports.merge2 = require("merge2");
|
||||
@ -26,3 +23,4 @@ exports.smartfile = require("smartfile");
|
||||
exports.smartpath = require("smartpath");
|
||||
exports.smartstring = require("smartstring");
|
||||
exports.sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing
|
||||
exports.tsn = require("tsn");
|
||||
|
1
dist/test/assets/customdir/custom.d.ts
vendored
1
dist/test/assets/customdir/custom.d.ts
vendored
@ -1 +0,0 @@
|
||||
declare var hello: string;
|
1
dist/test/assets/customdir/custom.js
vendored
1
dist/test/assets/customdir/custom.js
vendored
@ -1 +0,0 @@
|
||||
var hello = "hello";
|
1
dist/test/assets/customdir/tsfile1.d.ts
vendored
1
dist/test/assets/customdir/tsfile1.d.ts
vendored
@ -1 +0,0 @@
|
||||
declare var something: string;
|
1
dist/test/assets/customdir/tsfile1.js
vendored
1
dist/test/assets/customdir/tsfile1.js
vendored
@ -1 +0,0 @@
|
||||
var something = "something";
|
1
dist/test/assets/test/test.d.ts
vendored
1
dist/test/assets/test/test.d.ts
vendored
@ -1 +0,0 @@
|
||||
declare var testplugin: any;
|
8
dist/test/assets/test/test.js
vendored
8
dist/test/assets/test/test.js
vendored
@ -1,8 +0,0 @@
|
||||
var testplugin = require("../dist/index.js");
|
||||
describe("testplugins", function () {
|
||||
describe(".logSomething", function () {
|
||||
it("should log something", function () {
|
||||
testplugin.logSomething();
|
||||
});
|
||||
});
|
||||
});
|
4
dist/test/assets/ts/index.d.ts
vendored
4
dist/test/assets/ts/index.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
declare let testplugin: {
|
||||
logSomething: () => void;
|
||||
};
|
||||
export = testplugin;
|
7
dist/test/assets/ts/index.js
vendored
7
dist/test/assets/ts/index.js
vendored
@ -1,7 +0,0 @@
|
||||
"use strict";
|
||||
var testplugin = {
|
||||
logSomething: function () {
|
||||
console.log("only function executed");
|
||||
}
|
||||
};
|
||||
module.exports = testplugin;
|
1
dist/ts/index.d.ts
vendored
1
dist/ts/index.d.ts
vendored
@ -1 +0,0 @@
|
||||
import "typings-global";
|
28
dist/ts/index.js
vendored
28
dist/ts/index.js
vendored
@ -1,28 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
/* ================================================== *
|
||||
Starting NPMTS main process.
|
||||
* ================================================== */
|
||||
var early = require("early");
|
||||
early.start("NPMTS");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
early.stop()
|
||||
.then(function () {
|
||||
var npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot);
|
||||
var npmtsCli = new plugins.smartcli.Smartcli();
|
||||
npmtsCli.standardTask()
|
||||
.then(function (argvArg) {
|
||||
plugins.beautylog.figletSync("NPMTS");
|
||||
plugins.beautylog.info("npmts version: " + npmtsProjectInfo.version);
|
||||
try {
|
||||
npmts_promisechain_1.promisechain(argvArg);
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
npmtsCli.addVersion(npmtsProjectInfo.version);
|
||||
npmtsCli.startParse();
|
||||
});
|
4
dist/ts/npmts.assets.d.ts
vendored
4
dist/ts/npmts.assets.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
/// <reference types="q" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
export declare var run: (configArg: any) => plugins.Q.Promise<{}>;
|
19
dist/ts/npmts.assets.js
vendored
19
dist/ts/npmts.assets.js
vendored
@ -1,19 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
npmts_promisechain_1.npmtsOra.text("now looking at " + "required assets".yellow);
|
||||
if (config.cli == true) {
|
||||
plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir, "cli.js"), paths.distDir);
|
||||
plugins.beautylog.ok("installed CLI assets!");
|
||||
done.resolve(config);
|
||||
}
|
||||
else {
|
||||
done.resolve(config);
|
||||
}
|
||||
return done.promise;
|
||||
};
|
4
dist/ts/npmts.clean.d.ts
vendored
4
dist/ts/npmts.clean.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
/// <reference types="q" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
export declare let run: (configArg: any) => plugins.Q.Promise<{}>;
|
30
dist/ts/npmts.clean.js
vendored
30
dist/ts/npmts.clean.js
vendored
@ -1,30 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
var removeDist = function () {
|
||||
npmts_promisechain_1.npmtsOra.text("cleaning " + "dist".yellow + " folder");
|
||||
return plugins.smartfile.fsaction.remove(paths.distDir);
|
||||
};
|
||||
var removeTypings = function () {
|
||||
var done = plugins.Q.defer();
|
||||
npmts_promisechain_1.npmtsOra.text("cleaning " + "typings".yellow + " folder");
|
||||
if (false) {
|
||||
}
|
||||
else {
|
||||
done.resolve();
|
||||
}
|
||||
return done.promise;
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
npmts_promisechain_1.npmtsOra.text("cleaning up from previous builds...");
|
||||
var done = plugins.Q.defer();
|
||||
removeDist()
|
||||
.then(removeTypings)
|
||||
.then(function () {
|
||||
plugins.beautylog.ok("Cleaned up from previous builds!");
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
1
dist/ts/npmts.cli.d.ts
vendored
1
dist/ts/npmts.cli.d.ts
vendored
@ -1 +0,0 @@
|
||||
import "typings-global";
|
2
dist/ts/npmts.cli.js
vendored
2
dist/ts/npmts.cli.js
vendored
@ -1,2 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
4
dist/ts/npmts.compile.d.ts
vendored
4
dist/ts/npmts.compile.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
/// <reference types="q" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
export declare let run: (configArg: any) => plugins.Q.Promise<{}>;
|
1
dist/ts/npmts.compile.helpers.d.ts
vendored
1
dist/ts/npmts.compile.helpers.d.ts
vendored
@ -1 +0,0 @@
|
||||
export declare let checkOutputPath: (tsArrayArg: any, keyArg: any) => boolean;
|
16
dist/ts/npmts.compile.helpers.js
vendored
16
dist/ts/npmts.compile.helpers.js
vendored
@ -1,16 +0,0 @@
|
||||
"use strict";
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var outputPathIsDir = function (tsArrayArg, keyArg) {
|
||||
return plugins.smartpath.check.isDir(plugins.path.join(paths.cwd, tsArrayArg[keyArg]));
|
||||
};
|
||||
exports.checkOutputPath = function (tsArrayArg, keyArg) {
|
||||
if (!outputPathIsDir(tsArrayArg, keyArg)) {
|
||||
plugins.beautylog.warn("Skipping " + keyArg + " because " + tsArrayArg[keyArg] + " it is no directory!");
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
;
|
||||
};
|
41
dist/ts/npmts.compile.js
vendored
41
dist/ts/npmts.compile.js
vendored
@ -1,41 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var helpers = require("./npmts.compile.helpers");
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
var compileTs = function (tsFileArrayArg, tsOptionsArg) {
|
||||
if (tsOptionsArg === void 0) { tsOptionsArg = {}; }
|
||||
var done = plugins.Q.defer();
|
||||
var tsOptionsDefault = {
|
||||
declaration: true,
|
||||
target: "ES5",
|
||||
module: "commonjs"
|
||||
};
|
||||
/**
|
||||
* merges default ts options with those found in npmts.json
|
||||
*/
|
||||
var tsOptions = function (keyArg) {
|
||||
return plugins.lodashObject.assign(tsOptionsDefault, tsOptionsArg);
|
||||
};
|
||||
for (var keyArg in tsFileArrayArg) {
|
||||
if (helpers.checkOutputPath(tsFileArrayArg, keyArg)) {
|
||||
var tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"]);
|
||||
}
|
||||
}
|
||||
return done.promise;
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
npmts_promisechain_1.npmtsOra.text("now compiling " + "TypeScript".yellow);
|
||||
compileTs(config.ts, config.tsOptions)
|
||||
.then(function () {
|
||||
compileTs(config.testTs);
|
||||
})
|
||||
.then(function () {
|
||||
plugins.beautylog.ok("compiled TypeScript!");
|
||||
done.resolve(config);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
4
dist/ts/npmts.configfile.d.ts
vendored
4
dist/ts/npmts.configfile.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
/// <reference types="q" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
export declare var run: (argvArg: any) => plugins.Q.Promise<{}>;
|
34
dist/ts/npmts.configfile.js
vendored
34
dist/ts/npmts.configfile.js
vendored
@ -1,34 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
exports.run = function (argvArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = {};
|
||||
var configPath = plugins.path.join(paths.cwd, "npmts.json");
|
||||
if (argvArg.notest) {
|
||||
config.notest = true;
|
||||
}
|
||||
if (plugins.smartfile.checks.fileExistsSync(configPath)) {
|
||||
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
||||
config = plugins.lodashObject.assign(config, plugins.smartfile.local.toObjectSync(configPath));
|
||||
switch (config.mode) {
|
||||
case "default":
|
||||
case "custom":
|
||||
plugins.beautylog.ok("mode is " + config.mode.yellow);
|
||||
done.resolve(config);
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
|
||||
process.exit(1);
|
||||
}
|
||||
;
|
||||
}
|
||||
else {
|
||||
plugins.beautylog.log("no config file found: so mode is " + "default".yellow);
|
||||
config.mode = "default";
|
||||
done.resolve(config);
|
||||
}
|
||||
;
|
||||
return done.promise;
|
||||
};
|
4
dist/ts/npmts.jsdoc.d.ts
vendored
4
dist/ts/npmts.jsdoc.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
/// <reference types="q" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
export declare let run: (configArg: any) => plugins.Q.Promise<{}>;
|
28
dist/ts/npmts.jsdoc.js
vendored
28
dist/ts/npmts.jsdoc.js
vendored
@ -1,28 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
var genJsdoc = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
npmts_promisechain_1.npmtsOra.text("now generating " + "JsDoc documentation".yellow);
|
||||
plugins.gulp.src([
|
||||
plugins.path.join(paths.cwd, "README.md"),
|
||||
plugins.path.join(paths.distDir, "**/*.js")
|
||||
])
|
||||
.pipe(plugins.g.jsdoc3({
|
||||
opts: {
|
||||
destination: paths.docsDir
|
||||
}
|
||||
}, function () {
|
||||
plugins.beautylog.ok("JsDoc documentation has been generated!");
|
||||
done.resolve(configArg);
|
||||
}));
|
||||
return done.promise;
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
genJsdoc(configArg)
|
||||
.then(done.resolve);
|
||||
return done.promise;
|
||||
};
|
5
dist/ts/npmts.options.d.ts
vendored
5
dist/ts/npmts.options.d.ts
vendored
@ -1,5 +0,0 @@
|
||||
/// <reference types="q" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
export declare let isCi: () => any;
|
||||
export declare var run: (configArg: any) => plugins.Q.Promise<{}>;
|
36
dist/ts/npmts.options.js
vendored
36
dist/ts/npmts.options.js
vendored
@ -1,36 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
exports.isCi = function () {
|
||||
return plugins.smartci.check.isCi();
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
npmts_promisechain_1.npmtsOra.text("now determining build options...");
|
||||
//handle default mode
|
||||
if (config.mode == "default") {
|
||||
config.typings = [
|
||||
"./ts/typings.json"
|
||||
];
|
||||
config.ts = (_a = {},
|
||||
_a["./ts/**/*.ts"] = "./dist/",
|
||||
_a
|
||||
);
|
||||
config.testTs = (_b = {},
|
||||
_b["./test/test.ts"] = "./test/",
|
||||
_b
|
||||
);
|
||||
config.test = ["./index.js"];
|
||||
}
|
||||
//check if config.tsOptions is available
|
||||
config.tsOptions ? void (0) : config.tsOptions = {};
|
||||
config.coverageTreshold ? void (0) : config.coverageTreshold = 70;
|
||||
// handle docs
|
||||
config.docs ? void (0) : config.docs = {};
|
||||
plugins.beautylog.ok("build options are ready!");
|
||||
done.resolve(config);
|
||||
return done.promise;
|
||||
var _a, _b;
|
||||
};
|
12
dist/ts/npmts.paths.d.ts
vendored
12
dist/ts/npmts.paths.d.ts
vendored
@ -1,12 +0,0 @@
|
||||
import "typings-global";
|
||||
export declare let npmtsPackageRoot: string;
|
||||
export declare let cwd: string;
|
||||
export declare let tsDir: string;
|
||||
export declare let distDir: string;
|
||||
export declare let docsDir: string;
|
||||
export declare let testDir: string;
|
||||
export declare let typingsDir: string;
|
||||
export declare let coverageDir: string;
|
||||
export declare let npmtsAssetsDir: string;
|
||||
export declare let indexTS: string;
|
||||
export declare let testTS: string;
|
18
dist/ts/npmts.paths.js
vendored
18
dist/ts/npmts.paths.js
vendored
@ -1,18 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
//Npmts Paths
|
||||
exports.npmtsPackageRoot = plugins.path.join(__dirname, "../");
|
||||
//Project paths
|
||||
exports.cwd = process.cwd();
|
||||
//Directories
|
||||
exports.tsDir = plugins.path.join(exports.cwd, "ts/");
|
||||
exports.distDir = plugins.path.join(exports.cwd, "dist/");
|
||||
exports.docsDir = plugins.path.join(exports.cwd, "docs/");
|
||||
exports.testDir = plugins.path.join(exports.cwd, "test/");
|
||||
exports.typingsDir = plugins.path.join(exports.cwd, "ts/typings/");
|
||||
exports.coverageDir = plugins.path.join(exports.cwd, "coverage/");
|
||||
exports.npmtsAssetsDir = plugins.path.join(__dirname, "../assets/");
|
||||
//Files
|
||||
exports.indexTS = plugins.path.join(exports.cwd, "ts/index.ts");
|
||||
exports.testTS = plugins.path.join(exports.cwd, "ts/test.ts");
|
28
dist/ts/npmts.plugins.d.ts
vendored
28
dist/ts/npmts.plugins.d.ts
vendored
@ -1,28 +0,0 @@
|
||||
import "typings-global";
|
||||
export import beautylog = require("beautylog");
|
||||
export import fs = require("fs-extra");
|
||||
export declare let gulp: any;
|
||||
export declare let g: {
|
||||
gFunction: any;
|
||||
istanbul: any;
|
||||
jsdoc3: any;
|
||||
mocha: any;
|
||||
replace: any;
|
||||
sourcemaps: any;
|
||||
typescript: any;
|
||||
typings: any;
|
||||
};
|
||||
export declare let lodashObject: any;
|
||||
export declare let merge2: any;
|
||||
export import projectinfo = require("projectinfo");
|
||||
export import path = require("path");
|
||||
export import Q = require("q");
|
||||
export import shelljs = require("shelljs");
|
||||
export import smartci = require("smartci");
|
||||
export import smartcli = require("smartcli");
|
||||
export import smartcov = require("smartcov");
|
||||
export import smartenv = require("smartenv");
|
||||
export import smartfile = require("smartfile");
|
||||
export import smartpath = require("smartpath");
|
||||
export import smartstring = require("smartstring");
|
||||
export declare let sourceMapSupport: any;
|
29
dist/ts/npmts.plugins.js
vendored
29
dist/ts/npmts.plugins.js
vendored
@ -1,29 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
exports.beautylog = require("beautylog");
|
||||
exports.fs = require("fs-extra");
|
||||
exports.gulp = require("gulp");
|
||||
exports.g = {
|
||||
gFunction: require("gulp-function"),
|
||||
istanbul: require("gulp-istanbul"),
|
||||
jsdoc3: require("gulp-jsdoc3"),
|
||||
mocha: require("gulp-mocha"),
|
||||
replace: require("gulp-replace"),
|
||||
sourcemaps: require("gulp-sourcemaps"),
|
||||
typescript: require("gulp-typescript"),
|
||||
typings: require("gulp-typings")
|
||||
};
|
||||
exports.lodashObject = require('lodash/fp/object');
|
||||
exports.merge2 = require("merge2");
|
||||
exports.projectinfo = require("projectinfo");
|
||||
exports.path = require("path");
|
||||
exports.Q = require("q");
|
||||
exports.shelljs = require("shelljs");
|
||||
exports.smartci = require("smartci");
|
||||
exports.smartcli = require("smartcli");
|
||||
exports.smartcov = require("smartcov");
|
||||
exports.smartenv = require("smartenv");
|
||||
exports.smartfile = require("smartfile");
|
||||
exports.smartpath = require("smartpath");
|
||||
exports.smartstring = require("smartstring");
|
||||
exports.sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing
|
47
dist/ts/npmts.promisechain.js
vendored
47
dist/ts/npmts.promisechain.js
vendored
@ -1,47 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
exports.npmtsOra = new plugins.beautylog.Ora("setting up TaskChain", "cyan");
|
||||
var NpmtsAssets = require("./npmts.assets");
|
||||
var NpmtsClean = require("./npmts.clean");
|
||||
var NpmtsCompile = require("./npmts.compile");
|
||||
var NpmtsConfigFile = require("./npmts.configfile");
|
||||
var NpmtsJsdoc = require("./npmts.jsdoc");
|
||||
var NpmtsOptions = require("./npmts.options");
|
||||
var NpmtsTests = require("./npmts.tests");
|
||||
exports.promisechain = function (argvArg) {
|
||||
var done = plugins.Q.defer();
|
||||
exports.npmtsOra.start();
|
||||
NpmtsConfigFile.run(argvArg)
|
||||
.then(NpmtsOptions.run)
|
||||
.then(NpmtsClean.run)
|
||||
.then(NpmtsCompile.run)
|
||||
.then(NpmtsAssets.run)
|
||||
.then(NpmtsJsdoc.run)
|
||||
.then(NpmtsTests.run)
|
||||
.then(function (configArg) {
|
||||
var shipString = "" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" # # ( )\n" +
|
||||
" ___#_#___|__\n" +
|
||||
" _ |____________| _\n" +
|
||||
" _=====| | | | | |==== _\n" +
|
||||
" =====| |.---------------------------. | |====\n" +
|
||||
" <--------------------' . . . . . . . . '--------------/\n" +
|
||||
" \\ /\n" +
|
||||
" \\___________________________________________________________/\n" +
|
||||
" wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" +
|
||||
" wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" +
|
||||
" wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n";
|
||||
if (process.env.CI) {
|
||||
console.log(shipString);
|
||||
plugins.beautylog.success("READY TO SHIP!");
|
||||
}
|
||||
else {
|
||||
plugins.beautylog.success("Done!");
|
||||
}
|
||||
done.resolve();
|
||||
});
|
||||
return done.promise;
|
||||
};
|
4
dist/ts/npmts.tests.d.ts
vendored
4
dist/ts/npmts.tests.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
/// <reference types="q" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
export declare let run: (configArg: any) => plugins.Q.Promise<{}>;
|
76
dist/ts/npmts.tests.js
vendored
76
dist/ts/npmts.tests.js
vendored
@ -1,76 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
/**
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
var istanbul = function (configArg) {
|
||||
npmts_promisechain_1.npmtsOra.text("Instrumentalizing transpiled JS...");
|
||||
var done = plugins.Q.defer();
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "dist/*.js")])
|
||||
.pipe(plugins.g.istanbul()) // Covering files
|
||||
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
|
||||
.pipe(plugins.g.gFunction(function () {
|
||||
plugins.beautylog.ok("JS has been instrumentalized to get test code coverage!");
|
||||
done.resolve(configArg);
|
||||
}, "atEnd"));
|
||||
return done.promise;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
var mocha = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
npmts_promisechain_1.npmtsOra.end(); // end npmtsOra for tests.
|
||||
var stream = plugins.gulp.src(["./test/test.js"])
|
||||
.pipe(plugins.g.mocha())
|
||||
.pipe(plugins.g.istanbul.writeReports()) // Creating the reports after tests ran
|
||||
.pipe(plugins.g.gFunction(function () {
|
||||
plugins.beautylog.ok("Tests have passed!");
|
||||
done.resolve(configArg);
|
||||
}, "atEnd"));
|
||||
return done.promise;
|
||||
};
|
||||
var coverage = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
plugins.smartcov.get.percentage(plugins.path.join(paths.coverageDir, "lcov.info"))
|
||||
.then(function (percentageArg) {
|
||||
if (percentageArg >= configArg.coverageTreshold) {
|
||||
plugins.beautylog.ok("your coverage of " + percentageArg.toString().blue + "% ".blue + "exceeds your treshold of " +
|
||||
configArg.coverageTreshold.toString().blue + "%".blue);
|
||||
}
|
||||
else {
|
||||
plugins.beautylog.warn("your coverage of " + percentageArg + "% " + "fails your treshold of " +
|
||||
configArg.coverageTreshold + "%");
|
||||
plugins.beautylog.error("exiting due to coverage failure");
|
||||
process.exit(1);
|
||||
}
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
if (config.notest != true) {
|
||||
npmts_promisechain_1.npmtsOra.text("now starting tests");
|
||||
plugins.beautylog.log("-------------------------------------------------------\n" +
|
||||
"*************************** TESTS: ***************************\n" +
|
||||
"--------------------------------------------------------------");
|
||||
istanbul(config)
|
||||
.then(mocha)
|
||||
.then(coverage)
|
||||
.then(function () {
|
||||
done.resolve(config);
|
||||
});
|
||||
}
|
||||
else {
|
||||
npmts_promisechain_1.npmtsOra.end();
|
||||
done.resolve(config);
|
||||
}
|
||||
return done.promise;
|
||||
};
|
Loading…
Reference in New Issue
Block a user