Compare commits

...

61 Commits

Author SHA1 Message Date
8d506f8220 5.2.5 2016-06-07 09:03:03 +02:00
bd9ed5feb5 update gitlab ci yml 2016-06-07 09:02:58 +02:00
ec28c660dc 5.2.4 2016-06-07 08:56:27 +02:00
9f4299e52a update gitlab ci yml 2016-06-07 08:56:21 +02:00
73c583409e 5.2.3 2016-06-07 08:53:55 +02:00
f8c86f1871 small fix 2016-06-07 08:53:47 +02:00
67130ec2b6 5.2.2 2016-06-07 08:49:28 +02:00
48fa9d205a now compiling Tests seperately 2016-06-07 08:49:22 +02:00
3070584642 pages now publishing for tags 2016-06-03 16:57:03 +02:00
a71ffb2415 5.2.1 2016-06-03 16:48:58 +02:00
dc2be85236 add legacy test 2016-06-03 16:46:10 +02:00
964e1ce9ac 5.2.0 2016-06-03 16:43:56 +02:00
fba6e3d4c5 remove codecov 2016-06-03 16:43:46 +02:00
7df51bad07 Merge branch 'master' of gitlab.com:pushrocks/npmts 2016-06-02 13:11:14 +02:00
5c7af1e59f 5.1.20 2016-06-02 13:09:28 +02:00
e72f7fe5c6 Update .gitlab-ci.yml 2016-05-31 17:04:35 +00:00
da48b987ba update gitlab ci yml 2016-05-30 07:49:41 +02:00
9eabac7022 update gitlab yml 2016-05-30 07:30:01 +02:00
00683fbab1 fix gitlab.yml 2016-05-30 07:16:30 +02:00
3434bbf815 add pages to gitlab.yml 2016-05-30 07:05:17 +02:00
85ac242627 5.1.19 2016-05-30 05:44:40 +02:00
9b71872d12 Merge branch 'master' of gitlab.com:pushrocks/npmts 2016-05-30 05:44:21 +02:00
281595f8c8 update gitlab ci and use npmci 2016-05-30 05:42:24 +02:00
83f03994a9 Add contribution guide 2016-05-29 19:24:59 +00:00
01837f8420 Add changelog 2016-05-29 19:23:11 +00:00
b5735e3721 update .gitlab-ci.yml 2016-05-29 21:04:44 +02:00
0dc45f1414 improved GitLab compatibility 2016-05-29 20:56:53 +02:00
9d1c3f7457 disable codecov upload for now 2016-05-29 09:58:21 +02:00
017279730a Update README.md 2016-05-27 12:44:15 +00:00
0b50b14146 5.1.18 2016-05-27 01:00:25 +02:00
dfa27c0604 fix package.json 2016-05-27 01:00:19 +02:00
19e839a282 add .npmignore 2016-05-27 00:59:17 +02:00
647e2ec886 5.1.17 2016-05-26 23:56:02 +02:00
4e267850bf update repo URL 2016-05-26 23:55:57 +02:00
a52f6a9e9b 5.1.16 2016-05-26 23:34:00 +02:00
23b0ee1472 update gitlab.yml 2016-05-26 23:33:34 +02:00
c4d58b047c fix doPublish error 2016-05-26 22:53:59 +02:00
403b530a60 update ci-yml 2016-05-26 22:45:40 +02:00
7d6caaafce fix gitlab ci 2016-05-26 22:41:06 +02:00
8f47b95220 update ci 2016-05-26 22:38:23 +02:00
375d5cdfcc update ci yml 2016-05-26 22:37:13 +02:00
a3b1391b86 update gitlab ci 2016-05-26 21:21:35 +02:00
d2f5a81cfb update gitlab ci 2016-05-26 21:19:41 +02:00
2bc2d11a2d add gitlab ci 2016-05-26 21:18:14 +02:00
ecf0666103 5.1.15 2016-05-25 06:59:39 +02:00
ad05144bba update smartstring 2016-05-25 06:59:33 +02:00
1e77aba991 5.1.14 2016-05-25 05:24:05 +02:00
bb6c07845c update to typings-global 2016-05-25 05:23:48 +02:00
079b049a10 update dependencies 2016-05-25 05:14:56 +02:00
94f48afbbd 5.1.13 2016-05-23 05:34:30 +02:00
944e9b227c deactivate typings clean for now until nodehash is implemented 2016-05-23 05:34:25 +02:00
b83aaf4abf 5.1.12 2016-05-23 05:21:35 +02:00
51a1dd0b1d now uses latest early module 2016-05-23 05:21:28 +02:00
dd9df9f5ee 5.1.11 2016-05-22 01:10:02 +02:00
c109952a22 added early module 2016-05-22 01:09:55 +02:00
b14c79f6ef 5.1.10 2016-05-22 00:41:20 +02:00
66ad3aeeb9 5.1.9 2016-05-21 19:42:54 +02:00
a6e91c6a7f now clears CLI pipe for tests 2016-05-21 19:41:18 +02:00
f65c09c24e 5.1.8 2016-05-20 00:55:32 +02:00
e8053fa9e1 improve log output and clear default typings directory, before getting new typings. 2016-05-20 00:55:14 +02:00
759d4031d2 prepare for better smartfile module. 2016-05-19 22:11:18 +02:00
47 changed files with 279 additions and 192 deletions

51
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,51 @@
image: hosttoday/ht-docker-node:npmci
stages:
- test
- release
- page
testLEGACY:
stage: test
script:
- npmci test legacy
tags:
- docker
allow_failure: true
testLTS:
stage: test
script:
- npmci test lts
tags:
- docker
testSTABLE:
stage: test
script:
- npmci test stable
tags:
- docker
release:
stage: release
script:
- npmci publish
only:
- tags
tags:
- docker
pages:
stage: page
script:
- npmci test lts
- mkdir .public
- cp -r test/assets/docs/ .public
- cp -r test/assets/coverage/ .public
- mv .public public
artifacts:
paths:
- public
only:
- tags

View File

@ -1,6 +1,6 @@
.idea/ .idea/
support compile/
compile coverage/
test/ test/
docs/ docs/
examples examples

7
CHANGELOG Normal file
View File

@ -0,0 +1,7 @@
Please view this file on the master branch, on stable branches it's out of date.
v 6.0.0 (unreleased)
- handle bithound
- check package.json
- check .gitlab-ci-yml
- check appveyor.yml

4
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,4 @@
# Contribution Guide
This module is developed on the fabulous GitLab.com:
https://gitlab.com/pushrocks/npmts

View File

@ -2,8 +2,8 @@
Write npm modules with TypeScript without hassle. Write npm modules with TypeScript without hassle.
## Status ## Status
[![Build Status](https://travis-ci.org/pushrocks/npmts.svg?branch=master)](https://travis-ci.org/pushrocks/npmts) [![build status](https://gitlab.com/pushrocks/npmts/badges/master/build.svg)](https://gitlab.com/pushrocks/npmts/commits/master)
[![Build status](https://ci.appveyor.com/api/projects/status/iiljwhhcvbuqyvq0?svg=true)](https://ci.appveyor.com/project/philkunz/npmts) [![Build status](https://ci.appveyor.com/api/projects/status/22fuqa0uv21rcjh4/branch/master?svg=true)](https://ci.appveyor.com/project/philkunz/npmts/branch/master)
[![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)
@ -51,7 +51,10 @@ the npmts.json is the main config file. You can use it to customize the behaviou
```json ```json
{ {
"mode":"default", "mode":"default",
"codecov":true, "codecov":{
"publish":true,
"token":"sometoken"
},
"ts":{ "ts":{
"./customdir/*.ts":"./" "./customdir/*.ts":"./"
}, },

6
dist/index.js vendored
View File

@ -1,8 +1,10 @@
"use strict"; "use strict";
/// <reference path="./typings/main.d.ts" /> require("typings-global");
console.log("**** starting NPMTS ****"); var early = require("early");
early.start("NPMTS");
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
var npmts_promisechain_1 = require("./npmts.promisechain"); var npmts_promisechain_1 = require("./npmts.promisechain");
early.stop();
plugins.beautylog.figletSync("NPMTS"); plugins.beautylog.figletSync("NPMTS");
try { try {
npmts_promisechain_1.promisechain(); npmts_promisechain_1.promisechain();

View File

@ -1,12 +1,12 @@
"use strict"; "use strict";
/// <reference path="./typings/main.d.ts" /> require("typings-global");
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
var paths = require("./npmts.paths"); var paths = require("./npmts.paths");
var npmts_promisechain_1 = require("./npmts.promisechain"); var npmts_promisechain_1 = require("./npmts.promisechain");
exports.run = function (configArg) { exports.run = function (configArg) {
var done = plugins.Q.defer(); var done = plugins.Q.defer();
var config = configArg; var config = configArg;
npmts_promisechain_1.npmtsOra.text("now looking at required assets"); npmts_promisechain_1.npmtsOra.text("now looking at " + "required assets".yellow);
if (config.cli == true) { if (config.cli == true) {
plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir, "cli.js"), paths.distDir); plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir, "cli.js"), paths.distDir);
plugins.beautylog.ok("installed CLI assets!"); plugins.beautylog.ok("installed CLI assets!");

19
dist/npmts.clean.js vendored
View File

@ -1,12 +1,27 @@
"use strict"; "use strict";
/// <reference path="./typings/main.d.ts" /> require("typings-global");
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
var paths = require("./npmts.paths"); var paths = require("./npmts.paths");
var npmts_promisechain_1 = require("./npmts.promisechain"); 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) { exports.run = function (configArg) {
npmts_promisechain_1.npmtsOra.text("cleaning up from previous builds..."); npmts_promisechain_1.npmtsOra.text("cleaning up from previous builds...");
var done = plugins.Q.defer(); var done = plugins.Q.defer();
plugins.smartfile.fsaction.remove(paths.distDir) removeDist()
.then(removeTypings)
.then(function () { .then(function () {
plugins.beautylog.ok("Cleaned up from previous builds!"); plugins.beautylog.ok("Cleaned up from previous builds!");
done.resolve(configArg); done.resolve(configArg);

3
dist/npmts.cli.js vendored
View File

@ -1 +1,2 @@
/// <reference path="./typings/main.d.ts" /> "use strict";
require("typings-global");

View File

@ -1,12 +1,12 @@
"use strict"; "use strict";
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
var paths = require("./npmts.paths"); var paths = require("./npmts.paths");
var outputPathIsDir = function (configArg, keyArg) { var outputPathIsDir = function (tsArrayArg, keyArg) {
return plugins.smartpath.check.isDir(plugins.path.join(paths.cwd, configArg.ts[keyArg])); return plugins.smartpath.check.isDir(plugins.path.join(paths.cwd, tsArrayArg[keyArg]));
}; };
exports.checkOutputPath = function (configArg, keyArg) { exports.checkOutputPath = function (tsArrayArg, keyArg) {
if (!outputPathIsDir(configArg, keyArg)) { if (!outputPathIsDir(tsArrayArg, keyArg)) {
plugins.beautylog.warn("Skipping " + keyArg + " because " + configArg.ts[keyArg] + " it is no directory!"); plugins.beautylog.warn("Skipping " + keyArg + " because " + tsArrayArg[keyArg] + " it is no directory!");
return false; return false;
} }
else { else {

46
dist/npmts.compile.js vendored
View File

@ -1,5 +1,5 @@
"use strict"; "use strict";
/// <reference path="./typings/main.d.ts" /> require("typings-global");
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
var paths = require("./npmts.paths"); var paths = require("./npmts.paths");
var helpers = require("./npmts.compile.helpers"); var helpers = require("./npmts.compile.helpers");
@ -12,7 +12,7 @@ var definitionHandler = function (configArg) {
var done = plugins.Q.defer(); var done = plugins.Q.defer();
var configTsLenght = Object.keys(configArg.ts).length; var configTsLenght = Object.keys(configArg.ts).length;
if (configTsLenght == 0) { if (configTsLenght == 0) {
plugins.beautylog.warn("No declaration files found... Are you sure you don't want them?"); plugins.beautylog.warn("No TS file and thus no definitions found!");
done.resolve(configArg); //if there are no definition files, resolve... done.resolve(configArg); //if there are no definition files, resolve...
} }
var localCounter = 0; var localCounter = 0;
@ -32,14 +32,10 @@ var definitionHandler = function (configArg) {
} }
return done.promise; return done.promise;
}; };
exports.run = function (configArg) { var compileTs = function (tsFileArrayArg, tsOptionsArg) {
if (tsOptionsArg === void 0) { tsOptionsArg = {}; }
var done = plugins.Q.defer(); var done = plugins.Q.defer();
var config = configArg;
npmts_promisechain_1.npmtsOra.text("now compiling " + "TypeScript".yellow);
var moduleStream = plugins.merge2({ end: false }); var moduleStream = plugins.merge2({ end: false });
/* -------------------------------------------------
* ----------- compile TypeScript --------------------------
* ----------------------------------------------- */
var tsOptionsDefault = { var tsOptionsDefault = {
declaration: true, declaration: true,
target: "ES5", target: "ES5",
@ -49,30 +45,40 @@ exports.run = function (configArg) {
* merges default ts options with those found in npmts.json * merges default ts options with those found in npmts.json
*/ */
var tsOptions = function (keyArg) { var tsOptions = function (keyArg) {
return plugins.lodashObject.assign(tsOptionsDefault, config.tsOptions); return plugins.lodashObject.assign(tsOptionsDefault, tsOptionsArg);
}; };
for (var keyArg in config.ts) { for (var keyArg in tsFileArrayArg) {
if (helpers.checkOutputPath(config, keyArg)) { if (helpers.checkOutputPath(tsFileArrayArg, keyArg)) {
var tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"]) var tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"])
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated .pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
.pipe(plugins.g.typescript(tsOptions(keyArg))); .pipe(plugins.g.typescript(tsOptions(keyArg)));
var jsStream = tsStream.js var jsStream = tsStream.js
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file .pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
.pipe(plugins.gulp.dest(config.ts[keyArg])); .pipe(plugins.gulp.dest(tsFileArrayArg[keyArg]));
var declarationStream = tsStream.dts var declarationStream = tsStream.dts
.pipe(plugins.gulp.dest(config.ts[keyArg])); .pipe(plugins.gulp.dest(tsFileArrayArg[keyArg]));
moduleStream.add(tsStream, jsStream, declarationStream); moduleStream.add(tsStream, jsStream, declarationStream);
} }
} }
moduleStream.on("queueDrain", function () { moduleStream.on("queueDrain", function () {
moduleStream.on("finish", function () { done.resolve();
plugins.beautylog.ok("compiled TypeScript!"); });
definitionHandler(config) return done.promise;
.then(function () { };
done.resolve(config); 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!");
definitionHandler(config)
.then(function () {
done.resolve(config);
}); });
moduleStream.end();
}); });
/*==================== END TS Compilation =====================*/ /*==================== END TS Compilation =====================*/
return done.promise; return done.promise;

View File

@ -1,5 +1,5 @@
"use strict"; "use strict";
/// <reference path="./typings/main.d.ts" /> require("typings-global");
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
var paths = require("./npmts.paths"); var paths = require("./npmts.paths");
exports.run = function () { exports.run = function () {

View File

@ -1,5 +1,5 @@
"use strict"; "use strict";
/// <reference path="./typings/main.d.ts" /> require("typings-global");
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
var paths = require("./npmts.paths"); var paths = require("./npmts.paths");
var npmts_promisechain_1 = require("./npmts.promisechain"); var npmts_promisechain_1 = require("./npmts.promisechain");
@ -9,7 +9,7 @@ exports.run = function (configArg) {
/* ------------------------------------------------- /* -------------------------------------------------
* ----------- install typings --------------- * ----------- install typings ---------------
* ----------------------------------------------- */ * ----------------------------------------------- */
npmts_promisechain_1.npmtsOra.text("now installing typings"); npmts_promisechain_1.npmtsOra.text("now installing " + "typings".yellow);
var absoluteTypingsArray = plugins.smartpath.transform.toAbsolute(config.typings, paths.cwd); var absoluteTypingsArray = plugins.smartpath.transform.toAbsolute(config.typings, paths.cwd);
plugins.gulp.src(absoluteTypingsArray) plugins.gulp.src(absoluteTypingsArray)
.pipe(plugins.g.typings()) .pipe(plugins.g.typings())

4
dist/npmts.jsdoc.js vendored
View File

@ -1,11 +1,11 @@
"use strict"; "use strict";
/// <reference path="./typings/main.d.ts" /> require("typings-global");
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
var paths = require("./npmts.paths"); var paths = require("./npmts.paths");
var npmts_promisechain_1 = require("./npmts.promisechain"); var npmts_promisechain_1 = require("./npmts.promisechain");
var genJsdoc = function (configArg) { var genJsdoc = function (configArg) {
var done = plugins.Q.defer(); var done = plugins.Q.defer();
npmts_promisechain_1.npmtsOra.text("now generating JsDoc documentation"); npmts_promisechain_1.npmtsOra.text("now generating " + "JsDoc documentation".yellow);
plugins.gulp.src([ plugins.gulp.src([
plugins.path.join(paths.cwd, "README.md"), plugins.path.join(paths.cwd, "README.md"),
plugins.path.join(paths.distDir, "**/*.js") plugins.path.join(paths.distDir, "**/*.js")

21
dist/npmts.options.js vendored
View File

@ -1,5 +1,5 @@
"use strict"; "use strict";
/// <reference path="./typings/main.d.ts" /> require("typings-global");
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
var npmts_promisechain_1 = require("./npmts.promisechain"); var npmts_promisechain_1 = require("./npmts.promisechain");
exports.isCi = function () { exports.isCi = function () {
@ -10,8 +10,13 @@ exports.isRelease = function () {
&& plugins.smartci.check.isTaggedCommit(); && plugins.smartci.check.isTaggedCommit();
}; };
exports.doPublish = function () { exports.doPublish = function () {
return exports.isRelease() try {
&& plugins.smartci.get.subJobNumber() == 1; return exports.isRelease()
&& plugins.smartci.get.subJobNumber() == 1;
}
catch (err) {
return false;
}
}; };
exports.run = function (configArg) { exports.run = function (configArg) {
var done = plugins.Q.defer(); var done = plugins.Q.defer();
@ -24,9 +29,12 @@ exports.run = function (configArg) {
]; ];
config.ts = (_a = {}, config.ts = (_a = {},
_a["./ts/**/*.ts"] = "./dist/", _a["./ts/**/*.ts"] = "./dist/",
_a["./test/test.ts"] = "./test/",
_a _a
); );
config.testTs = (_b = {},
_b["./test/test.ts"] = "./test/",
_b
);
config.test = ["./index.js"]; config.test = ["./index.js"];
} }
//check if config.tsOptions is available //check if config.tsOptions is available
@ -36,9 +44,6 @@ exports.run = function (configArg) {
: plugins.beautylog.info("NOT A RELEASE build!"); : 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!") 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!"); : plugins.beautylog.info("We are not publishing anything!");
// handle coveralls
config.codecov ? void (0) : config.codecov = true;
exports.isCi() ? void (0) : config.codecov = false;
config.coverageTreshold ? void (0) : config.coverageTreshold = 70; config.coverageTreshold ? void (0) : config.coverageTreshold = 70;
// handle docs // handle docs
config.docs ? void (0) : config.docs = {}; config.docs ? void (0) : config.docs = {};
@ -47,5 +52,5 @@ exports.run = function (configArg) {
plugins.beautylog.ok("build options are ready!"); plugins.beautylog.ok("build options are ready!");
done.resolve(config); done.resolve(config);
return done.promise; return done.promise;
var _a; var _a, _b;
}; };

23
dist/npmts.paths.js vendored
View File

@ -1,16 +1,15 @@
"use strict"; "use strict";
/// <reference path="./typings/main.d.ts" /> require("typings-global");
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
var paths = {}; exports.cwd = plugins.smartcli.get.cwd().path;
paths.cwd = plugins.smartcli.get.cwd().path;
//Directories //Directories
paths.tsDir = plugins.path.join(paths.cwd, "ts/"); exports.tsDir = plugins.path.join(exports.cwd, "ts/");
paths.distDir = plugins.path.join(paths.cwd, "dist/"); exports.distDir = plugins.path.join(exports.cwd, "dist/");
paths.docsDir = plugins.path.join(paths.cwd, "docs/"); exports.docsDir = plugins.path.join(exports.cwd, "docs/");
paths.testDir = plugins.path.join(paths.cwd, "test/"); exports.testDir = plugins.path.join(exports.cwd, "test/");
paths.coverageDir = plugins.path.join(paths.cwd, "coverage/"); exports.typingsDir = plugins.path.join(exports.cwd, "ts/typings/");
paths.npmtsAssetsDir = plugins.path.join(__dirname, "../assets/"); exports.coverageDir = plugins.path.join(exports.cwd, "coverage/");
exports.npmtsAssetsDir = plugins.path.join(__dirname, "../assets/");
//Files //Files
paths.indexTS = plugins.path.join(paths.cwd, "ts/index.ts"); exports.indexTS = plugins.path.join(exports.cwd, "ts/index.ts");
paths.testTS = plugins.path.join(paths.cwd, "ts/test.ts"); exports.testTS = plugins.path.join(exports.cwd, "ts/test.ts");
module.exports = paths;

View File

@ -1,10 +1,9 @@
"use strict"; "use strict";
/// <reference path="./typings/main.d.ts" /> require("typings-global");
exports.beautylog = require("beautylog"); 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 = {
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"),

View File

@ -1,5 +1,5 @@
"use strict"; "use strict";
/// <reference path="./typings/main.d.ts" /> require("typings-global");
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
exports.npmtsOra = new plugins.beautylog.Ora("setting up TaskChain", "cyan"); exports.npmtsOra = new plugins.beautylog.Ora("setting up TaskChain", "cyan");
exports.npmtsOra.start(); exports.npmtsOra.start();
@ -43,7 +43,6 @@ exports.promisechain = function () {
plugins.beautylog.success("READY TO SHIP!"); plugins.beautylog.success("READY TO SHIP!");
} }
else { else {
exports.npmtsOra.endOk("Tasks finished!");
plugins.beautylog.success("Done!"); plugins.beautylog.success("Done!");
} }
done.resolve(); done.resolve();

View File

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

16
dist/npmts.tests.js vendored
View File

@ -1,29 +1,20 @@
"use strict"; "use strict";
/// <reference path="./typings/main.d.ts" /> require("typings-global");
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
var paths = require("./npmts.paths"); var paths = require("./npmts.paths");
var npmts_promisechain_1 = require("./npmts.promisechain"); var npmts_promisechain_1 = require("./npmts.promisechain");
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 {*} * @returns {*}
*/ */
var istanbul = function (configArg) { var istanbul = function (configArg) {
npmts_promisechain_1.npmtsOra.text("Instrumentalizing transpiled JS...");
var done = plugins.Q.defer(); var done = plugins.Q.defer();
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()) // Covering files .pipe(plugins.g.istanbul()) // Covering files
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files .pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
.pipe(plugins.g.gFunction(function () { .pipe(plugins.g.gFunction(function () {
plugins.beautylog.ok("JS has been instrumentalized to get test code coverage!");
done.resolve(configArg); done.resolve(configArg);
}, "atEnd")); }, "atEnd"));
return done.promise; return done.promise;
@ -34,6 +25,7 @@ var istanbul = function (configArg) {
*/ */
var mocha = function (configArg) { var mocha = function (configArg) {
var done = plugins.Q.defer(); var done = plugins.Q.defer();
npmts_promisechain_1.npmtsOra.end(); // end npmtsOra for tests.
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()) // Creating the reports after tests ran .pipe(plugins.g.istanbul.writeReports()) // Creating the reports after tests ran

View File

@ -1,6 +1,6 @@
{ {
"name": "npmts", "name": "npmts",
"version": "5.1.7", "version": "5.2.5",
"description": "write npm modules with TypeScript", "description": "write npm modules with TypeScript",
"main": "dist/index.js", "main": "dist/index.js",
"bin": { "bin": {
@ -13,7 +13,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/pushrocks/npmts.git" "url": "git+https://gitlab.com/pushrocks/npmts.git"
}, },
"keywords": [ "keywords": [
"TypeScript", "TypeScript",
@ -22,14 +22,14 @@
"author": "Lossless Digital UG (haftungsbeschraenkt)", "author": "Lossless Digital UG (haftungsbeschraenkt)",
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {
"url": "https://github.com/pushrocks/npmts/issues" "url": "https://gitlab.com/pushrocks/npmts/issues"
}, },
"homepage": "https://github.com/pushrocks/npmts#readme", "homepage": "https://gitlab.com/pushrocks/npmts#readme",
"dependencies": { "dependencies": {
"beautylog": "5.0.4", "beautylog": "5.0.6",
"early": "^2.0.1",
"fs-extra": "^0.30.0", "fs-extra": "^0.30.0",
"gulp": "3.9.1", "gulp": "3.9.1",
"gulp-codecov": "^2.0.1",
"gulp-concat": "^2.6.0", "gulp-concat": "^2.6.0",
"gulp-function": "^1.3.1", "gulp-function": "^1.3.1",
"gulp-if": "^2.0.1", "gulp-if": "^2.0.1",
@ -40,7 +40,7 @@
"gulp-sourcemaps": "^2.0.0-alpha", "gulp-sourcemaps": "^2.0.0-alpha",
"gulp-typescript": "2.13.4", "gulp-typescript": "2.13.4",
"gulp-typings": "2.0.0", "gulp-typings": "2.0.0",
"lodash": "^4.12.0", "lodash": "^4.13.1",
"merge2": "1.0.2", "merge2": "1.0.2",
"projectinfo": "1.0.1", "projectinfo": "1.0.1",
"q": "^1.4.1", "q": "^1.4.1",
@ -49,10 +49,11 @@
"smartcli": "0.0.11", "smartcli": "0.0.11",
"smartcov": "0.0.6", "smartcov": "0.0.6",
"smartenv": "1.2.5", "smartenv": "1.2.5",
"smartfile": "3.0.6", "smartfile": "3.0.10",
"smartpath": "3.2.1", "smartpath": "3.2.1",
"smartstring": "^1.0.3", "smartstring": "^2.0.1",
"source-map-support": "^0.4.0" "source-map-support": "^0.4.0",
"typings-global": "*"
}, },
"devDependencies": {} "devDependencies": {}
} }

View File

@ -1,4 +1,4 @@
/// <reference path="./typings/main.d.ts" /> /// <reference path="./typings/index.d.ts" />
var testplugin = { var testplugin = {
logSomething: function () { logSomething: function () {
console.log("only function executed"); console.log("only function executed");
@ -6,4 +6,4 @@ var testplugin = {
}; };
module.exports = testplugin; module.exports = testplugin;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0QztBQUM1QyxJQUFJLFVBQVUsR0FBRztJQUNiLFlBQVksRUFBRTtRQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQztJQUMxQyxDQUFDO0NBQ0osQ0FBQztBQUNGLE1BQU0sQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxyXG5sZXQgdGVzdHBsdWdpbiA9IHtcclxuICAgIGxvZ1NvbWV0aGluZzogZnVuY3Rpb24oKXtcclxuICAgICAgICBjb25zb2xlLmxvZyhcIm9ubHkgZnVuY3Rpb24gZXhlY3V0ZWRcIik7XHJcbiAgICB9XHJcbn07XHJcbm1vZHVsZS5leHBvcnRzID0gdGVzdHBsdWdpbjsiXX0= //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDZDQUE2QztBQUM3QyxJQUFJLFVBQVUsR0FBRztJQUNiLFlBQVksRUFBRTtRQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQztJQUMxQyxDQUFDO0NBQ0osQ0FBQztBQUNGLE1BQU0sQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9pbmRleC5kLnRzXCIgLz5cbmxldCB0ZXN0cGx1Z2luID0ge1xuICAgIGxvZ1NvbWV0aGluZzogZnVuY3Rpb24oKXtcbiAgICAgICAgY29uc29sZS5sb2coXCJvbmx5IGZ1bmN0aW9uIGV4ZWN1dGVkXCIpO1xuICAgIH1cbn07XG5tb2R1bGUuZXhwb3J0cyA9IHRlc3RwbHVnaW47Il19

View File

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

View File

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

View File

@ -1,4 +1,4 @@
/// <reference path="../ts/typings/main.d.ts" /> /// <reference path="../ts/typings/index.d.ts" />
var testplugin = require("../dist/index.js"); var testplugin = require("../dist/index.js");
describe("testplugins", function () { describe("testplugins", function () {
describe(".logSomething", function () { describe(".logSomething", function () {
@ -8,4 +8,4 @@ describe("testplugins", function () {
}); });
}); });
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzdDLFFBQVEsQ0FBQyxhQUFhLEVBQUM7SUFDbkIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixFQUFFLENBQUMsc0JBQXNCLEVBQUM7WUFDdEIsVUFBVSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQzdCLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cclxudmFyIHRlc3RwbHVnaW4gPSByZXF1aXJlKFwiLi4vZGlzdC9pbmRleC5qc1wiKTtcclxuZGVzY3JpYmUoXCJ0ZXN0cGx1Z2luc1wiLGZ1bmN0aW9uKCl7XHJcbiAgICBkZXNjcmliZShcIi5sb2dTb21ldGhpbmdcIixmdW5jdGlvbigpe1xyXG4gICAgICAgIGl0KFwic2hvdWxkIGxvZyBzb21ldGhpbmdcIixmdW5jdGlvbigpe1xyXG4gICAgICAgICAgICB0ZXN0cGx1Z2luLmxvZ1NvbWV0aGluZygpXHJcbiAgICAgICAgfSk7XHJcbiAgICB9KTtcclxufSk7Il19 //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsaURBQWlEO0FBQ2pELElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzdDLFFBQVEsQ0FBQyxhQUFhLEVBQUM7SUFDbkIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixFQUFFLENBQUMsc0JBQXNCLEVBQUM7WUFDdEIsVUFBVSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQzdCLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvaW5kZXguZC50c1wiIC8+XG52YXIgdGVzdHBsdWdpbiA9IHJlcXVpcmUoXCIuLi9kaXN0L2luZGV4LmpzXCIpO1xuZGVzY3JpYmUoXCJ0ZXN0cGx1Z2luc1wiLGZ1bmN0aW9uKCl7XG4gICAgZGVzY3JpYmUoXCIubG9nU29tZXRoaW5nXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgaXQoXCJzaG91bGQgbG9nIHNvbWV0aGluZ1wiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICB0ZXN0cGx1Z2luLmxvZ1NvbWV0aGluZygpXG4gICAgICAgIH0pO1xuICAgIH0pO1xufSk7Il19

View File

@ -1 +0,0 @@
{"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,4 +1,4 @@
/// <reference path="../ts/typings/main.d.ts" /> /// <reference path="../ts/typings/index.d.ts" />
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,8 +0,0 @@
/// <reference path="./typings/main.d.ts" />
var testplugin = {
logSomething: function () {
console.log("only function executed");
}
};
module.exports = testplugin;
//# sourceMappingURL=index.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,IAAI,UAAU,GAAG;IACb,YAAY,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAC1C,CAAC;CACJ,CAAC;AACF,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC"}

View File

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

View File

@ -1,5 +1,5 @@
{ {
"ambientDependencies": { "globalDependencies": {
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts", "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts",
"mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts", "mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts", "colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts",

View File

@ -1,7 +1,10 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
console.log("**** starting NPMTS ****"); import * as early from "early";
early.start("NPMTS");
import * as plugins from "./npmts.plugins" import * as plugins from "./npmts.plugins"
import {promisechain} from "./npmts.promisechain"; import {promisechain} from "./npmts.promisechain";
early.stop();
plugins.beautylog.figletSync("NPMTS"); plugins.beautylog.figletSync("NPMTS");
try { try {

View File

@ -1,4 +1,4 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths"); import paths = require("./npmts.paths");
import {npmtsOra} from "./npmts.promisechain"; import {npmtsOra} from "./npmts.promisechain";
@ -6,7 +6,7 @@ import {npmtsOra} from "./npmts.promisechain";
export var run = function(configArg){ export var run = function(configArg){
let done = plugins.Q.defer(); let done = plugins.Q.defer();
let config = configArg; let config = configArg;
npmtsOra.text("now looking at required assets"); npmtsOra.text("now looking at " + "required assets".yellow);
if(config.cli == true){ if(config.cli == true){
plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir,"cli.js"),paths.distDir); plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir,"cli.js"),paths.distDir);
plugins.beautylog.ok("installed CLI assets!"); plugins.beautylog.ok("installed CLI assets!");

View File

@ -1,12 +1,30 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths"); import paths = require("./npmts.paths");
import {npmtsOra} from "./npmts.promisechain"; import {npmtsOra} from "./npmts.promisechain";
let removeDist = function(){
npmtsOra.text("cleaning " + "dist".yellow + " folder");
return plugins.smartfile.fsaction.remove(paths.distDir);
};
let removeTypings = function(){
let done = plugins.Q.defer();
npmtsOra.text("cleaning " + "typings".yellow + " folder");
if(false){
//plugins.smartfile.fsaction.remove(paths.typingsDir)
// .then(done.resolve);
} else {
done.resolve();
}
return done.promise;
};
export let run = function(configArg){ export let run = function(configArg){
npmtsOra.text("cleaning up from previous builds..."); npmtsOra.text("cleaning up from previous builds...");
let done = plugins.Q.defer(); let done = plugins.Q.defer();
plugins.smartfile.fsaction.remove(paths.distDir) removeDist()
.then(removeTypings)
.then(function(){ .then(function(){
plugins.beautylog.ok("Cleaned up from previous builds!"); plugins.beautylog.ok("Cleaned up from previous builds!");
done.resolve(configArg); done.resolve(configArg);

View File

@ -1 +1 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";

View File

@ -1,13 +1,13 @@
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths"); import paths = require("./npmts.paths");
let outputPathIsDir = function (configArg,keyArg) { let outputPathIsDir = function (tsArrayArg,keyArg) {
return plugins.smartpath.check.isDir(plugins.path.join(paths.cwd, configArg.ts[keyArg])); return plugins.smartpath.check.isDir(plugins.path.join(paths.cwd, tsArrayArg[keyArg]));
}; };
export let checkOutputPath = function(configArg,keyArg){ export let checkOutputPath = function(tsArrayArg,keyArg){
if(!outputPathIsDir(configArg,keyArg)) { if(!outputPathIsDir(tsArrayArg,keyArg)) {
plugins.beautylog.warn("Skipping " + keyArg + " because " + configArg.ts[keyArg] + " it is no directory!") plugins.beautylog.warn("Skipping " + keyArg + " because " + tsArrayArg[keyArg] + " it is no directory!")
return false return false
} else { } else {
return true; return true;

View File

@ -1,4 +1,4 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths"); import paths = require("./npmts.paths");
import helpers = require("./npmts.compile.helpers"); import helpers = require("./npmts.compile.helpers");
@ -12,7 +12,7 @@ let definitionHandler = function(configArg){
let done = plugins.Q.defer(); let done = plugins.Q.defer();
let configTsLenght = Object.keys(configArg.ts).length; let configTsLenght = Object.keys(configArg.ts).length;
if(configTsLenght == 0) { if(configTsLenght == 0) {
plugins.beautylog.warn("No declaration files found... Are you sure you don't want them?"); plugins.beautylog.warn("No TS file and thus no definitions found!");
done.resolve(configArg); //if there are no definition files, resolve... done.resolve(configArg); //if there are no definition files, resolve...
} }
let localCounter = 0; let localCounter = 0;
@ -33,17 +33,10 @@ let definitionHandler = function(configArg){
return done.promise; return done.promise;
} }
let compileTs = (tsFileArrayArg,tsOptionsArg = {}) => {
export let run = function (configArg) {
let done = plugins.Q.defer(); let done = plugins.Q.defer();
let config = configArg;
npmtsOra.text("now compiling " + "TypeScript".yellow);
let moduleStream = plugins.merge2({ end: false }); let moduleStream = plugins.merge2({ end: false });
/* -------------------------------------------------
* ----------- compile TypeScript --------------------------
* ----------------------------------------------- */
let tsOptionsDefault = { let tsOptionsDefault = {
declaration: true, declaration: true,
target: "ES5", target: "ES5",
@ -54,34 +47,45 @@ export let run = function (configArg) {
* merges default ts options with those found in npmts.json * merges default ts options with those found in npmts.json
*/ */
let tsOptions = function (keyArg:string) { let tsOptions = function (keyArg:string) {
return plugins.lodashObject.assign(tsOptionsDefault, config.tsOptions) return plugins.lodashObject.assign(tsOptionsDefault, tsOptionsArg)
}; };
for (let keyArg in tsFileArrayArg) {
for (let keyArg in config.ts) { if (helpers.checkOutputPath(tsFileArrayArg,keyArg)) {
if (helpers.checkOutputPath(config,keyArg)) {
let tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"]) let tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"])
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated .pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
.pipe(plugins.g.typescript(tsOptions(keyArg))); .pipe(plugins.g.typescript(tsOptions(keyArg)));
let jsStream = tsStream.js let jsStream = tsStream.js
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file .pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
.pipe(plugins.gulp.dest(config.ts[keyArg])); .pipe(plugins.gulp.dest(tsFileArrayArg[keyArg]));
let declarationStream = tsStream.dts let declarationStream = tsStream.dts
.pipe(plugins.gulp.dest(config.ts[keyArg])); .pipe(plugins.gulp.dest(tsFileArrayArg[keyArg]));
moduleStream.add(tsStream,jsStream,declarationStream); moduleStream.add(tsStream,jsStream,declarationStream);
} }
} }
moduleStream.on("queueDrain",() => {
done.resolve();
})
return done.promise;
}
moduleStream.on("queueDrain", function () {
moduleStream.on("finish", function () { export let run = function (configArg) {
let done = plugins.Q.defer();
let config = configArg;
npmtsOra.text("now compiling " + "TypeScript".yellow);
compileTs(config.ts,config.tsOptions)
.then(() => {
compileTs(config.testTs);
})
.then(function () {
plugins.beautylog.ok("compiled TypeScript!"); plugins.beautylog.ok("compiled TypeScript!");
definitionHandler(config) definitionHandler(config)
.then(function(){ .then(function(){
done.resolve(config); done.resolve(config);
}); });
}); });
moduleStream.end();
});
/*==================== END TS Compilation =====================*/ /*==================== END TS Compilation =====================*/

View File

@ -1,4 +1,4 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths"); import paths = require("./npmts.paths");
export var run = function(){ export var run = function(){

View File

@ -1,4 +1,4 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths"); import paths = require("./npmts.paths");
import {npmtsOra} from "./npmts.promisechain"; import {npmtsOra} from "./npmts.promisechain";
@ -9,7 +9,7 @@ export var run = function(configArg){
/* ------------------------------------------------- /* -------------------------------------------------
* ----------- install typings --------------- * ----------- install typings ---------------
* ----------------------------------------------- */ * ----------------------------------------------- */
npmtsOra.text("now installing typings"); npmtsOra.text("now installing " + "typings".yellow);
var absoluteTypingsArray = plugins.smartpath.transform.toAbsolute(config.typings,paths.cwd); var absoluteTypingsArray = plugins.smartpath.transform.toAbsolute(config.typings,paths.cwd);
plugins.gulp.src(absoluteTypingsArray) plugins.gulp.src(absoluteTypingsArray)
.pipe(plugins.g.typings()) .pipe(plugins.g.typings())

View File

@ -1,11 +1,11 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths"); import paths = require("./npmts.paths");
import {npmtsOra} from "./npmts.promisechain"; import {npmtsOra} from "./npmts.promisechain";
let genJsdoc = function(configArg){ let genJsdoc = function(configArg){
let done = plugins.Q.defer(); let done = plugins.Q.defer();
npmtsOra.text("now generating JsDoc documentation"); npmtsOra.text("now generating " + "JsDoc documentation".yellow);
plugins.gulp.src([ plugins.gulp.src([
plugins.path.join(paths.cwd,"README.md"), plugins.path.join(paths.cwd,"README.md"),
plugins.path.join(paths.distDir,"**/*.js") plugins.path.join(paths.distDir,"**/*.js")

View File

@ -1,4 +1,4 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
import {npmtsOra} from "./npmts.promisechain"; import {npmtsOra} from "./npmts.promisechain";
@ -12,8 +12,13 @@ export let isRelease = function():boolean {
}; };
export let doPublish = function():boolean { export let doPublish = function():boolean {
return isRelease() try {
&& plugins.smartci.get.subJobNumber() == 1; return isRelease()
&& plugins.smartci.get.subJobNumber() == 1;
}
catch (err){
return false;
}
}; };
export var run = function(configArg){ export var run = function(configArg){
@ -28,7 +33,9 @@ export var run = function(configArg){
"./ts/typings.json" "./ts/typings.json"
]; ];
config.ts = { config.ts = {
["./ts/**/*.ts"]: "./dist/", ["./ts/**/*.ts"]: "./dist/"
};
config.testTs = {
["./test/test.ts"]: "./test/" ["./test/test.ts"]: "./test/"
}; };
config.test = ["./index.js"]; config.test = ["./index.js"];
@ -44,9 +51,7 @@ export var run = function(configArg){
isRelease() && doPublish() ? plugins.beautylog.info("All right: This is the first subBuild, so this one publishes COVERAGE + DOCS when tests succeed!") 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!"); : plugins.beautylog.info("We are not publishing anything!");
// handle coveralls
config.codecov ? void(0) : config.codecov = true;
isCi() ? void(0) : config.codecov = false;
config.coverageTreshold ? void(0) : config.coverageTreshold = 70; config.coverageTreshold ? void(0) : config.coverageTreshold = 70;

View File

@ -1,19 +1,18 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
var paths:any = {};
paths.cwd = plugins.smartcli.get.cwd().path; export let cwd = plugins.smartcli.get.cwd().path;
//Directories //Directories
paths.tsDir = plugins.path.join(paths.cwd,"ts/"); export let tsDir = plugins.path.join(cwd,"ts/");
paths.distDir = plugins.path.join(paths.cwd,"dist/"); export let distDir = plugins.path.join(cwd,"dist/");
paths.docsDir = plugins.path.join(paths.cwd,"docs/"); export let docsDir = plugins.path.join(cwd,"docs/");
paths.testDir = plugins.path.join(paths.cwd,"test/"); export let testDir = plugins.path.join(cwd,"test/");
paths.coverageDir = plugins.path.join(paths.cwd,"coverage/"); export let typingsDir = plugins.path.join(cwd,"ts/typings/");
export let coverageDir = plugins.path.join(cwd,"coverage/");
paths.npmtsAssetsDir = plugins.path.join(__dirname,"../assets/"); export let npmtsAssetsDir = plugins.path.join(__dirname,"../assets/");
//Files //Files
paths.indexTS = plugins.path.join(paths.cwd,"ts/index.ts"); export let indexTS = plugins.path.join(cwd,"ts/index.ts");
paths.testTS = plugins.path.join(paths.cwd,"ts/test.ts"); export let testTS = plugins.path.join(cwd,"ts/test.ts");
export = paths;

View File

@ -1,9 +1,8 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
export import beautylog = require("beautylog"); export import 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 = {
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"),

View File

@ -1,4 +1,4 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
export let npmtsOra = new plugins.beautylog.Ora("setting up TaskChain","cyan"); export let npmtsOra = new plugins.beautylog.Ora("setting up TaskChain","cyan");
@ -44,8 +44,7 @@ export let promisechain = function(){
console.log(shipString); console.log(shipString);
plugins.beautylog.success("READY TO SHIP!"); plugins.beautylog.success("READY TO SHIP!");
} else { } else {
npmtsOra.endOk("Tasks finished!"); plugins.beautylog.success("Done!");
plugins.beautylog.success("Done!")
} }
done.resolve(); done.resolve();
}); });

View File

@ -1,15 +1,12 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths"); import paths = require("./npmts.paths");
import NpmtsTests = require("./npmts.tests");
import NpmtsJsdoc = require("./npmts.jsdoc"); import NpmtsJsdoc = require("./npmts.jsdoc");
export let run = function(configArg){ export let run = function(configArg){
let done = plugins.Q.defer(); let done = plugins.Q.defer();
let config = configArg; let config = configArg;
let promiseArray = []; let promiseArray = [];
config.codecov ? promiseArray.push(NpmtsTests.publishCoverage(configArg)) : void(0);
config.docs.publish ? promiseArray.push(NpmtsJsdoc.publishDocs(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); promiseArray.length === 0 ? plugins.beautylog.info("Did not publish anything!") : void(0);

View File

@ -1,30 +1,20 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths"); import paths = require("./npmts.paths");
import {npmtsOra} from "./npmts.promisechain"; import {npmtsOra} from "./npmts.promisechain";
export let publishCoverage = function(configArg){
let 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 {*} * @returns {*}
*/ */
let istanbul = function (configArg) { let istanbul = function (configArg) {
npmtsOra.text("Instrumentalizing transpiled JS...");
let done = plugins.Q.defer(); let done = plugins.Q.defer();
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()) // Covering files .pipe(plugins.g.istanbul()) // Covering files
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files .pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
.pipe(plugins.g.gFunction(function(){ .pipe(plugins.g.gFunction(function(){
plugins.beautylog.ok("JS has been instrumentalized to get test code coverage!");
done.resolve(configArg); done.resolve(configArg);
},"atEnd")); },"atEnd"));
return done.promise; return done.promise;
@ -36,6 +26,7 @@ let istanbul = function (configArg) {
*/ */
let mocha = function (configArg) { let mocha = function (configArg) {
let done = plugins.Q.defer(); let done = plugins.Q.defer();
npmtsOra.end(); // end npmtsOra for tests.
let stream = plugins.gulp.src(["./test/test.js"]) let stream = plugins.gulp.src(["./test/test.js"])
.pipe(plugins.g.mocha()) .pipe(plugins.g.mocha())
.pipe(plugins.g.istanbul.writeReports()) // Creating the reports after tests ran .pipe(plugins.g.istanbul.writeReports()) // Creating the reports after tests ran

View File

@ -1,5 +1,5 @@
{ {
"ambientDependencies": { "globalDependencies": {
"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", "istanbul": "registry:dt/istanbul#0.4.0+20160316155526",
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777", "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777",