Compare commits

...

43 Commits

Author SHA1 Message Date
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
28e71356ff 5.1.7 2016-05-19 19:52:26 +02:00
962246157c now using latest beautylog with better console support 2016-05-19 19:52:21 +02:00
043f6e8581 fix promisechain 2016-05-19 18:42:23 +02:00
e30dc5d77c compile 2016-05-19 18:37:54 +02:00
e297be6fc2 promisechain now returns promise 2016-05-19 18:36:53 +02:00
659907d280 Update appveyor.yml 2016-05-18 02:33:05 +02:00
50db40d831 Update appveyor.yml 2016-05-18 02:29:51 +02:00
fbf5dce989 Update README.md 2016-05-17 20:13:30 +02:00
b6e418a431 Update appveyor.yml 2016-05-17 20:11:40 +02:00
7f69a5eaab Create appveyor.yml 2016-05-17 20:09:12 +02:00
e1f80ee888 5.1.6 2016-05-17 02:32:53 +02:00
3f261a4fa6 now uses beautylog.ora 2016-05-17 02:32:40 +02:00
e75de7590e 5.1.5 2016-05-01 22:26:14 +02:00
94c0663980 now has uptodate dependencies 2016-05-01 22:26:01 +02:00
995161dd54 5.1.4 2016-05-01 21:16:04 +02:00
29c941044f fixed declaration file issue 2016-05-01 21:15:52 +02:00
42 changed files with 332 additions and 173 deletions

32
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,32 @@
image: hosttoday/ht-docker-node
stages:
- test
- release
testLTS:
stage: test
script:
- npmci install 4
- npm install
- npm test
tags:
- docker
testSTABLE:
stage: test
script:
- npmci install stable
- npm install
- npm test
tags:
- docker
release:
stage: release
script:
- npm -v
only:
- master
tags:
- docker

View File

@ -3,6 +3,7 @@ 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://travis-ci.org/pushrocks/npmts.svg?branch=master)](https://travis-ci.org/pushrocks/npmts)
[![Build status](https://ci.appveyor.com/api/projects/status/iiljwhhcvbuqyvq0?svg=true)](https://ci.appveyor.com/project/philkunz/npmts)
[![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)
@ -10,6 +11,7 @@ Write npm modules with TypeScript without hassle.
## What is NPMTS? ## What is NPMTS?
NPMTS is your friend when it comes to write, test, publish and document NPM modules written in TypeScript. NPMTS is your friend when it comes to write, test, publish and document NPM modules written in TypeScript.
By default NPMTS will **bundle declaration files**. As a result npm module **code completion in editors like Visual Studio Code** works.
There is a docker image available that includes npmts to make CI a breeze: There is a docker image available that includes npmts to make CI a breeze:
[hosttoday/ht-docker-npmg on Dockerhub](https://hub.docker.com/r/hosttoday/ht-docker-npmg/) [hosttoday/ht-docker-npmg on Dockerhub](https://hub.docker.com/r/hosttoday/ht-docker-npmg/)
@ -29,9 +31,7 @@ Then use it in package.json's script section to trigger a build:
} }
``` ```
### Default behaviour ### Default task execution order
**Execution order of tasks**
1. Check config in ./npmts.json 1. Check config in ./npmts.json
1. Clean up from any previous builds (old js files) 1. Clean up from any previous builds (old js files)
@ -51,9 +51,14 @@ the npmts.json is the main config file. You can use it to customize the behaviou
```json ```json
{ {
"mode":"default", "mode":"default",
"codecov":true,
"ts":{ "ts":{
"./customdir/*.ts":"./" "./customdir/*.ts":"./"
}, },
"docs": {
"publish":true,
"destination":"github"
},
"tsOptions":{ "tsOptions":{
"declaration":false, "declaration":false,
"target":"ES6" "target":"ES6"
@ -65,21 +70,18 @@ the npmts.json is the main config file. You can use it to customize the behaviou
"./customdir/typings.json" "./customdir/typings.json"
], ],
"typingsInclude":"auto", "typingsInclude":"auto",
"codecov":true,
"docs": {
"publish":true
},
"cli":true "cli":true
} }
``` ```
| key | description | | key | default value | description |
| --- | --- | | --- | --- | --- |
| codecov | if true, coverage data will be uploaded to codecov when running on travis | | `"codecov"` | `true` | if true, coverage data will be uploaded to codecov when running on travis |
| docs | `{"publish":true, destination:"github"}` lets you control what happens with your module documentation | | `"docs"` | `{"publish":"false"}` | `{"publish":true, destination:"github"}` lets you control what happens with your module documentation |
| mode | "default" will do some defualt stuff, "custom" only does what you specify | | `"mode"` | `"default"` | "default" will do some defualt stuff, "custom" only does what you specify |
| tsOptions | specify options for tsc | | `"tsOptions"` | `{"target":"ES5", "declaration":"true"}` | specify options for tsc |
| | | | `"typings"` | `["./ts/typings.json"]` | allows you to specify multiple locations for typings.json to install. This is needed for modules that do not yet bundle typings |
| `"cli"` | "false" | some modules are designed to be used from cli. If set to true NPMTS will create a cli.js that wires you dist files up for cli use. |
#### 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/`.
@ -121,8 +123,8 @@ Any errors will be shown with reference to their originating source in TypeScrip
thanks to autogenerated source maps. thanks to autogenerated source maps.
## Example Usage in modules: ## Example Usage in modules:
[gulp-typings](https://www.npmjs.com/package/gulp-typings) * [gulp-typings](https://www.npmjs.com/package/gulp-typings)
[gulp-browser](https://www.npmjs.com/package/gulp-typings) * [gulp-browser](https://www.npmjs.com/package/gulp-typings)
> We will add more options over time. > We will add more options over time.

10
appveyor.yml Normal file
View File

@ -0,0 +1,10 @@
environment:
nodejs_version: "4"
install:
- ps: Install-Product node $env:nodejs_version
- npm install
test_script:
- node --version
- npm --version
- npm test
build: off

10
dist/index.js vendored
View File

@ -1,11 +1,13 @@
"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 promisechain = require("./npmts.promisechain"); var npmts_promisechain_1 = require("./npmts.promisechain");
early.stop();
plugins.beautylog.figletSync("NPMTS"); plugins.beautylog.figletSync("NPMTS");
try { try {
promisechain.run(); npmts_promisechain_1.promisechain();
} }
catch (err) { catch (err) {
console.log(err); console.log(err);

View File

@ -1,14 +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 = require("./npmts.paths"); var paths = require("./npmts.paths");
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;
plugins.beautylog.log("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("CLI asset has been installed!"); plugins.beautylog.ok("installed CLI assets!");
done.resolve(config); done.resolve(config);
} }
else { else {

26
dist/npmts.clean.js vendored
View File

@ -1,13 +1,29 @@
"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 (configArg) { var npmts_promisechain_1 = require("./npmts.promisechain");
plugins.beautylog.log("now cleaning up from previous builds..."); 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(); var done = plugins.Q.defer();
plugins.smartfile.fsaction.remove(paths.distDir) npmts_promisechain_1.npmtsOra.text("cleaning " + "typings".yellow + " folder");
if (false) {
}
else {
done.resolve();
}
return done.promise;
};
exports.run = function (configArg) {
npmts_promisechain_1.npmtsOra.text("cleaning up from previous builds...");
var done = plugins.Q.defer();
removeDist()
.then(removeTypings)
.then(function () { .then(function () {
plugins.beautylog.ok("Cleaned up!"); plugins.beautylog.ok("Cleaned up from previous builds!");
done.resolve(configArg); done.resolve(configArg);
}); });
return done.promise; return done.promise;

3
dist/npmts.cli.js vendored
View File

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

45
dist/npmts.compile.js vendored
View File

@ -1,12 +1,41 @@
"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");
var npmts_promisechain_1 = require("./npmts.promisechain");
/**
* handles definition to make them fit for modular use
*/
var definitionHandler = function (configArg) {
npmts_promisechain_1.npmtsOra.text("now making declaration files ready");
var done = plugins.Q.defer();
var configTsLenght = Object.keys(configArg.ts).length;
if (configTsLenght == 0) {
plugins.beautylog.warn("No declaration files found... Are you sure you don't want them?");
done.resolve(configArg); //if there are no definition files, resolve...
}
var localCounter = 0;
for (var key in configArg.ts) {
var distPath = configArg.ts[key];
var stream = plugins.gulp.src(plugins.path.join(distPath, "**/*.d.ts"))
.pipe(plugins.g.replace(plugins.smartstring.typescript.regexReferencePath, ""))
.pipe(plugins.gulp.dest(distPath))
.pipe(plugins.g.gFunction(function () {
localCounter++;
if (localCounter == configTsLenght) {
plugins.beautylog.ok("made declaration files ready!");
done.resolve(configArg);
}
;
}, "atEnd"));
}
return done.promise;
};
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 compiling " + "TypeScript".yellow); npmts_promisechain_1.npmtsOra.text("now compiling " + "TypeScript".yellow);
var moduleStream = plugins.merge2({ end: false }); var moduleStream = plugins.merge2({ end: false });
/* ------------------------------------------------- /* -------------------------------------------------
* ----------- compile TypeScript -------------------------- * ----------- compile TypeScript --------------------------
@ -36,17 +65,13 @@ exports.run = function (configArg) {
} }
} }
moduleStream.on("queueDrain", function () { moduleStream.on("queueDrain", function () {
plugins.beautylog.ok("TypeScript has been compiled!");
moduleStream.on("finish", function () { moduleStream.on("finish", function () {
try { plugins.beautylog.ok("compiled TypeScript!");
if (config.mode = "default") definitionHandler(config)
plugins.fs.copySync(plugins.path.join(paths.cwd, "ts/typings"), plugins.path.join(paths.cwd, "dist/typings")); .then(function () {
}
catch (err) {
plugins.beautylog.warn("failed to copy external typings for full module declaration support");
}
done.resolve(config); done.resolve(config);
}); });
});
moduleStream.end(); moduleStream.end();
}); });
/*==================== END TS Compilation =====================*/ /*==================== END TS Compilation =====================*/

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,19 +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");
exports.run = function (configArg) { exports.run = function (configArg) {
var config = configArg; var config = configArg;
var done = plugins.Q.defer(); var done = plugins.Q.defer();
/* ------------------------------------------------- /* -------------------------------------------------
* ----------- install typings --------------- * ----------- install typings ---------------
* ----------------------------------------------- */ * ----------------------------------------------- */
plugins.beautylog.log("now installing " + "typings".yellow); 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())
.pipe(plugins.g.gFunction(function () { .pipe(plugins.g.gFunction(function () {
plugins.beautylog.ok("typings have been installed!"); plugins.beautylog.ok("typings installed!");
done.resolve(config); done.resolve(config);
}, "atEnd")); }, "atEnd"));
return done.promise; return done.promise;

5
dist/npmts.jsdoc.js vendored
View File

@ -1,10 +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 genJsdoc = function (configArg) { var genJsdoc = function (configArg) {
var done = plugins.Q.defer(); var done = plugins.Q.defer();
plugins.beautylog.log("now generating " + "JsDoc documentation".blue); 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")

10
dist/npmts.options.js vendored
View File

@ -1,6 +1,7 @@
"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");
exports.isCi = function () { exports.isCi = function () {
return plugins.smartci.check.isCi(); return plugins.smartci.check.isCi();
}; };
@ -9,13 +10,18 @@ exports.isRelease = function () {
&& plugins.smartci.check.isTaggedCommit(); && plugins.smartci.check.isTaggedCommit();
}; };
exports.doPublish = function () { exports.doPublish = function () {
try {
return exports.isRelease() return exports.isRelease()
&& plugins.smartci.get.subJobNumber() == 1; && 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();
var config = configArg; var config = configArg;
plugins.beautylog.log("now determining build options..."); npmts_promisechain_1.npmtsOra.text("now determining build options...");
//handle default mode //handle default mode
if (config.mode == "default") { if (config.mode == "default") {
config.typings = [ config.typings = [

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,5 +1,5 @@
"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");
@ -9,6 +9,7 @@ exports.g = {
istanbul: require("gulp-istanbul"), istanbul: require("gulp-istanbul"),
jsdoc3: require("gulp-jsdoc3"), jsdoc3: require("gulp-jsdoc3"),
mocha: require("gulp-mocha"), mocha: require("gulp-mocha"),
replace: require("gulp-replace"),
sourcemaps: require("gulp-sourcemaps"), sourcemaps: require("gulp-sourcemaps"),
typescript: require("gulp-typescript"), typescript: require("gulp-typescript"),
typings: require("gulp-typings") typings: require("gulp-typings")
@ -25,4 +26,5 @@ 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.smartstring = require("smartstring");
exports.sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing exports.sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing

View File

@ -1,6 +1,8 @@
"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.start();
var NpmtsAssets = require("./npmts.assets"); var NpmtsAssets = require("./npmts.assets");
var NpmtsClean = require("./npmts.clean"); var NpmtsClean = require("./npmts.clean");
var NpmtsCompile = require("./npmts.compile"); var NpmtsCompile = require("./npmts.compile");
@ -10,8 +12,8 @@ var NpmtsJsdoc = require("./npmts.jsdoc");
var NpmtsOptions = require("./npmts.options"); var NpmtsOptions = require("./npmts.options");
var NpmtsPublish = require("./npmts.publish"); var NpmtsPublish = require("./npmts.publish");
var NpmtsTests = require("./npmts.tests"); var NpmtsTests = require("./npmts.tests");
exports.run = function () { exports.promisechain = function () {
var promisechain; var done = plugins.Q.defer();
NpmtsConfigFile.run() NpmtsConfigFile.run()
.then(NpmtsOptions.run) .then(NpmtsOptions.run)
.then(NpmtsClean.run) .then(NpmtsClean.run)
@ -43,6 +45,7 @@ exports.run = function () {
else { else {
plugins.beautylog.success("Done!"); plugins.beautylog.success("Done!");
} }
done.resolve();
}); });
return promisechain; 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 NpmtsTests = require("./npmts.tests"); var NpmtsTests = require("./npmts.tests");
var NpmtsJsdoc = require("./npmts.jsdoc"); var NpmtsJsdoc = require("./npmts.jsdoc");

14
dist/npmts.tests.js vendored
View File

@ -1,7 +1,8 @@
"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");
exports.publishCoverage = function (configArg) { exports.publishCoverage = function (configArg) {
var done = plugins.Q.defer(); var done = plugins.Q.defer();
plugins.beautylog.log("now uploading coverage data to codecov.io"); plugins.beautylog.log("now uploading coverage data to codecov.io");
@ -18,11 +19,13 @@ exports.publishCoverage = function (configArg) {
* @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;
@ -33,6 +36,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
@ -63,11 +67,9 @@ var coverage = function (configArg) {
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 starting tests"); npmts_promisechain_1.npmtsOra.text("now starting tests");
console.log("--------------------------------------------------------------\n" + plugins.beautylog.log("-------------------------------------------------------\n" +
"***************************" + "*************************** TESTS: ***************************\n" +
" TESTS: ".blue +
"***************************\n" +
"--------------------------------------------------------------"); "--------------------------------------------------------------");
istanbul(config) istanbul(config)
.then(mocha) .then(mocha)

View File

@ -1,14 +1,15 @@
{ {
"name": "npmts", "name": "npmts",
"version": "5.1.3", "version": "5.1.16",
"description": "write npm modules with TypeScript", "description": "write npm modules with TypeScript",
"main": "dist/index.js", "main": "dist/index.js",
"bin": { "bin": {
"npmts": "dist/cli.js" "npmts": "dist/cli.js"
}, },
"scripts": { "scripts": {
"test": "(cd compile && node compile.js) && (cd test/assets && node ../../dist/index.js)", "test": "(npm run compile && npm run check)",
"release": "(git add -A && git commit -m 'update' && git push origin master && npm version patch && npm publish)" "check": "(cd ./test/assets && node ../../dist/index.js)",
"compile": "(cd compile && node compile.js)"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -25,20 +26,22 @@
}, },
"homepage": "https://github.com/pushrocks/npmts#readme", "homepage": "https://github.com/pushrocks/npmts#readme",
"dependencies": { "dependencies": {
"beautylog": "4.1.2", "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-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.0", "gulp-if": "^2.0.1",
"gulp-istanbul": "^0.10.4", "gulp-istanbul": "^0.10.4",
"gulp-jsdoc3": "^0.2.1", "gulp-jsdoc3": "^0.2.1",
"gulp-mocha": "^2.2.0", "gulp-mocha": "^2.2.0",
"gulp-replace": "^0.5.4",
"gulp-sourcemaps": "^2.0.0-alpha", "gulp-sourcemaps": "^2.0.0-alpha",
"gulp-typescript": "2.13.0", "gulp-typescript": "2.13.4",
"gulp-typings": "1.3.4", "gulp-typings": "2.0.0",
"lodash": "^4.11.1", "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",
@ -46,10 +49,12 @@
"smartci": "0.0.1", "smartci": "0.0.1",
"smartcli": "0.0.11", "smartcli": "0.0.11",
"smartcov": "0.0.6", "smartcov": "0.0.6",
"smartenv": "1.2.2", "smartenv": "1.2.5",
"smartfile": "3.0.5", "smartfile": "3.0.10",
"smartpath": "3.1.5", "smartpath": "3.2.1",
"source-map-support": "^0.4.0" "smartstring": "^2.0.1",
"source-map-support": "^0.4.0",
"typings-global": "*"
}, },
"devDependencies": {} "devDependencies": {}
} }

View File

@ -1,4 +1,3 @@
/// <reference path="typings/main.d.ts" />
declare let testplugin: { declare let testplugin: {
logSomething: () => void; logSomething: () => void;
}; };

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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0QztBQUM1QyxJQUFJLFVBQVUsR0FBRztJQUNiLFlBQVksRUFBRTtRQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQztJQUMxQyxDQUFDO0NBQ0osQ0FBQztBQUNGLE1BQU0sQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxubGV0IHRlc3RwbHVnaW4gPSB7XG4gICAgbG9nU29tZXRoaW5nOiBmdW5jdGlvbigpe1xuICAgICAgICBjb25zb2xlLmxvZyhcIm9ubHkgZnVuY3Rpb24gZXhlY3V0ZWRcIik7XG4gICAgfVxufTtcbm1vZHVsZS5leHBvcnRzID0gdGVzdHBsdWdpbjsiXX0= //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDZDQUE2QztBQUM3QyxJQUFJLFVBQVUsR0FBRztJQUNiLFlBQVksRUFBRTtRQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQztJQUMxQyxDQUFDO0NBQ0osQ0FBQztBQUNGLE1BQU0sQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9pbmRleC5kLnRzXCIgLz5cbmxldCB0ZXN0cGx1Z2luID0ge1xuICAgIGxvZ1NvbWV0aGluZzogZnVuY3Rpb24oKXtcbiAgICAgICAgY29uc29sZS5sb2coXCJvbmx5IGZ1bmN0aW9uIGV4ZWN1dGVkXCIpO1xuICAgIH1cbn07XG5tb2R1bGUuZXhwb3J0cyA9IHRlc3RwbHVnaW47Il19

View File

@ -1,2 +1 @@
/// <reference path="../ts/typings/main.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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzdDLFFBQVEsQ0FBQyxhQUFhLEVBQUM7SUFDbkIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixFQUFFLENBQUMsc0JBQXNCLEVBQUM7WUFDdEIsVUFBVSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQzdCLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbnZhciB0ZXN0cGx1Z2luID0gcmVxdWlyZShcIi4uL2Rpc3QvaW5kZXguanNcIik7XG5kZXNjcmliZShcInRlc3RwbHVnaW5zXCIsZnVuY3Rpb24oKXtcbiAgICBkZXNjcmliZShcIi5sb2dTb21ldGhpbmdcIixmdW5jdGlvbigpe1xuICAgICAgICBpdChcInNob3VsZCBsb2cgc29tZXRoaW5nXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHRlc3RwbHVnaW4ubG9nU29tZXRoaW5nKClcbiAgICAgICAgfSk7XG4gICAgfSk7XG59KTsiXX0= //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsaURBQWlEO0FBQ2pELElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzdDLFFBQVEsQ0FBQyxhQUFhLEVBQUM7SUFDbkIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixFQUFFLENBQUMsc0JBQXNCLEVBQUM7WUFDdEIsVUFBVSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQzdCLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvaW5kZXguZC50c1wiIC8+XG52YXIgdGVzdHBsdWdpbiA9IHJlcXVpcmUoXCIuLi9kaXN0L2luZGV4LmpzXCIpO1xuZGVzY3JpYmUoXCJ0ZXN0cGx1Z2luc1wiLGZ1bmN0aW9uKCl7XG4gICAgZGVzY3JpYmUoXCIubG9nU29tZXRoaW5nXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgaXQoXCJzaG91bGQgbG9nIHNvbWV0aGluZ1wiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICB0ZXN0cGx1Z2luLmxvZ1NvbWV0aGluZygpXG4gICAgICAgIH0pO1xuICAgIH0pO1xufSk7Il19

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,11 +1,14 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
console.log("**** starting NPMTS ****"); import * as early from "early";
import plugins = require("./npmts.plugins"); early.start("NPMTS");
import promisechain = require("./npmts.promisechain"); import * as plugins from "./npmts.plugins"
import {promisechain} from "./npmts.promisechain";
early.stop();
plugins.beautylog.figletSync("NPMTS"); plugins.beautylog.figletSync("NPMTS");
try { try {
promisechain.run(); promisechain();
} }
catch(err){ catch(err){
console.log(err); console.log(err);

View File

@ -1,14 +1,15 @@
/// <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";
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;
plugins.beautylog.log("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("CLI asset has been installed!"); plugins.beautylog.ok("installed CLI assets!");
done.resolve(config); done.resolve(config);
} else { } else {
done.resolve(config); done.resolve(config);

View File

@ -1,13 +1,32 @@
/// <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";
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){
plugins.beautylog.log("now 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!"); plugins.beautylog.ok("Cleaned up from previous builds!");
done.resolve(configArg); done.resolve(configArg);
}); });
return done.promise; return done.promise;

View File

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

View File

@ -1,13 +1,43 @@
/// <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");
import {npmtsOra} from "./npmts.promisechain";
/**
* handles definition to make them fit for modular use
*/
let definitionHandler = function(configArg){
npmtsOra.text("now making declaration files ready");
let done = plugins.Q.defer();
let configTsLenght = Object.keys(configArg.ts).length;
if(configTsLenght == 0) {
plugins.beautylog.warn("No declaration files found... Are you sure you don't want them?");
done.resolve(configArg); //if there are no definition files, resolve...
}
let localCounter = 0;
for (let key in configArg.ts){
let distPath = configArg.ts[key];
let stream = plugins.gulp.src(plugins.path.join(distPath,"**/*.d.ts"))
.pipe(plugins.g.replace(plugins.smartstring.typescript.regexReferencePath,""))
.pipe(plugins.gulp.dest(distPath))
.pipe(plugins.g.gFunction(function(){
localCounter++
if(localCounter == configTsLenght){
plugins.beautylog.ok("made declaration files ready!");
done.resolve(configArg)
};
},"atEnd"));
}
return done.promise;
}
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;
plugins.beautylog.log("now compiling " + "TypeScript".yellow); npmtsOra.text("now compiling " + "TypeScript".yellow);
let moduleStream = plugins.merge2({ end: false }); let moduleStream = plugins.merge2({ end: false });
/* ------------------------------------------------- /* -------------------------------------------------
@ -43,19 +73,13 @@ export let run = function (configArg) {
} }
moduleStream.on("queueDrain", function () { moduleStream.on("queueDrain", function () {
plugins.beautylog.ok("TypeScript has been compiled!");
moduleStream.on("finish", function () { moduleStream.on("finish", function () {
try { plugins.beautylog.ok("compiled TypeScript!");
if(config.mode = "default") plugins.fs.copySync( definitionHandler(config)
plugins.path.join(paths.cwd,"ts/typings"), .then(function(){
plugins.path.join(paths.cwd,"dist/typings")
);
}
catch (err){
plugins.beautylog.warn("failed to copy external typings for full module declaration support");
}
done.resolve(config); done.resolve(config);
}); });
});
moduleStream.end(); 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,18 +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";
export var run = function(configArg){ export var run = function(configArg){
var config = configArg; var config = configArg;
var done = plugins.Q.defer(); var done = plugins.Q.defer();
/* ------------------------------------------------- /* -------------------------------------------------
* ----------- install typings --------------- * ----------- install typings ---------------
* ----------------------------------------------- */ * ----------------------------------------------- */
plugins.beautylog.log("now installing " + "typings".yellow); 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())
.pipe(plugins.g.gFunction(function(){ .pipe(plugins.g.gFunction(function(){
plugins.beautylog.ok("typings have been installed!"); plugins.beautylog.ok("typings installed!");
done.resolve(config); done.resolve(config);
},"atEnd")); },"atEnd"));
return done.promise; return done.promise;

View File

@ -1,10 +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";
let genJsdoc = function(configArg){ let genJsdoc = function(configArg){
let done = plugins.Q.defer(); let done = plugins.Q.defer();
plugins.beautylog.log("now generating " + "JsDoc documentation".blue); 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,5 +1,6 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
import {npmtsOra} from "./npmts.promisechain";
export let isCi = function(){ export let isCi = function(){
return plugins.smartci.check.isCi(); return plugins.smartci.check.isCi();
@ -11,15 +12,20 @@ export let isRelease = function():boolean {
}; };
export let doPublish = function():boolean { export let doPublish = function():boolean {
try {
return isRelease() return isRelease()
&& plugins.smartci.get.subJobNumber() == 1; && plugins.smartci.get.subJobNumber() == 1;
}
catch (err){
return false;
}
}; };
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..."); npmtsOra.text("now determining build options...");
//handle default mode //handle default mode
if (config.mode == "default"){ if (config.mode == "default"){

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,5 +1,5 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global";
export let 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 = {
@ -8,6 +8,7 @@ export let g = {
istanbul: require("gulp-istanbul"), istanbul: require("gulp-istanbul"),
jsdoc3: require("gulp-jsdoc3"), jsdoc3: require("gulp-jsdoc3"),
mocha: require("gulp-mocha"), mocha: require("gulp-mocha"),
replace: require("gulp-replace"),
sourcemaps: require("gulp-sourcemaps"), sourcemaps: require("gulp-sourcemaps"),
typescript: require("gulp-typescript"), typescript: require("gulp-typescript"),
typings: require("gulp-typings") typings: require("gulp-typings")
@ -24,5 +25,6 @@ export let smartcli = require("smartcli");
export let smartcov = require("smartcov"); 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 import smartpath = require("smartpath");
export import smartstring = require("smartstring");
export let sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing export let sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing

View File

@ -1,6 +1,9 @@
/// <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");
npmtsOra.start();
import NpmtsAssets = require("./npmts.assets"); import NpmtsAssets = require("./npmts.assets");
import NpmtsClean = require("./npmts.clean"); import NpmtsClean = require("./npmts.clean");
import NpmtsCompile = require("./npmts.compile"); import NpmtsCompile = require("./npmts.compile");
@ -11,8 +14,8 @@ import NpmtsOptions = require("./npmts.options");
import NpmtsPublish = require("./npmts.publish"); import NpmtsPublish = require("./npmts.publish");
import NpmtsTests = require("./npmts.tests"); import NpmtsTests = require("./npmts.tests");
export var run = function(){ export let promisechain = function(){
var promisechain; let done = plugins.Q.defer();
NpmtsConfigFile.run() NpmtsConfigFile.run()
.then(NpmtsOptions.run) .then(NpmtsOptions.run)
.then(NpmtsClean.run) .then(NpmtsClean.run)
@ -41,9 +44,9 @@ export var run = function(){
console.log(shipString); console.log(shipString);
plugins.beautylog.success("READY TO SHIP!"); plugins.beautylog.success("READY TO SHIP!");
} else { } else {
plugins.beautylog.success("Done!") plugins.beautylog.success("Done!");
} }
done.resolve();
}); });
return promisechain; return done.promise;
}; };

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 NpmtsTests = require("./npmts.tests"); import NpmtsTests = require("./npmts.tests");

View File

@ -1,6 +1,7 @@
/// <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";
export let publishCoverage = function(configArg){ export let publishCoverage = function(configArg){
let done = plugins.Q.defer(); let done = plugins.Q.defer();
@ -19,11 +20,13 @@ export let publishCoverage = function(configArg){
* @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;
@ -35,6 +38,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
@ -71,12 +75,10 @@ export let run = function(configArg) {
let done = plugins.Q.defer(); let done = plugins.Q.defer();
let config = configArg; let config = configArg;
plugins.beautylog.log("now starting tests"); npmtsOra.text("now starting tests");
console.log( plugins.beautylog.log(
"--------------------------------------------------------------\n" + "-------------------------------------------------------\n" +
"***************************" + "*************************** TESTS: ***************************\n" +
" TESTS: ".blue +
"***************************\n" +
"--------------------------------------------------------------" "--------------------------------------------------------------"
); );

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",