Compare commits

...

13 Commits

Author SHA1 Message Date
1ada5dd5a9 2.2.1 2016-02-09 17:42:43 +01:00
a41bfd442c fix coveralls initial value 2016-02-09 17:42:31 +01:00
2917b10ffb 2.2.0 2016-02-09 17:26:37 +01:00
bfc5bbbbb7 fix coverage path 2016-02-09 17:26:25 +01:00
cf507a4a17 add coverage badge 2016-02-09 17:19:27 +01:00
73a57ed264 2.1.10 2016-02-09 17:01:45 +01:00
39b79b679c fix config traveling 2016-02-09 17:01:37 +01:00
cc053ee396 2.1.9 2016-02-09 16:34:55 +01:00
df5371187b remove scoping problem with gulp task names 2016-02-09 16:34:52 +01:00
cbda76c380 2.1.8 2016-02-09 16:00:20 +01:00
e20bcec133 finetune some paths 2016-02-09 16:00:07 +01:00
3e673e04b2 2.1.7 2016-02-09 06:01:39 +01:00
2090dad540 refine coverage treshold for failure 2016-02-09 06:01:32 +01:00
12 changed files with 58 additions and 51 deletions

View File

@ -1,6 +1,9 @@
# npmts
Write npm modules with TypeScript without hassle.
## Status
[![Coverage Status](https://coveralls.io/repos/github/pushrocks/npmts/badge.svg?branch=master)](https://coveralls.io/github/pushrocks/npmts?branch=master)
## How to use npmts
### Install

4
index.d.ts vendored
View File

@ -6,11 +6,9 @@ declare module NpmtsPlugins {
gulp: any;
g: {
coveralls: any;
if: any;
insert: any;
istanbul: any;
mocha: any;
sequence: any;
typescript: any;
};
mergeStream: any;
@ -45,11 +43,9 @@ declare var plugins: {
gulp: any;
g: {
coveralls: any;
if: any;
insert: any;
istanbul: any;
mocha: any;
sequence: any;
typescript: any;
};
mergeStream: any;

View File

@ -10,11 +10,9 @@ var NpmtsPlugins;
gulp: require("gulp"),
g: {
coveralls: require("gulp-coveralls"),
if: require("gulp-if"),
insert: require("gulp-insert"),
istanbul: require("gulp-istanbul"),
mocha: require("gulp-mocha"),
sequence: require("gulp-sequence"),
typescript: require("gulp-typescript")
},
mergeStream: require("merge2"),
@ -182,7 +180,7 @@ var NpmtsCompile;
moduleStream.on("queueDrain", function () {
plugins.beautylog.success("custom TypeScript installed successfully");
moduleStream.on("finish", function () {
done.resolve();
done.resolve(config);
});
moduleStream.end();
});
@ -196,27 +194,36 @@ var NpmtsTests;
NpmtsTests.run = function (configArg) {
var done = plugins.q.defer();
var config = configArg;
plugins.gulp.task('istanbul', function () {
return plugins.gulp.src([plugins.path.join(paths.cwd, "index.js")])
var istanbul = function () {
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "index.js")])
.pipe(plugins.g.istanbul())
.pipe(plugins.g.istanbul.hookRequire());
});
plugins.gulp.task('mocha', function () {
return plugins.gulp.src(['test/test.js'])
return stream;
};
var mocha = function () {
var stream = plugins.gulp.src(["./test/test.js"])
.pipe(plugins.g.mocha())
.pipe(plugins.g.istanbul.writeReports())
.pipe(plugins.g.istanbul.enforceThresholds({ thresholds: { global: 90 } }));
});
plugins.gulp.task("coveralls", function () {
return plugins.gulp.src('coverage/**/lcov.info')
.pipe(plugins.g.if((process.env.TRAVIS && config.coveralls), plugins.g.coveralls()));
});
plugins.gulp.task("test", function () {
plugins.g.sequence("istanbul", "mocha", "coveralls", function () {
done.resolve();
.pipe(plugins.g.istanbul.enforceThresholds({ thresholds: { global: 30 } }));
return stream;
};
var coveralls = function () {
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "./coverage/lcov.info")])
.pipe(plugins.g.coveralls());
return stream;
};
istanbul().on("finish", function () {
mocha().on("finish", function () {
if (process.env.TRAVIS && config.coveralls) {
coveralls().on("finish", function () {
done.resolve(config);
});
}
else {
done.resolve(config);
}
});
});
plugins.gulp.start.apply(plugins.gulp, ['test']);
return done.promise;
};
})(NpmtsTests || (NpmtsTests = {}));

View File

@ -1,6 +1,6 @@
{
"name": "npmts",
"version": "2.1.6",
"version": "2.2.1",
"description": "write npm modules with TypeScript",
"main": "index.js",
"typings": "./index.d.ts",
@ -30,11 +30,9 @@
"fs-extra": "^0.26.5",
"gulp": "3.9.0",
"gulp-coveralls": "^0.1.4",
"gulp-if": "^2.0.0",
"gulp-insert": "0.5.0",
"gulp-istanbul": "^0.10.3",
"gulp-mocha": "^2.2.0",
"gulp-sequence": "^0.4.4",
"gulp-typescript": "2.10.0",
"gulp-typings": "0.0.0",
"merge2": "1.0.1",

View File

@ -77,7 +77,7 @@
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 09 2016 05:46:38 GMT+0100 (CET)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 09 2016 17:25:54 GMT+0100 (CET)
</div>
</div>
<script src="../prettify.js"></script>

View File

@ -76,7 +76,7 @@ module.exports = testplugin;
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 09 2016 05:46:38 GMT+0100 (CET)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 09 2016 17:25:54 GMT+0100 (CET)
</div>
</div>
<script src="../prettify.js"></script>

View File

@ -77,7 +77,7 @@
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 09 2016 05:46:38 GMT+0100 (CET)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 09 2016 17:25:54 GMT+0100 (CET)
</div>
</div>
<script src="prettify.js"></script>

View File

@ -9,5 +9,5 @@
"./subts2/",
"./customdir"
],
"coveralls":"false"
"coveralls":true
}

View File

@ -83,7 +83,7 @@ module NpmtsCompile {
moduleStream.on("queueDrain",function(){
plugins.beautylog.success("custom TypeScript installed successfully");
moduleStream.on("finish",function(){
done.resolve();
done.resolve(config);
});
moduleStream.end();
});

View File

@ -4,7 +4,7 @@ module NpmtsOptions {
var done = plugins.q.defer();
var config = configArg;
if (typeof config.coveralls === "undefined"){
config.coveralls = true;
config.coveralls = false;
}
if (config.mode == "default"){
config.typings = [

View File

@ -7,11 +7,9 @@ module NpmtsPlugins {
gulp: require("gulp"),
g: {
coveralls: require("gulp-coveralls"),
if: require("gulp-if"),
insert: require("gulp-insert"),
istanbul: require("gulp-istanbul"),
mocha: require("gulp-mocha"),
sequence: require("gulp-sequence"),
typescript: require("gulp-typescript")
},

View File

@ -3,37 +3,42 @@ module NpmtsTests {
export var run = function(configArg) {
var done = plugins.q.defer();
var config = configArg;
plugins.gulp.task('istanbul', function () {
return plugins.gulp.src([plugins.path.join(paths.cwd,"index.js")])
var istanbul = function () {
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"index.js")])
// Covering files
.pipe(plugins.g.istanbul())
// Force `require` to return covered files
.pipe(plugins.g.istanbul.hookRequire());
});
return stream;
};
plugins.gulp.task('mocha', function () {
return plugins.gulp.src(['test/test.js'])
var mocha = function () {
var stream = plugins.gulp.src(["./test/test.js"])
.pipe(plugins.g.mocha())
// 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: 90 } }));
});
.pipe(plugins.g.istanbul.enforceThresholds({ thresholds: { global: 30 } }));
return stream;
};
plugins.gulp.task("coveralls",function(){
return plugins.gulp.src('coverage/**/lcov.info')
.pipe(plugins.g.if(
(process.env.TRAVIS && config.coveralls),
plugins.g.coveralls()
));
});
var coveralls = function(){
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"./coverage/lcov.info")])
.pipe(plugins.g.coveralls());
return stream;
};
plugins.gulp.task("test",function(){
plugins.g.sequence("istanbul","mocha","coveralls",function(){
done.resolve();
istanbul().on("finish",function(){
mocha().on("finish",function(){
if(process.env.TRAVIS && config.coveralls){
coveralls().on("finish",function(){
done.resolve(config);
})
} else {
done.resolve(config);
}
})
});
plugins.gulp.start.apply(plugins.gulp, ['test']);
return done.promise;
}
}