Compare commits

...

32 Commits

Author SHA1 Message Date
d8fb9747cd 5.0.1 2016-04-05 00:31:25 +02:00
53209b18a9 update des 2016-04-05 00:31:17 +02:00
3e3561f4bb 5.0.0 2016-04-04 23:19:50 +02:00
099b513e0a update deps 2016-04-04 23:19:34 +02:00
cf15c428c1 4.0.3 2016-04-04 22:58:08 +02:00
3bd876a201 update deps 2016-04-04 22:57:50 +02:00
af62f20614 4.0.2 2016-04-04 16:57:13 +02:00
69eba08b27 updated log message 2016-04-04 16:57:09 +02:00
6635265f4b added codecov badge 2016-04-02 19:36:46 +02:00
ebdda5f969 4.0.1 2016-04-02 19:22:17 +02:00
f3a24154b4 now publishing coverage every time on travis since codecov does a good job sorting anything unwanted out 2016-04-02 19:22:01 +02:00
2980b6b5f3 4.0.0 2016-04-02 19:09:41 +02:00
570046ff67 switched from coveralls to codecov 2016-04-02 19:09:11 +02:00
112ce2d0d6 add author note 2016-04-02 01:25:01 +02:00
791eaefe3c better log messages 2016-04-02 01:20:52 +02:00
a3af90844a 3.6.10 2016-03-30 15:26:57 +02:00
e389f78256 more cosmetics 2016-03-30 15:26:53 +02:00
9e8fc76623 better wording 2016-03-30 01:35:20 +02:00
bf20ad9e61 3.6.9 2016-03-30 01:32:45 +02:00
58043d0fa2 now has better coverage failure 2016-03-30 01:32:41 +02:00
5b0814520a 3.6.8 2016-03-27 12:34:56 +02:00
848d40eeac update readme 2016-03-27 12:32:55 +02:00
73f5a0b055 3.6.7 2016-03-26 18:06:38 +01:00
f2a169ac7d added better Test log identifier 2016-03-26 18:06:29 +01:00
3cdd22044e 3.6.6 2016-03-26 17:36:00 +01:00
60d200135e fix small promise error 2016-03-26 17:35:55 +01:00
e8238dc907 3.6.5 2016-03-26 17:26:48 +01:00
007e7539c8 removed redundant if 2016-03-26 17:25:45 +01:00
e3c2c56548 3.6.4 2016-03-26 14:08:56 +01:00
f0954b19e0 improved execution order 2016-03-26 14:08:48 +01:00
48a9d19b8e 3.6.3 2016-03-23 15:55:12 +01:00
7d39683972 fix doPublish function 2016-03-23 15:55:07 +01:00
29 changed files with 306 additions and 175 deletions

View File

@ -1 +0,0 @@
# README-dev

View File

@ -6,9 +6,10 @@ Write npm modules with TypeScript without hassle.
[![Dependency Status](https://david-dm.org/pushrocks/npmts.svg)](https://david-dm.org/pushrocks/npmts) [![Dependency Status](https://david-dm.org/pushrocks/npmts.svg)](https://david-dm.org/pushrocks/npmts)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/npmts/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/npmts/master/dependencies/npm) [![bitHound Dependencies](https://www.bithound.io/github/pushrocks/npmts/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/npmts/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/npmts/badges/code.svg)](https://www.bithound.io/github/pushrocks/npmts) [![bitHound Code](https://www.bithound.io/github/pushrocks/npmts/badges/code.svg)](https://www.bithound.io/github/pushrocks/npmts)
[![Coverage Status](https://coveralls.io/repos/github/pushrocks/npmts/badge.svg?branch=master)](https://coveralls.io/github/pushrocks/npmts?branch=master) [![codecov.io](https://codecov.io/github/pushrocks/npmts/coverage.svg?branch=master)](https://codecov.io/github/pushrocks/npmts?branch=master)
## How to use npmts ## What is NPMTS?
NPMTS is your friend when it comes to write, test, publish and document NPM modules written in TypeScript.
### Install ### Install
First install npmts as dev dependency: First install npmts as dev dependency:
@ -29,18 +30,24 @@ Then use it in package.json's script section to trigger a build:
**Execution order of tasks** **Execution order of tasks**
1. Check config in ./npmts.json
1. Clean up from any previous builds (old js files)
1. Install typings 1. Install typings
2. Transpile TypeScript with inline sourcemaps 1. Transpile TypeScript with inline sourcemaps
3. Create Declaration Files 1. Create Declaration Files
4. Instrumentalize created JavaScript files with istanbul 1. Create JsDoc Documentation
5. Run Tests 1. Instrumentalize created JavaScript files with istanbul
6. Create Coverage report 1. Run Tests
7. Upload Coverage reports to travis (must be activated, only triggers on travis) 1. Create Coverage report
1. Upload Coverage reports to codecov.io (Tests must pass, codecov.io must be activated, by default only triggers on travis)
1. Upload JsDoc Documentation to gh-pages branch on GitHub. (Tests must pass, requires GitHub Token)
#### npmts.json
the npmts.json is the main config file. You can use it to customize the behaviour of NPMTS.
#### Typings #### Typings
**npmts** looks for `./ts/typings.json` by default and installs any defined typings to `.ts/typings/`. **npmts** looks for `./ts/typings.json` by default and installs any defined typings to `.ts/typings/`.
You can then reference the ./ts/typings/main.d.ts file in your TypeScript code. You can then reference the ./ts/typings/main.d.ts file in any of your TypeScript code.
#### TypeScript #### TypeScript
by default npmts looks for `./ts/*.ts` and `./test/test.ts` that will compile to by default npmts looks for `./ts/*.ts` and `./test/test.ts` that will compile to
@ -57,22 +64,22 @@ You can reference it in your package.json like this:
"typings": "./index.d.ts", "typings": "./index.d.ts",
``` ```
You can then import plugins via the TypeScript `import` Syntax
and tsc will pick up the declaration file automatically.
#### Instrumentalize Code #### Instrumentalize Code
npmts instrumentalizes the created JavaScript code to create a coverage report. npmts instrumentalizes (using istanbul) the created JavaScript code to create a coverage report.
#### Tests #### Tests
When Typings have been installed, TypeScript + Declaration files have been transpiled and the resulting JS has been instrumentalized, When Typings have been installed, TypeScript + Declaration files have been transpiled and the resulting JS has been instrumentalized,
npmts runs `.test/test.js` with mocha. npmts looks for `.test/test.ts` which will be transpiled to test.js and run with mocha.
Any errors will be shown with reference to their originating source in TypeScript.
When requiring the module from other TypeScript files,
the TypeScript Compiler will use the declaration file to resolve typings.
Any errors will be shown with reference to their originating source in TypeScript
thanks to autogenerated source maps.
### Custom behaviour ### Custom behaviour
Custom behaviour can be achieved through a config file at the root of your package. Custom behaviour can be achieved through the npmts.json config file at the root of your package.
The file must be named **npmts.json** The file must be named **npmts.json**
```json ```json
@ -91,7 +98,9 @@ The file must be named **npmts.json**
* **ts** You can list as many TypeScript files as you like. The key represents the source TypeScript file, the value the output file. * **ts** You can list as many TypeScript files as you like. The key represents the source TypeScript file, the value the output file.
* **typings** is an array of all direcories that have a typings.json present. Uses the new typings tool from npm. * **typings** is an array of all direcories that have a typings.json present. Uses the new typings tool from npm.
> We will add more options over time.
## Readme for Devs ### About the authors:
There is a [README-dev.md](README-dev.md) in the repo. [![Project Phase](https://mediaserve.lossless.digital/lossless.com/img/createdby_github.svg)](https://lossless.com/)
This is only of interest for you when looking to contribute to, improve or build upon this package.
[![PayPal](https://img.shields.io/badge/Support%20us-PayPal-blue.svg)](https://paypal.me/lossless)

3
dist/npmts.clean.js vendored
View File

@ -3,10 +3,11 @@
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
var paths = require("./npmts.paths"); var paths = require("./npmts.paths");
exports.run = function (configArg) { exports.run = function (configArg) {
plugins.beautylog.log("now cleaning up from previous builds"); plugins.beautylog.log("now cleaning up from previous builds...");
var done = plugins.Q.defer(); var done = plugins.Q.defer();
plugins.smartfile.fsaction.remove(paths.distDir) plugins.smartfile.fsaction.remove(paths.distDir)
.then(function () { .then(function () {
plugins.beautylog.ok("Cleaned up!");
done.resolve(configArg); done.resolve(configArg);
}); });
return done.promise; return done.promise;

View File

@ -12,7 +12,7 @@ exports.run = function () {
switch (config.mode) { switch (config.mode) {
case "default": case "default":
case "custom": case "custom":
plugins.beautylog.log("mode is " + config.mode.yellow); plugins.beautylog.ok("mode is " + config.mode.yellow);
done.resolve(config); done.resolve(config);
break; break;
default: default:

8
dist/npmts.jsdoc.js vendored
View File

@ -19,7 +19,7 @@ var genJsdoc = function (configArg) {
})); }));
return done.promise; return done.promise;
}; };
var publishDocs = function (configArg) { exports.publishDocs = function (configArg) {
var done = plugins.Q.defer(); var done = plugins.Q.defer();
var gitUrl = plugins.projectinfo.npm(paths.cwd, { var gitUrl = plugins.projectinfo.npm(paths.cwd, {
gitAccessToken: process.env.GITHUB_TOKEN gitAccessToken: process.env.GITHUB_TOKEN
@ -34,7 +34,6 @@ var publishDocs = function (configArg) {
+ "&& git push --force --quiet " + "&& git push --force --quiet "
+ "\"" + gitUrl + "\" " + "\"" + gitUrl + "\" "
+ "master:gh-pages " + "> /dev/null 2>&1"; + "master:gh-pages " + "> /dev/null 2>&1";
if (configArg.docs.publish) {
plugins.beautylog.log("now publishing JsDoc documentation to GitHub"); plugins.beautylog.log("now publishing JsDoc documentation to GitHub");
if (!plugins.shelljs.which('git')) { if (!plugins.shelljs.which('git')) {
plugins.beautylog.error('Git is not installed!'); plugins.beautylog.error('Git is not installed!');
@ -46,16 +45,11 @@ var publishDocs = function (configArg) {
} }
plugins.beautylog.ok("JsDoc documentation has been deployed to GitHub!"); plugins.beautylog.ok("JsDoc documentation has been deployed to GitHub!");
done.resolve(configArg); done.resolve(configArg);
}
else {
done.resolve(configArg);
}
return done.promise; return done.promise;
}; };
exports.run = function (configArg) { exports.run = function (configArg) {
var done = plugins.Q.defer(); var done = plugins.Q.defer();
genJsdoc(configArg) genJsdoc(configArg)
.then(publishDocs)
.then(done.resolve); .then(done.resolve);
return done.promise; return done.promise;
}; };

17
dist/npmts.options.js vendored
View File

@ -1,18 +1,21 @@
"use strict"; "use strict";
/// <reference path="./typings/main.d.ts" /> /// <reference path="./typings/main.d.ts" />
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
exports.isCi = function () {
return plugins.smartci.check.isCi();
};
exports.isRelease = function () { exports.isRelease = function () {
return plugins.smartci.check.isCi() return plugins.smartci.check.isCi()
&& plugins.smartci.check.isTaggedCommit(); && plugins.smartci.check.isTaggedCommit();
}; };
exports.doPublish = function () { exports.doPublish = function () {
return exports.isRelease() return exports.isRelease()
&& plugins.smartci.get.subJobNumber() != 1; && plugins.smartci.get.subJobNumber() == 1;
}; };
exports.run = function (configArg) { exports.run = function (configArg) {
var done = plugins.Q.defer(); var done = plugins.Q.defer();
var config = configArg; var config = configArg;
plugins.beautylog.log("now determining build options"); plugins.beautylog.log("now determining build options...");
//handle default mode //handle default mode
if (config.mode == "default") { if (config.mode == "default") {
config.typings = [ config.typings = [
@ -27,14 +30,18 @@ exports.run = function (configArg) {
} }
// handle state of current build // handle state of current build
exports.isRelease() ? plugins.beautylog.info("All right: This is a RELEASE build!") exports.isRelease() ? plugins.beautylog.info("All right: This is a RELEASE build!")
: plugins.beautylog.info("NOT A RELEASE build! We are not publishing anything!"); : plugins.beautylog.info("NOT A RELEASE build!");
exports.isRelease() && exports.doPublish() ? plugins.beautylog.info("All right: This is the first subBuild, so this one publishes COVERAGE + DOCS when tests succeed!")
: plugins.beautylog.info("We are not publishing anything!");
// handle coveralls // handle coveralls
config.coveralls ? void (0) : config.coveralls = false; config.codecov ? void (0) : config.codecov = true;
exports.doPublish() ? void (0) : config.coveralls = false; exports.isCi() ? void (0) : config.codecov = false;
config.coverageTreshold ? void (0) : config.coverageTreshold = 70;
// handle docs // handle docs
config.docs ? void (0) : config.docs = {}; config.docs ? void (0) : config.docs = {};
config.docs.publish ? void (0) : config.docs.publish = false; config.docs.publish ? void (0) : config.docs.publish = false;
exports.doPublish() ? void (0) : config.docs.publish = false; exports.doPublish() ? void (0) : config.docs.publish = false;
plugins.beautylog.ok("build options are ready!");
done.resolve(config); done.resolve(config);
return done.promise; return done.promise;
var _a; var _a;

1
dist/npmts.paths.js vendored
View File

@ -8,6 +8,7 @@ paths.tsDir = plugins.path.join(paths.cwd, "ts/");
paths.distDir = plugins.path.join(paths.cwd, "dist/"); paths.distDir = plugins.path.join(paths.cwd, "dist/");
paths.docsDir = plugins.path.join(paths.cwd, "docs/"); paths.docsDir = plugins.path.join(paths.cwd, "docs/");
paths.testDir = plugins.path.join(paths.cwd, "test/"); paths.testDir = plugins.path.join(paths.cwd, "test/");
paths.coverageDir = plugins.path.join(paths.cwd, "coverage/");
paths.npmtsAssetsDir = plugins.path.join(__dirname, "../assets/"); paths.npmtsAssetsDir = plugins.path.join(__dirname, "../assets/");
//Files //Files
paths.indexTS = plugins.path.join(paths.cwd, "ts/index.ts"); paths.indexTS = plugins.path.join(paths.cwd, "ts/index.ts");

View File

@ -4,7 +4,7 @@ exports.beautylog = require("beautylog");
exports.fs = require("fs-extra"); exports.fs = require("fs-extra");
exports.gulp = require("gulp"); exports.gulp = require("gulp");
exports.g = { exports.g = {
coveralls: require("gulp-coveralls"), codecov: require("gulp-codecov"),
gFunction: require("gulp-function"), gFunction: require("gulp-function"),
istanbul: require("gulp-istanbul"), istanbul: require("gulp-istanbul"),
jsdoc3: require("gulp-jsdoc3"), jsdoc3: require("gulp-jsdoc3"),
@ -15,12 +15,13 @@ exports.g = {
}; };
exports.merge2 = require("merge2"); exports.merge2 = require("merge2");
exports.projectinfo = require("projectinfo"); exports.projectinfo = require("projectinfo");
exports.sourceMapSupport = require("source-map-support").install();
exports.path = require("path"); exports.path = require("path");
exports.Q = require("q"); exports.Q = require("q");
exports.shelljs = require("shelljs"); exports.shelljs = require("shelljs");
exports.smartci = require("smartci"); exports.smartci = require("smartci");
exports.smartcli = require("smartcli"); exports.smartcli = require("smartcli");
exports.smartcov = require("smartcov");
exports.smartenv = require("smartenv"); exports.smartenv = require("smartenv");
exports.smartfile = require("smartfile"); exports.smartfile = require("smartfile");
exports.smartpath = require("smartpath"); exports.smartpath = require("smartpath");
exports.sourceMapSupport = require("source-map-support").install();

View File

@ -8,6 +8,7 @@ var NpmtsConfigFile = require("./npmts.configfile");
var NpmtsInstall = require("./npmts.install"); var NpmtsInstall = require("./npmts.install");
var NpmtsJsdoc = require("./npmts.jsdoc"); var NpmtsJsdoc = require("./npmts.jsdoc");
var NpmtsOptions = require("./npmts.options"); var NpmtsOptions = require("./npmts.options");
var NpmtsPublish = require("./npmts.publish");
var NpmtsTests = require("./npmts.tests"); var NpmtsTests = require("./npmts.tests");
exports.run = function () { exports.run = function () {
var promisechain; var promisechain;
@ -19,6 +20,7 @@ exports.run = function () {
.then(NpmtsAssets.run) .then(NpmtsAssets.run)
.then(NpmtsJsdoc.run) .then(NpmtsJsdoc.run)
.then(NpmtsTests.run) .then(NpmtsTests.run)
.then(NpmtsPublish.run)
.then(function (configArg) { .then(function (configArg) {
var shipString = "" + var shipString = "" +
"\n" + "\n" +
@ -38,6 +40,9 @@ exports.run = function () {
console.log(shipString); console.log(shipString);
plugins.beautylog.success("READY TO SHIP!"); plugins.beautylog.success("READY TO SHIP!");
} }
else {
plugins.beautylog.success("Done!");
}
}); });
return promisechain; return promisechain;
}; };

15
dist/npmts.publish.js vendored Normal file
View File

@ -0,0 +1,15 @@
"use strict";
/// <reference path="./typings/main.d.ts" />
var plugins = require("./npmts.plugins");
var NpmtsTests = require("./npmts.tests");
var NpmtsJsdoc = require("./npmts.jsdoc");
exports.run = function (configArg) {
var done = plugins.Q.defer();
var config = configArg;
var promiseArray = [];
config.codecov ? promiseArray.push(NpmtsTests.publishCoverage(configArg)) : void (0);
config.docs.publish ? promiseArray.push(NpmtsJsdoc.publishDocs(configArg)) : void (0);
promiseArray.length === 0 ? plugins.beautylog.info("Did not publish anything!") : void (0);
plugins.Q.all(promiseArray).then(done.resolve);
return done.promise;
};

90
dist/npmts.tests.js vendored
View File

@ -2,44 +2,76 @@
/// <reference path="./typings/main.d.ts" /> /// <reference path="./typings/main.d.ts" />
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
var paths = require("./npmts.paths"); var paths = require("./npmts.paths");
exports.run = function (configArg) { exports.publishCoverage = function (configArg) {
var done = plugins.Q.defer();
plugins.beautylog.log("now uploading coverage data to codecov.io");
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "./coverage/lcov.info")])
.pipe(plugins.g.codecov())
.pipe(plugins.g.gFunction(function () {
plugins.beautylog.ok("Coverage data has been uploaded to codecov.io!");
done.resolve(configArg);
}, "atEnd"));
return done.promise;
};
/**
*
* @returns {*}
*/
var istanbul = 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")]) var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "dist/*.js")])
.pipe(plugins.g.istanbul()) .pipe(plugins.g.istanbul()) // Covering files
.pipe(plugins.g.istanbul.hookRequire()); .pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
return stream; .pipe(plugins.g.gFunction(function () {
}; done.resolve(configArg);
var mocha = function () { }, "atEnd"));
return done.promise;
};
/**
*
* @returns {*}
*/
var mocha = function (configArg) {
var done = plugins.Q.defer();
var stream = plugins.gulp.src(["./test/test.js"]) var stream = plugins.gulp.src(["./test/test.js"])
.pipe(plugins.g.mocha()) .pipe(plugins.g.mocha())
.pipe(plugins.g.istanbul.writeReports()) .pipe(plugins.g.istanbul.writeReports()) // Creating the reports after tests ran
.pipe(plugins.g.istanbul.enforceThresholds({ thresholds: { global: 30 } }));
return stream;
};
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())
.pipe(plugins.g.gFunction(function () { .pipe(plugins.g.gFunction(function () {
plugins.beautylog.ok("Tests have passed and coverage data has been uploaded to Coveralls!"); plugins.beautylog.ok("Tests have passed!");
done.resolve(configArg);
}, "atEnd")); }, "atEnd"));
return stream; return done.promise;
}; };
plugins.beautylog.log("now starting tests"); var coverage = function (configArg) {
istanbul().on("finish", function () { var done = plugins.Q.defer();
mocha().on("finish", function () { plugins.smartcov.get.percentage(plugins.path.join(paths.coverageDir, "lcov.info"))
if (plugins.smartenv.getEnv().isTravis && config.coveralls) { .then(function (percentageArg) {
coveralls().on("finish", function () { if (percentageArg >= configArg.coverageTreshold) {
done.resolve(config); plugins.beautylog.ok("your coverage of " + percentageArg.toString().blue + "% ".blue + "exceeds your treshold of " +
}); configArg.coverageTreshold.toString().blue + "%".blue);
} }
else { else {
plugins.beautylog.ok("Tests have passed!"); plugins.beautylog.warn("your coverage of " + percentageArg + "% " + "fails your treshold of " +
done.resolve(config); configArg.coverageTreshold + "%");
plugins.beautylog.error("exiting due to coverage failure");
process.exit(1);
} }
}); done.resolve(configArg);
}); });
return done.promise; return done.promise;
}; };
exports.run = function (configArg) {
var done = plugins.Q.defer();
var config = configArg;
plugins.beautylog.log("now starting tests");
console.log("--------------------------------------------------------------\n" +
"***************************" +
" TESTS: ".blue +
"***************************\n" +
"--------------------------------------------------------------");
istanbul(config)
.then(mocha)
.then(coverage)
.then(done.resolve);
return done.promise;
};

View File

@ -1,6 +1,6 @@
{ {
"name": "npmts", "name": "npmts",
"version": "3.6.2", "version": "5.0.1",
"description": "write npm modules with TypeScript", "description": "write npm modules with TypeScript",
"main": "dist/index.js", "main": "dist/index.js",
"bin": { "bin": {
@ -25,28 +25,29 @@
}, },
"homepage": "https://github.com/pushrocks/npmts#readme", "homepage": "https://github.com/pushrocks/npmts#readme",
"dependencies": { "dependencies": {
"beautylog": "3.1.2", "beautylog": "4.1.0",
"fs-extra": "^0.26.7", "fs-extra": "^0.26.7",
"gulp": "3.9.1", "gulp": "3.9.1",
"gulp-codecov": "^2.0.1",
"gulp-concat": "^2.6.0", "gulp-concat": "^2.6.0",
"gulp-coveralls": "^0.1.4", "gulp-function": "^1.2.3",
"gulp-function": "^1.1.1",
"gulp-if": "^2.0.0", "gulp-if": "^2.0.0",
"gulp-istanbul": "^0.10.3", "gulp-istanbul": "^0.10.3",
"gulp-jsdoc3": "^0.2.1", "gulp-jsdoc3": "^0.2.1",
"gulp-mocha": "^2.2.0", "gulp-mocha": "^2.2.0",
"gulp-sourcemaps": "^1.6.0", "gulp-sourcemaps": "^1.6.0",
"gulp-typescript": "2.12.1", "gulp-typescript": "2.12.2",
"gulp-typings": "1.3.0", "gulp-typings": "1.3.0",
"merge2": "1.0.1", "merge2": "1.0.2",
"projectinfo": "1.0.1", "projectinfo": "1.0.1",
"q": "^1.4.1", "q": "^1.4.1",
"shelljs": "^0.6.0", "shelljs": "^0.6.0",
"smartci": "0.0.1", "smartci": "0.0.1",
"smartcli": "0.0.11", "smartcli": "0.0.11",
"smartenv": "1.2.0", "smartcov": "0.0.4",
"smartfile": "2.2.0", "smartenv": "1.2.1",
"smartpath": "3.0.1", "smartfile": "2.3.0",
"smartpath": "3.1.1",
"source-map-support": "^0.4.0" "source-map-support": "^0.4.0"
}, },
"devDependencies": {} "devDependencies": {}

View File

@ -6,4 +6,4 @@ var testplugin = {
}; };
module.exports = testplugin; module.exports = testplugin;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0QztBQUM1QyxJQUFJLFVBQVUsR0FBRztJQUNiLFlBQVksRUFBRTtRQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQztJQUMxQyxDQUFDO0NBQ0osQ0FBQztBQUNGLE1BQU0sQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxudmFyIHRlc3RwbHVnaW4gPSB7XG4gICAgbG9nU29tZXRoaW5nOiBmdW5jdGlvbigpe1xuICAgICAgICBjb25zb2xlLmxvZyhcIm9ubHkgZnVuY3Rpb24gZXhlY3V0ZWRcIik7XG4gICAgfVxufTtcbm1vZHVsZS5leHBvcnRzID0gdGVzdHBsdWdpbjsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0= //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0QztBQUM1QyxJQUFJLFVBQVUsR0FBRztJQUNiLFlBQVksRUFBRTtRQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQztJQUMxQyxDQUFDO0NBQ0osQ0FBQztBQUNGLE1BQU0sQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxubGV0IHRlc3RwbHVnaW4gPSB7XG4gICAgbG9nU29tZXRoaW5nOiBmdW5jdGlvbigpe1xuICAgICAgICBjb25zb2xlLmxvZyhcIm9ubHkgZnVuY3Rpb24gZXhlY3V0ZWRcIik7XG4gICAgfVxufTtcbm1vZHVsZS5leHBvcnRzID0gdGVzdHBsdWdpbjsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=

View File

@ -9,7 +9,7 @@
"./subts2/typings.json", "./subts2/typings.json",
"./customdir/typings.json" "./customdir/typings.json"
], ],
"coveralls":true, "codecov":true,
"docs": { "docs": {
"publish":true "publish":true
}, },

View File

@ -1,2 +0,0 @@
/// <reference path="../ts/typings/main.d.ts" />
declare var testplugin: any;

View File

@ -1,5 +1,4 @@
/// <reference path="../ts/typings/main.d.ts" /> /// <reference path="../ts/typings/main.d.ts" />
console.log("**** starting test ****");
var testplugin = require("../dist/index.js"); var testplugin = require("../dist/index.js");
describe("testplugins", function () { describe("testplugins", function () {
describe(".logSomething", function () { describe(".logSomething", function () {
@ -9,4 +8,4 @@ describe("testplugins", function () {
}); });
}); });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELE9BQU8sQ0FBQyxHQUFHLENBQUMseUJBQXlCLENBQUMsQ0FBQztBQUN2QyxJQUFJLFVBQVUsR0FBRyxPQUFPLENBQUMsa0JBQWtCLENBQUMsQ0FBQztBQUM3QyxRQUFRLENBQUMsYUFBYSxFQUFDO0lBQ25CLFFBQVEsQ0FBQyxlQUFlLEVBQUM7UUFDckIsRUFBRSxDQUFDLHNCQUFzQixFQUFDO1lBQ3RCLFVBQVUsQ0FBQyxZQUFZLEVBQUUsQ0FBQTtRQUM3QixDQUFDLENBQUMsQ0FBQztJQUNQLENBQUMsQ0FBQyxDQUFDO0FBQ1AsQ0FBQyxDQUFDLENBQUMiLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vLyA8cmVmZXJlbmNlIHBhdGg9XCIuLi90cy90eXBpbmdzL21haW4uZC50c1wiIC8+XG5jb25zb2xlLmxvZyhcIioqKiogc3RhcnRpbmcgdGVzdCAqKioqXCIpO1xudmFyIHRlc3RwbHVnaW4gPSByZXF1aXJlKFwiLi4vZGlzdC9pbmRleC5qc1wiKTtcbmRlc2NyaWJlKFwidGVzdHBsdWdpbnNcIixmdW5jdGlvbigpe1xuICAgIGRlc2NyaWJlKFwiLmxvZ1NvbWV0aGluZ1wiLGZ1bmN0aW9uKCl7XG4gICAgICAgIGl0KFwic2hvdWxkIGxvZyBzb21ldGhpbmdcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgdGVzdHBsdWdpbi5sb2dTb21ldGhpbmcoKVxuICAgICAgICB9KTtcbiAgICB9KTtcbn0pOyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ== //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzdDLFFBQVEsQ0FBQyxhQUFhLEVBQUM7SUFDbkIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixFQUFFLENBQUMsc0JBQXNCLEVBQUM7WUFDdEIsVUFBVSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQzdCLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbnZhciB0ZXN0cGx1Z2luID0gcmVxdWlyZShcIi4uL2Rpc3QvaW5kZXguanNcIik7XG5kZXNjcmliZShcInRlc3RwbHVnaW5zXCIsZnVuY3Rpb24oKXtcbiAgICBkZXNjcmliZShcIi5sb2dTb21ldGhpbmdcIixmdW5jdGlvbigpe1xuICAgICAgICBpdChcInNob3VsZCBsb2cgc29tZXRoaW5nXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHRlc3RwbHVnaW4ubG9nU29tZXRoaW5nKClcbiAgICAgICAgfSk7XG4gICAgfSk7XG59KTsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=

View File

@ -1 +1 @@
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AACvC,IAAI,UAAU,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC7C,QAAQ,CAAC,aAAa,EAAC;IACnB,QAAQ,CAAC,eAAe,EAAC;QACrB,EAAE,CAAC,sBAAsB,EAAC;YACtB,UAAU,CAAC,YAAY,EAAE,CAAA;QAC7B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} {"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,IAAI,UAAU,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC7C,QAAQ,CAAC,aAAa,EAAC;IACnB,QAAQ,CAAC,eAAe,EAAC;QACrB,EAAE,CAAC,sBAAsB,EAAC;YACtB,UAAU,CAAC,YAAY,EAAE,CAAA;QAC7B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}

View File

@ -1,5 +1,4 @@
/// <reference path="../ts/typings/main.d.ts" /> /// <reference path="../ts/typings/main.d.ts" />
console.log("**** starting test ****");
var testplugin = require("../dist/index.js"); var testplugin = require("../dist/index.js");
describe("testplugins",function(){ describe("testplugins",function(){
describe(".logSomething",function(){ describe(".logSomething",function(){

View File

@ -1,5 +1,5 @@
/// <reference path="./typings/main.d.ts" /> /// <reference path="./typings/main.d.ts" />
var testplugin = { let testplugin = {
logSomething: function(){ logSomething: function(){
console.log("only function executed"); console.log("only function executed");
} }

View File

@ -3,10 +3,11 @@ import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths"); import paths = require("./npmts.paths");
export let run = function(configArg){ export let run = function(configArg){
plugins.beautylog.log("now cleaning up from previous builds"); plugins.beautylog.log("now cleaning up from previous builds...");
let done = plugins.Q.defer(); let done = plugins.Q.defer();
plugins.smartfile.fsaction.remove(paths.distDir) plugins.smartfile.fsaction.remove(paths.distDir)
.then(function(){ .then(function(){
plugins.beautylog.ok("Cleaned up!");
done.resolve(configArg); done.resolve(configArg);
}); });
return done.promise; return done.promise;

View File

@ -11,7 +11,7 @@ export var run = function(){
switch (config.mode){ switch (config.mode){
case "default": case "default":
case "custom": case "custom":
plugins.beautylog.log("mode is " + config.mode.yellow); plugins.beautylog.ok("mode is " + config.mode.yellow);
done.resolve(config); done.resolve(config);
break; break;
default: default:

View File

@ -2,8 +2,8 @@
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths"); import paths = require("./npmts.paths");
var genJsdoc = function(configArg){ let genJsdoc = function(configArg){
var done = plugins.Q.defer(); let done = plugins.Q.defer();
plugins.beautylog.log("now generating " + "JsDoc documentation".blue); plugins.beautylog.log("now generating " + "JsDoc documentation".blue);
plugins.gulp.src([ plugins.gulp.src([
plugins.path.join(paths.cwd,"README.md"), plugins.path.join(paths.cwd,"README.md"),
@ -20,16 +20,16 @@ var genJsdoc = function(configArg){
return done.promise; return done.promise;
}; };
var publishDocs = function(configArg){ export let publishDocs = function(configArg){
var done = plugins.Q.defer(); let done = plugins.Q.defer();
var gitUrl = plugins.projectinfo.npm( let gitUrl = plugins.projectinfo.npm(
paths.cwd, paths.cwd,
{ {
gitAccessToken:process.env.GITHUB_TOKEN gitAccessToken:process.env.GITHUB_TOKEN
} }
).git.httpsUrl; ).git.httpsUrl;
var deployScript = "" let deployScript = ""
+ "cd " + paths.docsDir + " " + "cd " + paths.docsDir + " "
+ "&& git init " + "> /dev/null 2>&1 " + "&& git init " + "> /dev/null 2>&1 "
+ "&& git config user.name \"TRAVIS CI\" " + "> /dev/null 2>&1 " + "&& git config user.name \"TRAVIS CI\" " + "> /dev/null 2>&1 "
@ -40,7 +40,7 @@ var publishDocs = function(configArg){
+ "\"" + gitUrl + "\" " + "\"" + gitUrl + "\" "
+ "master:gh-pages " + "> /dev/null 2>&1"; + "master:gh-pages " + "> /dev/null 2>&1";
if(configArg.docs.publish){
plugins.beautylog.log("now publishing JsDoc documentation to GitHub"); plugins.beautylog.log("now publishing JsDoc documentation to GitHub");
if (!plugins.shelljs.which('git')) { if (!plugins.shelljs.which('git')) {
plugins.beautylog.error('Git is not installed!'); plugins.beautylog.error('Git is not installed!');
@ -51,17 +51,14 @@ var publishDocs = function(configArg){
} }
plugins.beautylog.ok("JsDoc documentation has been deployed to GitHub!"); plugins.beautylog.ok("JsDoc documentation has been deployed to GitHub!");
done.resolve(configArg); done.resolve(configArg);
} else {
done.resolve(configArg);
}
return done.promise; return done.promise;
}; };
export var run = function(configArg){ export let run = function(configArg){
var done = plugins.Q.defer(); let done = plugins.Q.defer();
genJsdoc(configArg) genJsdoc(configArg)
.then(publishDocs)
.then(done.resolve); .then(done.resolve);
return done.promise; return done.promise;
}; };

View File

@ -1,6 +1,10 @@
/// <reference path="./typings/main.d.ts" /> /// <reference path="./typings/main.d.ts" />
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
export let isCi = function(){
return plugins.smartci.check.isCi();
};
export let isRelease = function():boolean { export let isRelease = function():boolean {
return plugins.smartci.check.isCi() return plugins.smartci.check.isCi()
&& plugins.smartci.check.isTaggedCommit(); && plugins.smartci.check.isTaggedCommit();
@ -8,14 +12,14 @@ export let isRelease = function():boolean {
export let doPublish = function():boolean { export let doPublish = function():boolean {
return isRelease() return isRelease()
&& plugins.smartci.get.subJobNumber() != 1; && plugins.smartci.get.subJobNumber() == 1;
}; };
export var run = function(configArg){ export var run = function(configArg){
var done = plugins.Q.defer(); var done = plugins.Q.defer();
var config = configArg; var config = configArg;
plugins.beautylog.log("now determining build options"); plugins.beautylog.log("now determining build options...");
//handle default mode //handle default mode
if (config.mode == "default"){ if (config.mode == "default"){
@ -32,17 +36,22 @@ export var run = function(configArg){
// handle state of current build // handle state of current build
isRelease() ? plugins.beautylog.info("All right: This is a RELEASE build!") isRelease() ? plugins.beautylog.info("All right: This is a RELEASE build!")
: plugins.beautylog.info("NOT A RELEASE build! We are not publishing anything!"); : plugins.beautylog.info("NOT A RELEASE build!");
isRelease() && doPublish() ? plugins.beautylog.info("All right: This is the first subBuild, so this one publishes COVERAGE + DOCS when tests succeed!")
: plugins.beautylog.info("We are not publishing anything!");
// handle coveralls // handle coveralls
config.coveralls ? void(0) : config.coveralls = false; config.codecov ? void(0) : config.codecov = true;
doPublish() ? void(0) : config.coveralls = false; isCi() ? void(0) : config.codecov = false;
config.coverageTreshold ? void(0) : config.coverageTreshold = 70;
// handle docs // handle docs
config.docs ? void(0) : config.docs = {}; config.docs ? void(0) : config.docs = {};
config.docs.publish ? void(0) : config.docs.publish = false; config.docs.publish ? void(0) : config.docs.publish = false;
doPublish() ? void(0) : config.docs.publish = false; doPublish() ? void(0) : config.docs.publish = false;
plugins.beautylog.ok("build options are ready!");
done.resolve(config); done.resolve(config);
return done.promise; return done.promise;
}; };

View File

@ -8,6 +8,7 @@ paths.tsDir = plugins.path.join(paths.cwd,"ts/");
paths.distDir = plugins.path.join(paths.cwd,"dist/"); paths.distDir = plugins.path.join(paths.cwd,"dist/");
paths.docsDir = plugins.path.join(paths.cwd,"docs/"); paths.docsDir = plugins.path.join(paths.cwd,"docs/");
paths.testDir = plugins.path.join(paths.cwd,"test/"); paths.testDir = plugins.path.join(paths.cwd,"test/");
paths.coverageDir = plugins.path.join(paths.cwd,"coverage/");
paths.npmtsAssetsDir = plugins.path.join(__dirname,"../assets/"); paths.npmtsAssetsDir = plugins.path.join(__dirname,"../assets/");

View File

@ -3,7 +3,7 @@ export let beautylog = require("beautylog");
export let fs = require("fs-extra"); export let fs = require("fs-extra");
export let gulp = require("gulp"); export let gulp = require("gulp");
export let g = { export let g = {
coveralls: require("gulp-coveralls"), codecov: require("gulp-codecov"),
gFunction: require("gulp-function"), gFunction: require("gulp-function"),
istanbul: require("gulp-istanbul"), istanbul: require("gulp-istanbul"),
jsdoc3: require("gulp-jsdoc3"), jsdoc3: require("gulp-jsdoc3"),
@ -15,12 +15,13 @@ export let g = {
}; };
export let merge2 = require("merge2"); export let merge2 = require("merge2");
export let projectinfo = require("projectinfo"); export let projectinfo = require("projectinfo");
export let sourceMapSupport = require("source-map-support").install();
export let path = require("path"); export let path = require("path");
export let Q = require("q"); export let Q = require("q");
export let shelljs = require("shelljs"); export let shelljs = require("shelljs");
export let smartci = require("smartci"); export let smartci = require("smartci");
export let smartcli = require("smartcli"); export let smartcli = require("smartcli");
export let smartcov = require("smartcov");
export let smartenv = require("smartenv"); export let smartenv = require("smartenv");
export let smartfile = require("smartfile"); export let smartfile = require("smartfile");
export let smartpath = require("smartpath"); export let smartpath = require("smartpath");
export let sourceMapSupport = require("source-map-support").install();

View File

@ -8,6 +8,7 @@ import NpmtsConfigFile = require("./npmts.configfile");
import NpmtsInstall = require("./npmts.install"); import NpmtsInstall = require("./npmts.install");
import NpmtsJsdoc = require("./npmts.jsdoc"); import NpmtsJsdoc = require("./npmts.jsdoc");
import NpmtsOptions = require("./npmts.options"); import NpmtsOptions = require("./npmts.options");
import NpmtsPublish = require("./npmts.publish");
import NpmtsTests = require("./npmts.tests"); import NpmtsTests = require("./npmts.tests");
export var run = function(){ export var run = function(){
@ -20,6 +21,7 @@ export var run = function(){
.then(NpmtsAssets.run) .then(NpmtsAssets.run)
.then(NpmtsJsdoc.run) .then(NpmtsJsdoc.run)
.then(NpmtsTests.run) .then(NpmtsTests.run)
.then(NpmtsPublish.run)
.then(function(configArg){ .then(function(configArg){
let shipString = "" + let shipString = "" +
"\n" + "\n" +
@ -38,6 +40,8 @@ export var run = function(){
if (process.env.CI){ if (process.env.CI){
console.log(shipString); console.log(shipString);
plugins.beautylog.success("READY TO SHIP!"); plugins.beautylog.success("READY TO SHIP!");
} else {
plugins.beautylog.success("Done!")
} }
}); });

18
ts/npmts.publish.ts Normal file
View File

@ -0,0 +1,18 @@
/// <reference path="./typings/main.d.ts" />
import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths");
import NpmtsTests = require("./npmts.tests");
import NpmtsJsdoc = require("./npmts.jsdoc");
export let run = function(configArg){
let done = plugins.Q.defer();
let config = configArg;
let promiseArray = [];
config.codecov ? promiseArray.push(NpmtsTests.publishCoverage(configArg)) : void(0);
config.docs.publish ? promiseArray.push(NpmtsJsdoc.publishDocs(configArg)) : void(0);
promiseArray.length === 0 ? plugins.beautylog.info("Did not publish anything!") : void(0);
plugins.Q.all(promiseArray).then(done.resolve);
return done.promise;
};

View File

@ -1,50 +1,88 @@
/// <reference path="./typings/main.d.ts" /> /// <reference path="./typings/main.d.ts" />
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths"); import paths = require("./npmts.paths");
export var run = function(configArg) {
var done = plugins.Q.defer();
var config = configArg;
var istanbul = function () {
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"dist/*.js")])
// Covering files
.pipe(plugins.g.istanbul())
// Force `require` to return covered files
.pipe(plugins.g.istanbul.hookRequire());
return stream;
};
var mocha = function () { export let publishCoverage = function(configArg){
var stream = plugins.gulp.src(["./test/test.js"]) let done = plugins.Q.defer();
.pipe(plugins.g.mocha()) plugins.beautylog.log("now uploading coverage data to codecov.io");
// Creating the reports after tests ran
.pipe(plugins.g.istanbul.writeReports())
// Enforce a coverage of at least 90%
.pipe(plugins.g.istanbul.enforceThresholds({ thresholds: { global: 30 } }));
return stream;
};
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")]) var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"./coverage/lcov.info")])
.pipe(plugins.g.coveralls()) .pipe(plugins.g.codecov())
.pipe(plugins.g.gFunction(function(){ .pipe(plugins.g.gFunction(function(){
plugins.beautylog.ok("Tests have passed and coverage data has been uploaded to Coveralls!"); plugins.beautylog.ok("Coverage data has been uploaded to codecov.io!");
done.resolve(configArg);
},"atEnd")); },"atEnd"));
return stream; return done.promise;
}; };
plugins.beautylog.log("now starting tests"); /**
istanbul().on("finish",function(){ *
mocha().on("finish",function(){ * @returns {*}
if(plugins.smartenv.getEnv().isTravis && config.coveralls){ */
coveralls().on("finish",function(){ let istanbul = function (configArg) {
done.resolve(config); let done = plugins.Q.defer();
}) var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"dist/*.js")])
} else { .pipe(plugins.g.istanbul()) // Covering files
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
.pipe(plugins.g.gFunction(function(){
done.resolve(configArg);
},"atEnd"));
return done.promise;
};
/**
*
* @returns {*}
*/
let mocha = function (configArg) {
let done = plugins.Q.defer();
let 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!"); plugins.beautylog.ok("Tests have passed!");
done.resolve(config); done.resolve(configArg);
},"atEnd"));
return done.promise;
};
let coverage = function(configArg){
let 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; return done.promise;
}; };
export let run = function(configArg) {
let done = plugins.Q.defer();
let config = configArg;
plugins.beautylog.log("now starting tests");
console.log(
"--------------------------------------------------------------\n" +
"***************************" +
" TESTS: ".blue +
"***************************\n" +
"--------------------------------------------------------------"
);
istanbul(config)
.then(mocha)
.then(coverage)
.then(done.resolve);
return done.promise;
};

View File

@ -1,7 +1,8 @@
{ {
"ambientDependencies": { "ambientDependencies": {
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777",
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts#09e37435ffb2c56a6f908081194a74756f24f99d", "colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts#09e37435ffb2c56a6f908081194a74756f24f99d",
"istanbul": "registry:dt/istanbul#0.4.0+20160316155526",
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777",
"vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777" "vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777"
} }
} }