Compare commits
74 Commits
Author | SHA1 | Date | |
---|---|---|---|
85ac242627 | |||
9b71872d12 | |||
281595f8c8 | |||
83f03994a9 | |||
01837f8420 | |||
b5735e3721 | |||
0dc45f1414 | |||
9d1c3f7457 | |||
017279730a | |||
0b50b14146 | |||
dfa27c0604 | |||
19e839a282 | |||
647e2ec886 | |||
4e267850bf | |||
a52f6a9e9b | |||
23b0ee1472 | |||
c4d58b047c | |||
403b530a60 | |||
7d6caaafce | |||
8f47b95220 | |||
375d5cdfcc | |||
a3b1391b86 | |||
d2f5a81cfb | |||
2bc2d11a2d | |||
ecf0666103 | |||
ad05144bba | |||
1e77aba991 | |||
bb6c07845c | |||
079b049a10 | |||
94f48afbbd | |||
944e9b227c | |||
b83aaf4abf | |||
51a1dd0b1d | |||
dd9df9f5ee | |||
c109952a22 | |||
b14c79f6ef | |||
66ad3aeeb9 | |||
a6e91c6a7f | |||
f65c09c24e | |||
e8053fa9e1 | |||
759d4031d2 | |||
28e71356ff | |||
962246157c | |||
043f6e8581 | |||
e30dc5d77c | |||
e297be6fc2 | |||
659907d280 | |||
50db40d831 | |||
fbf5dce989 | |||
b6e418a431 | |||
7f69a5eaab | |||
e1f80ee888 | |||
3f261a4fa6 | |||
e75de7590e | |||
94c0663980 | |||
995161dd54 | |||
29c941044f | |||
1dc8b1aeec | |||
a0c83c8f48 | |||
b6e63664bb | |||
88b39213a6 | |||
6dad1c3d85 | |||
7d9b9b2d1d | |||
e3e6a326b5 | |||
3d59f6d393 | |||
07d752449e | |||
ea779add20 | |||
938a7bd872 | |||
45f9674550 | |||
eae983b271 | |||
871990725d | |||
d46bb18893 | |||
d8fb9747cd | |||
53209b18a9 |
28
.gitlab-ci.yml
Normal file
28
.gitlab-ci.yml
Normal file
@ -0,0 +1,28 @@
|
||||
image: hosttoday/ht-docker-node
|
||||
|
||||
stages:
|
||||
- test
|
||||
- release
|
||||
|
||||
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
|
@ -1,6 +1,6 @@
|
||||
.idea/
|
||||
support
|
||||
compile
|
||||
compile/
|
||||
coverage/
|
||||
test/
|
||||
docs/
|
||||
examples
|
||||
|
7
CHANGELOG
Normal file
7
CHANGELOG
Normal 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
4
CONTRIBUTING.md
Normal file
@ -0,0 +1,4 @@
|
||||
# Contribution Guide
|
||||
|
||||
This module is developed on the fabulous GitLab.com:
|
||||
https://gitlab.com/pushrocks/npmts
|
93
README.md
93
README.md
@ -2,7 +2,8 @@
|
||||
Write npm modules with TypeScript without hassle.
|
||||
|
||||
## Status
|
||||
[](https://travis-ci.org/pushrocks/npmts)
|
||||
[](https://gitlab.com/pushrocks/npmts/commits/master)
|
||||
[](https://ci.appveyor.com/project/philkunz/npmts/branch/master)
|
||||
[](https://david-dm.org/pushrocks/npmts)
|
||||
[](https://www.bithound.io/github/pushrocks/npmts/master/dependencies/npm)
|
||||
[](https://www.bithound.io/github/pushrocks/npmts)
|
||||
@ -10,6 +11,10 @@ Write npm modules with TypeScript without hassle.
|
||||
|
||||
## What is NPMTS?
|
||||
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:
|
||||
[hosttoday/ht-docker-npmg on Dockerhub](https://hub.docker.com/r/hosttoday/ht-docker-npmg/)
|
||||
|
||||
### Install
|
||||
First install npmts as dev dependency:
|
||||
@ -26,9 +31,7 @@ Then use it in package.json's script section to trigger a build:
|
||||
}
|
||||
```
|
||||
|
||||
### Default behaviour
|
||||
|
||||
**Execution order of tasks**
|
||||
### Default task execution order
|
||||
|
||||
1. Check config in ./npmts.json
|
||||
1. Clean up from any previous builds (old js files)
|
||||
@ -45,9 +48,51 @@ Then use it in package.json's script section to trigger a build:
|
||||
#### npmts.json
|
||||
the npmts.json is the main config file. You can use it to customize the behaviour of NPMTS.
|
||||
|
||||
```json
|
||||
{
|
||||
"mode":"default",
|
||||
"codecov":{
|
||||
"publish":true,
|
||||
"token":"sometoken"
|
||||
},
|
||||
"ts":{
|
||||
"./customdir/*.ts":"./"
|
||||
},
|
||||
"docs": {
|
||||
"publish":true,
|
||||
"destination":"github"
|
||||
},
|
||||
"tsOptions":{
|
||||
"declaration":false,
|
||||
"target":"ES6"
|
||||
},
|
||||
"typings":[
|
||||
"./ts/typings.json",
|
||||
"./subts1/typings.json",
|
||||
"./subts2/typings.json",
|
||||
"./customdir/typings.json"
|
||||
],
|
||||
"typingsInclude":"auto",
|
||||
"cli":true
|
||||
}
|
||||
```
|
||||
|
||||
| key | default value | description |
|
||||
| --- | --- | --- |
|
||||
| `"codecov"` | `true` | if true, coverage data will be uploaded to codecov when running on travis |
|
||||
| `"docs"` | `{"publish":"false"}` | `{"publish":true, destination:"github"}` lets you control what happens with your module documentation |
|
||||
| `"mode"` | `"default"` | "default" will do some defualt stuff, "custom" only does what you specify |
|
||||
| `"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
|
||||
**npmts** looks for `./ts/typings.json` by default and installs any defined typings to `.ts/typings/`.
|
||||
You can then reference the ./ts/typings/main.d.ts file in any of your TypeScript code.
|
||||
|
||||
> Note: You can reference the typings files in any of your TypeScript code with a
|
||||
`/// <reference path="/some/path/main.d.ts">`
|
||||
We are currently working on a "typingsInclude" option, that will autoload any typings during compilation.
|
||||
tsconfig is NOT supported, since it would render this module useless
|
||||
|
||||
#### TypeScript
|
||||
by default npmts looks for `./ts/*.ts` and `./test/test.ts` that will compile to
|
||||
@ -56,17 +101,20 @@ by default npmts looks for `./ts/*.ts` and `./test/test.ts` that will compile to
|
||||
Use commonjs module system for wiring up files.
|
||||
|
||||
#### Declaration files
|
||||
**npmts** also creates an `index.d.ts` declaration file by default.
|
||||
You can reference it in your package.json like this:
|
||||
**npmts** also creates an `./dist/index.d.ts` declaration file by default.
|
||||
You can reference it in your package.json like this.
|
||||
|
||||
```json
|
||||
"main": "index.js",
|
||||
"typings": "./index.d.ts",
|
||||
"main": "dist/index.js",
|
||||
"typings": ".dist/index.d.ts",
|
||||
```
|
||||
|
||||
This is in line with the latest TypeScript best practices.
|
||||
You can then import plugins via the TypeScript `import` Syntax
|
||||
and tsc will pick up the declaration file automatically.
|
||||
|
||||
> Note: If you don't want declaration files, set tsOptions.declaration to false in npmts.json
|
||||
|
||||
#### Instrumentalize Code
|
||||
npmts instrumentalizes (using istanbul) the created JavaScript code to create a coverage report.
|
||||
|
||||
@ -77,30 +125,13 @@ npmts looks for `.test/test.ts` which will be transpiled to test.js and run with
|
||||
Any errors will be shown with reference to their originating source in TypeScript
|
||||
thanks to autogenerated source maps.
|
||||
|
||||
|
||||
### Custom behaviour
|
||||
Custom behaviour can be achieved through the npmts.json config file at the root of your package.
|
||||
The file must be named **npmts.json**
|
||||
|
||||
```json
|
||||
{
|
||||
"mode":"custom",
|
||||
"ts":{
|
||||
"./customdir/custom.ts":"./customcompiled.js"
|
||||
},
|
||||
"typings":[
|
||||
"./customdir"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
* **mode** can be "default" or "custom"
|
||||
* **ts** You can list as many TypeScript files as you like. The key represents the source TypeScript file, the value the output file.
|
||||
* **typings** is an array of all direcories that have a typings.json present. Uses the new typings tool from npm.
|
||||
## Example Usage in modules:
|
||||
* [gulp-typings](https://www.npmjs.com/package/gulp-typings)
|
||||
* [gulp-browser](https://www.npmjs.com/package/gulp-typings)
|
||||
|
||||
> We will add more options over time.
|
||||
|
||||
### About the authors:
|
||||
## About the authors:
|
||||
[](https://lossless.com/)
|
||||
|
||||
[](https://paypal.me/lossless)
|
||||
[](https://paypal.me/lossless)
|
||||
|
10
appveyor.yml
Normal file
10
appveyor.yml
Normal 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
10
dist/index.js
vendored
@ -1,11 +1,13 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
console.log("**** starting NPMTS ****");
|
||||
require("typings-global");
|
||||
var early = require("early");
|
||||
early.start("NPMTS");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var promisechain = require("./npmts.promisechain");
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
early.stop();
|
||||
plugins.beautylog.figletSync("NPMTS");
|
||||
try {
|
||||
promisechain.run();
|
||||
npmts_promisechain_1.promisechain();
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
|
7
dist/npmts.assets.js
vendored
7
dist/npmts.assets.js
vendored
@ -1,14 +1,15 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
plugins.beautylog.log("now looking at required assets");
|
||||
npmts_promisechain_1.npmtsOra.text("now looking at " + "required assets".yellow);
|
||||
if (config.cli == true) {
|
||||
plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir, "cli.js"), paths.distDir);
|
||||
plugins.beautylog.ok("CLI asset has been installed!");
|
||||
plugins.beautylog.ok("installed CLI assets!");
|
||||
done.resolve(config);
|
||||
}
|
||||
else {
|
||||
|
26
dist/npmts.clean.js
vendored
26
dist/npmts.clean.js
vendored
@ -1,13 +1,29 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
exports.run = function (configArg) {
|
||||
plugins.beautylog.log("now cleaning up from previous builds...");
|
||||
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();
|
||||
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 () {
|
||||
plugins.beautylog.ok("Cleaned up!");
|
||||
plugins.beautylog.ok("Cleaned up from previous builds!");
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
|
3
dist/npmts.cli.js
vendored
3
dist/npmts.cli.js
vendored
@ -1 +1,2 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
|
16
dist/npmts.compile.helpers.js
vendored
Normal file
16
dist/npmts.compile.helpers.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var outputPathIsDir = function (configArg, keyArg) {
|
||||
return plugins.smartpath.check.isDir(plugins.path.join(paths.cwd, configArg.ts[keyArg]));
|
||||
};
|
||||
exports.checkOutputPath = function (configArg, keyArg) {
|
||||
if (!outputPathIsDir(configArg, keyArg)) {
|
||||
plugins.beautylog.warn("Skipping " + keyArg + " because " + configArg.ts[keyArg] + " it is no directory!");
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
;
|
||||
};
|
103
dist/npmts.compile.js
vendored
103
dist/npmts.compile.js
vendored
@ -1,62 +1,79 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var helpers = require("./npmts.compile.helpers");
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
/**
|
||||
* 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) {
|
||||
var done = plugins.Q.defer();
|
||||
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 });
|
||||
/* -------------------------------------------------
|
||||
* ----------- compile TypeScript --------------------------
|
||||
* ----------------------------------------------- */
|
||||
for (var key in config.ts) {
|
||||
var outputPathIsDir;
|
||||
try {
|
||||
if (plugins.fs.statSync(plugins.path.join(paths.cwd, config.ts[key])).isDirectory()) {
|
||||
outputPathIsDir = true;
|
||||
}
|
||||
var tsOptionsDefault = {
|
||||
declaration: true,
|
||||
target: "ES5",
|
||||
module: "commonjs"
|
||||
};
|
||||
/**
|
||||
* merges default ts options with those found in npmts.json
|
||||
*/
|
||||
var tsOptions = function (keyArg) {
|
||||
return plugins.lodashObject.assign(tsOptionsDefault, config.tsOptions);
|
||||
};
|
||||
for (var keyArg in config.ts) {
|
||||
if (helpers.checkOutputPath(config, keyArg)) {
|
||||
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.typescript(tsOptions(keyArg)));
|
||||
var jsStream = tsStream.js
|
||||
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
||||
.pipe(plugins.gulp.dest(config.ts[keyArg]));
|
||||
var declarationStream = tsStream.dts
|
||||
.pipe(plugins.gulp.dest(config.ts[keyArg]));
|
||||
moduleStream.add(tsStream, jsStream, declarationStream);
|
||||
}
|
||||
catch (err) {
|
||||
outputPathIsDir = false;
|
||||
}
|
||||
//do some evaluation of the environment
|
||||
var outputNameSpecified = (!outputPathIsDir
|
||||
&& (plugins.path.extname(config.ts[key]) == ".js"));
|
||||
var outputName = (function () {
|
||||
if (outputNameSpecified) {
|
||||
return plugins.path.basename(config.ts[key]);
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
})();
|
||||
var outputDir = (function () {
|
||||
if (outputNameSpecified) {
|
||||
return plugins.path.dirname(plugins.path.join(paths.cwd, config.ts[key]));
|
||||
}
|
||||
else {
|
||||
return plugins.path.join(paths.cwd, config.ts[key]);
|
||||
}
|
||||
})();
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, key), "!**/typings/**"])
|
||||
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
||||
.pipe(plugins.g.typescript({
|
||||
out: outputName,
|
||||
target: "ES5",
|
||||
module: "commonjs"
|
||||
}))
|
||||
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
||||
.pipe(plugins.gulp.dest(outputDir));
|
||||
moduleStream.add(stream);
|
||||
}
|
||||
moduleStream.on("queueDrain", function () {
|
||||
plugins.beautylog.ok("TypeScript has been compiled!");
|
||||
moduleStream.on("finish", function () {
|
||||
done.resolve(config);
|
||||
plugins.beautylog.ok("compiled TypeScript!");
|
||||
definitionHandler(config)
|
||||
.then(function () {
|
||||
done.resolve(config);
|
||||
});
|
||||
});
|
||||
moduleStream.end();
|
||||
});
|
||||
/*==================== END TYPESCRIPT =====================*/
|
||||
/*==================== END TS Compilation =====================*/
|
||||
return done.promise;
|
||||
};
|
||||
|
2
dist/npmts.configfile.js
vendored
2
dist/npmts.configfile.js
vendored
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
exports.run = function () {
|
||||
|
7
dist/npmts.install.js
vendored
7
dist/npmts.install.js
vendored
@ -1,19 +1,20 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
exports.run = function (configArg) {
|
||||
var config = configArg;
|
||||
var done = plugins.Q.defer();
|
||||
/* -------------------------------------------------
|
||||
* ----------- 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);
|
||||
plugins.gulp.src(absoluteTypingsArray)
|
||||
.pipe(plugins.g.typings())
|
||||
.pipe(plugins.g.gFunction(function () {
|
||||
plugins.beautylog.ok("typings have been installed!");
|
||||
plugins.beautylog.ok("typings installed!");
|
||||
done.resolve(config);
|
||||
}, "atEnd"));
|
||||
return done.promise;
|
||||
|
5
dist/npmts.jsdoc.js
vendored
5
dist/npmts.jsdoc.js
vendored
@ -1,10 +1,11 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
var genJsdoc = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
plugins.beautylog.log("now generating " + "JsDoc documentation".blue);
|
||||
npmts_promisechain_1.npmtsOra.text("now generating " + "JsDoc documentation".yellow);
|
||||
plugins.gulp.src([
|
||||
plugins.path.join(paths.cwd, "README.md"),
|
||||
plugins.path.join(paths.distDir, "**/*.js")
|
||||
|
23
dist/npmts.options.js
vendored
23
dist/npmts.options.js
vendored
@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
exports.isCi = function () {
|
||||
return plugins.smartci.check.isCi();
|
||||
};
|
||||
@ -9,13 +10,18 @@ exports.isRelease = function () {
|
||||
&& plugins.smartci.check.isTaggedCommit();
|
||||
};
|
||||
exports.doPublish = function () {
|
||||
return exports.isRelease()
|
||||
&& plugins.smartci.get.subJobNumber() == 1;
|
||||
try {
|
||||
return exports.isRelease()
|
||||
&& plugins.smartci.get.subJobNumber() == 1;
|
||||
}
|
||||
catch (err) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
plugins.beautylog.log("now determining build options...");
|
||||
npmts_promisechain_1.npmtsOra.text("now determining build options...");
|
||||
//handle default mode
|
||||
if (config.mode == "default") {
|
||||
config.typings = [
|
||||
@ -28,14 +34,17 @@ exports.run = function (configArg) {
|
||||
);
|
||||
config.test = ["./index.js"];
|
||||
}
|
||||
//check if config.tsOptions is available
|
||||
config.tsOptions ? void (0) : config.tsOptions = {};
|
||||
// handle state of current build
|
||||
exports.isRelease() ? plugins.beautylog.info("All right: This is 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!")
|
||||
: plugins.beautylog.info("We are not publishing anything!");
|
||||
// handle coveralls
|
||||
config.codecov ? void (0) : config.codecov = true;
|
||||
exports.isCi() ? void (0) : config.codecov = false;
|
||||
// handle codecov
|
||||
config.codecov ? void (0) : config.codecov = {};
|
||||
config.codecov.publish ? void (0) : config.codecov.publish = false;
|
||||
exports.isCi() && (process.env.TRAVIS || config.codecov.token) ? void (0) : config.codecov = false;
|
||||
config.coverageTreshold ? void (0) : config.coverageTreshold = 70;
|
||||
// handle docs
|
||||
config.docs ? void (0) : config.docs = {};
|
||||
|
23
dist/npmts.paths.js
vendored
23
dist/npmts.paths.js
vendored
@ -1,16 +1,15 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = {};
|
||||
paths.cwd = plugins.smartcli.get.cwd().path;
|
||||
exports.cwd = plugins.smartcli.get.cwd().path;
|
||||
//Directories
|
||||
paths.tsDir = plugins.path.join(paths.cwd, "ts/");
|
||||
paths.distDir = plugins.path.join(paths.cwd, "dist/");
|
||||
paths.docsDir = plugins.path.join(paths.cwd, "docs/");
|
||||
paths.testDir = plugins.path.join(paths.cwd, "test/");
|
||||
paths.coverageDir = plugins.path.join(paths.cwd, "coverage/");
|
||||
paths.npmtsAssetsDir = plugins.path.join(__dirname, "../assets/");
|
||||
exports.tsDir = plugins.path.join(exports.cwd, "ts/");
|
||||
exports.distDir = plugins.path.join(exports.cwd, "dist/");
|
||||
exports.docsDir = plugins.path.join(exports.cwd, "docs/");
|
||||
exports.testDir = plugins.path.join(exports.cwd, "test/");
|
||||
exports.typingsDir = plugins.path.join(exports.cwd, "ts/typings/");
|
||||
exports.coverageDir = plugins.path.join(exports.cwd, "coverage/");
|
||||
exports.npmtsAssetsDir = plugins.path.join(__dirname, "../assets/");
|
||||
//Files
|
||||
paths.indexTS = plugins.path.join(paths.cwd, "ts/index.ts");
|
||||
paths.testTS = plugins.path.join(paths.cwd, "ts/test.ts");
|
||||
module.exports = paths;
|
||||
exports.indexTS = plugins.path.join(exports.cwd, "ts/index.ts");
|
||||
exports.testTS = plugins.path.join(exports.cwd, "ts/test.ts");
|
||||
|
7
dist/npmts.plugins.js
vendored
7
dist/npmts.plugins.js
vendored
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
require("typings-global");
|
||||
exports.beautylog = require("beautylog");
|
||||
exports.fs = require("fs-extra");
|
||||
exports.gulp = require("gulp");
|
||||
@ -9,10 +9,12 @@ exports.g = {
|
||||
istanbul: require("gulp-istanbul"),
|
||||
jsdoc3: require("gulp-jsdoc3"),
|
||||
mocha: require("gulp-mocha"),
|
||||
replace: require("gulp-replace"),
|
||||
sourcemaps: require("gulp-sourcemaps"),
|
||||
typescript: require("gulp-typescript"),
|
||||
typings: require("gulp-typings")
|
||||
};
|
||||
exports.lodashObject = require('lodash/fp/object');
|
||||
exports.merge2 = require("merge2");
|
||||
exports.projectinfo = require("projectinfo");
|
||||
exports.path = require("path");
|
||||
@ -24,4 +26,5 @@ exports.smartcov = require("smartcov");
|
||||
exports.smartenv = require("smartenv");
|
||||
exports.smartfile = require("smartfile");
|
||||
exports.smartpath = require("smartpath");
|
||||
exports.sourceMapSupport = require("source-map-support").install();
|
||||
exports.smartstring = require("smartstring");
|
||||
exports.sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing
|
||||
|
11
dist/npmts.promisechain.js
vendored
11
dist/npmts.promisechain.js
vendored
@ -1,6 +1,8 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
exports.npmtsOra = new plugins.beautylog.Ora("setting up TaskChain", "cyan");
|
||||
exports.npmtsOra.start();
|
||||
var NpmtsAssets = require("./npmts.assets");
|
||||
var NpmtsClean = require("./npmts.clean");
|
||||
var NpmtsCompile = require("./npmts.compile");
|
||||
@ -10,8 +12,8 @@ var NpmtsJsdoc = require("./npmts.jsdoc");
|
||||
var NpmtsOptions = require("./npmts.options");
|
||||
var NpmtsPublish = require("./npmts.publish");
|
||||
var NpmtsTests = require("./npmts.tests");
|
||||
exports.run = function () {
|
||||
var promisechain;
|
||||
exports.promisechain = function () {
|
||||
var done = plugins.Q.defer();
|
||||
NpmtsConfigFile.run()
|
||||
.then(NpmtsOptions.run)
|
||||
.then(NpmtsClean.run)
|
||||
@ -43,6 +45,7 @@ exports.run = function () {
|
||||
else {
|
||||
plugins.beautylog.success("Done!");
|
||||
}
|
||||
done.resolve();
|
||||
});
|
||||
return promisechain;
|
||||
return done.promise;
|
||||
};
|
||||
|
17
dist/npmts.publish.js
vendored
17
dist/npmts.publish.js
vendored
@ -1,13 +1,24 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var NpmtsTests = require("./npmts.tests");
|
||||
var paths = require("./npmts.paths");
|
||||
var NpmtsJsdoc = require("./npmts.jsdoc");
|
||||
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;
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
var promiseArray = [];
|
||||
config.codecov ? promiseArray.push(NpmtsTests.publishCoverage(configArg)) : void (0);
|
||||
config.codecov.publish ? promiseArray.push(exports.publishCoverage(configArg)) : void (0);
|
||||
config.docs.publish ? promiseArray.push(NpmtsJsdoc.publishDocs(configArg)) : void (0);
|
||||
promiseArray.length === 0 ? plugins.beautylog.info("Did not publish anything!") : void (0);
|
||||
plugins.Q.all(promiseArray).then(done.resolve);
|
||||
|
25
dist/npmts.tests.js
vendored
25
dist/npmts.tests.js
vendored
@ -1,28 +1,20 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
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;
|
||||
};
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
/**
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
var istanbul = function (configArg) {
|
||||
npmts_promisechain_1.npmtsOra.text("Instrumentalizing transpiled JS...");
|
||||
var done = plugins.Q.defer();
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "dist/*.js")])
|
||||
.pipe(plugins.g.istanbul()) // Covering files
|
||||
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
|
||||
.pipe(plugins.g.gFunction(function () {
|
||||
plugins.beautylog.ok("JS has been instrumentalized to get test code coverage!");
|
||||
done.resolve(configArg);
|
||||
}, "atEnd"));
|
||||
return done.promise;
|
||||
@ -33,6 +25,7 @@ var istanbul = function (configArg) {
|
||||
*/
|
||||
var mocha = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
npmts_promisechain_1.npmtsOra.end(); // end npmtsOra for tests.
|
||||
var stream = plugins.gulp.src(["./test/test.js"])
|
||||
.pipe(plugins.g.mocha())
|
||||
.pipe(plugins.g.istanbul.writeReports()) // Creating the reports after tests ran
|
||||
@ -63,11 +56,9 @@ var coverage = function (configArg) {
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
plugins.beautylog.log("now starting tests");
|
||||
console.log("--------------------------------------------------------------\n" +
|
||||
"***************************" +
|
||||
" TESTS: ".blue +
|
||||
"***************************\n" +
|
||||
npmts_promisechain_1.npmtsOra.text("now starting tests");
|
||||
plugins.beautylog.log("-------------------------------------------------------\n" +
|
||||
"*************************** TESTS: ***************************\n" +
|
||||
"--------------------------------------------------------------");
|
||||
istanbul(config)
|
||||
.then(mocha)
|
||||
|
46
package.json
46
package.json
@ -1,18 +1,19 @@
|
||||
{
|
||||
"name": "npmts",
|
||||
"version": "5.0.0",
|
||||
"version": "5.1.19",
|
||||
"description": "write npm modules with TypeScript",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
"npmts": "dist/cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "(cd compile && node compile.js) && (cd test/assets && node ../../dist/index.js)",
|
||||
"release": "(git add -A && git commit -m 'update' && git push origin master && npm version patch && npm publish)"
|
||||
"test": "(npm run compile && npm run check)",
|
||||
"check": "(cd ./test/assets && node ../../dist/index.js)",
|
||||
"compile": "(cd compile && node compile.js)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/pushrocks/npmts.git"
|
||||
"url": "git+https://gitlab.com/pushrocks/npmts.git"
|
||||
},
|
||||
"keywords": [
|
||||
"TypeScript",
|
||||
@ -21,34 +22,39 @@
|
||||
"author": "Lossless Digital UG (haftungsbeschraenkt)",
|
||||
"license": "MIT",
|
||||
"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": {
|
||||
"beautylog": "4.0.0",
|
||||
"fs-extra": "^0.26.7",
|
||||
"beautylog": "5.0.6",
|
||||
"early": "^2.0.1",
|
||||
"fs-extra": "^0.30.0",
|
||||
"gulp": "3.9.1",
|
||||
"gulp-codecov": "^2.0.1",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-function": "^1.2.0",
|
||||
"gulp-if": "^2.0.0",
|
||||
"gulp-istanbul": "^0.10.3",
|
||||
"gulp-function": "^1.3.1",
|
||||
"gulp-if": "^2.0.1",
|
||||
"gulp-istanbul": "^0.10.4",
|
||||
"gulp-jsdoc3": "^0.2.1",
|
||||
"gulp-mocha": "^2.2.0",
|
||||
"gulp-sourcemaps": "^1.6.0",
|
||||
"gulp-typescript": "2.12.2",
|
||||
"gulp-typings": "1.3.0",
|
||||
"gulp-replace": "^0.5.4",
|
||||
"gulp-sourcemaps": "^2.0.0-alpha",
|
||||
"gulp-typescript": "2.13.4",
|
||||
"gulp-typings": "2.0.0",
|
||||
"lodash": "^4.13.1",
|
||||
"merge2": "1.0.2",
|
||||
"projectinfo": "1.0.1",
|
||||
"q": "^1.4.1",
|
||||
"shelljs": "^0.6.0",
|
||||
"shelljs": "^0.7.0",
|
||||
"smartci": "0.0.1",
|
||||
"smartcli": "0.0.11",
|
||||
"smartcov": "0.0.4",
|
||||
"smartenv": "1.2.1",
|
||||
"smartfile": "2.3.0",
|
||||
"smartpath": "3.1.1",
|
||||
"source-map-support": "^0.4.0"
|
||||
"smartcov": "0.0.6",
|
||||
"smartenv": "1.2.5",
|
||||
"smartfile": "3.0.10",
|
||||
"smartpath": "3.2.1",
|
||||
"smartstring": "^2.0.1",
|
||||
"source-map-support": "^0.4.0",
|
||||
"typings-global": "*"
|
||||
},
|
||||
"devDependencies": {}
|
||||
}
|
||||
|
3
test/assets/dist/index.d.ts
vendored
Normal file
3
test/assets/dist/index.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
declare let testplugin: {
|
||||
logSomething: () => void;
|
||||
};
|
4
test/assets/dist/index.js
vendored
4
test/assets/dist/index.js
vendored
@ -1,4 +1,4 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
/// <reference path="./typings/index.d.ts" />
|
||||
var testplugin = {
|
||||
logSomething: function () {
|
||||
console.log("only function executed");
|
||||
@ -6,4 +6,4 @@ var testplugin = {
|
||||
};
|
||||
module.exports = testplugin;
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0QztBQUM1QyxJQUFJLFVBQVUsR0FBRztJQUNiLFlBQVksRUFBRTtRQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQztJQUMxQyxDQUFDO0NBQ0osQ0FBQztBQUNGLE1BQU0sQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxubGV0IHRlc3RwbHVnaW4gPSB7XG4gICAgbG9nU29tZXRoaW5nOiBmdW5jdGlvbigpe1xuICAgICAgICBjb25zb2xlLmxvZyhcIm9ubHkgZnVuY3Rpb24gZXhlY3V0ZWRcIik7XG4gICAgfVxufTtcbm1vZHVsZS5leHBvcnRzID0gdGVzdHBsdWdpbjsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDZDQUE2QztBQUM3QyxJQUFJLFVBQVUsR0FBRztJQUNiLFlBQVksRUFBRTtRQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQztJQUMxQyxDQUFDO0NBQ0osQ0FBQztBQUNGLE1BQU0sQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9pbmRleC5kLnRzXCIgLz5cclxubGV0IHRlc3RwbHVnaW4gPSB7XHJcbiAgICBsb2dTb21ldGhpbmc6IGZ1bmN0aW9uKCl7XHJcbiAgICAgICAgY29uc29sZS5sb2coXCJvbmx5IGZ1bmN0aW9uIGV4ZWN1dGVkXCIpO1xyXG4gICAgfVxyXG59O1xyXG5tb2R1bGUuZXhwb3J0cyA9IHRlc3RwbHVnaW47Il19
|
||||
|
@ -3,13 +3,15 @@
|
||||
"ts":{
|
||||
"./customdir/*.ts":"./"
|
||||
},
|
||||
"tsOptions":{
|
||||
"target":"ES5"
|
||||
},
|
||||
"typings":[
|
||||
"./ts/typings.json",
|
||||
"./subts1/typings.json",
|
||||
"./subts2/typings.json",
|
||||
"./customdir/typings.json"
|
||||
],
|
||||
"codecov":true,
|
||||
"docs": {
|
||||
"publish":true
|
||||
},
|
||||
|
1
test/assets/test/test.d.ts
vendored
Normal file
1
test/assets/test/test.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
declare var testplugin: any;
|
@ -1,4 +1,4 @@
|
||||
/// <reference path="../ts/typings/main.d.ts" />
|
||||
/// <reference path="../ts/typings/index.d.ts" />
|
||||
var testplugin = require("../dist/index.js");
|
||||
describe("testplugins", function () {
|
||||
describe(".logSomething", function () {
|
||||
@ -8,4 +8,4 @@ describe("testplugins", function () {
|
||||
});
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzdDLFFBQVEsQ0FBQyxhQUFhLEVBQUM7SUFDbkIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixFQUFFLENBQUMsc0JBQXNCLEVBQUM7WUFDdEIsVUFBVSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQzdCLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbnZhciB0ZXN0cGx1Z2luID0gcmVxdWlyZShcIi4uL2Rpc3QvaW5kZXguanNcIik7XG5kZXNjcmliZShcInRlc3RwbHVnaW5zXCIsZnVuY3Rpb24oKXtcbiAgICBkZXNjcmliZShcIi5sb2dTb21ldGhpbmdcIixmdW5jdGlvbigpe1xuICAgICAgICBpdChcInNob3VsZCBsb2cgc29tZXRoaW5nXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHRlc3RwbHVnaW4ubG9nU29tZXRoaW5nKClcbiAgICAgICAgfSk7XG4gICAgfSk7XG59KTsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsaURBQWlEO0FBQ2pELElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzdDLFFBQVEsQ0FBQyxhQUFhLEVBQUM7SUFDbkIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixFQUFFLENBQUMsc0JBQXNCLEVBQUM7WUFDdEIsVUFBVSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQzdCLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvaW5kZXguZC50c1wiIC8+XHJcbnZhciB0ZXN0cGx1Z2luID0gcmVxdWlyZShcIi4uL2Rpc3QvaW5kZXguanNcIik7XHJcbmRlc2NyaWJlKFwidGVzdHBsdWdpbnNcIixmdW5jdGlvbigpe1xyXG4gICAgZGVzY3JpYmUoXCIubG9nU29tZXRoaW5nXCIsZnVuY3Rpb24oKXtcclxuICAgICAgICBpdChcInNob3VsZCBsb2cgc29tZXRoaW5nXCIsZnVuY3Rpb24oKXtcclxuICAgICAgICAgICAgdGVzdHBsdWdpbi5sb2dTb21ldGhpbmcoKVxyXG4gICAgICAgIH0pO1xyXG4gICAgfSk7XHJcbn0pOyJdfQ==
|
||||
|
@ -1,4 +1,4 @@
|
||||
/// <reference path="../ts/typings/main.d.ts" />
|
||||
/// <reference path="../ts/typings/index.d.ts" />
|
||||
var testplugin = require("../dist/index.js");
|
||||
describe("testplugins",function(){
|
||||
describe(".logSomething",function(){
|
||||
|
@ -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
|
@ -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"}
|
@ -1,4 +1,4 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
/// <reference path="./typings/index.d.ts" />
|
||||
let testplugin = {
|
||||
logSomething: function(){
|
||||
console.log("only function executed");
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"globalDependencies": {
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts",
|
||||
"mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
|
||||
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts",
|
||||
|
13
ts/index.ts
13
ts/index.ts
@ -1,11 +1,14 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
console.log("**** starting NPMTS ****");
|
||||
import plugins = require("./npmts.plugins");
|
||||
import promisechain = require("./npmts.promisechain");
|
||||
import "typings-global";
|
||||
import * as early from "early";
|
||||
early.start("NPMTS");
|
||||
import * as plugins from "./npmts.plugins"
|
||||
import {promisechain} from "./npmts.promisechain";
|
||||
early.stop();
|
||||
|
||||
plugins.beautylog.figletSync("NPMTS");
|
||||
|
||||
try {
|
||||
promisechain.run();
|
||||
promisechain();
|
||||
}
|
||||
catch(err){
|
||||
console.log(err);
|
||||
|
@ -1,14 +1,15 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
import {npmtsOra} from "./npmts.promisechain";
|
||||
|
||||
export var run = function(configArg){
|
||||
let done = plugins.Q.defer();
|
||||
let config = configArg;
|
||||
plugins.beautylog.log("now looking at required assets");
|
||||
npmtsOra.text("now looking at " + "required assets".yellow);
|
||||
if(config.cli == true){
|
||||
plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir,"cli.js"),paths.distDir);
|
||||
plugins.beautylog.ok("CLI asset has been installed!");
|
||||
plugins.beautylog.ok("installed CLI assets!");
|
||||
done.resolve(config);
|
||||
} else {
|
||||
done.resolve(config);
|
||||
|
@ -1,13 +1,32 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
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){
|
||||
plugins.beautylog.log("now cleaning up from previous builds...");
|
||||
npmtsOra.text("cleaning up from previous builds...");
|
||||
let done = plugins.Q.defer();
|
||||
plugins.smartfile.fsaction.remove(paths.distDir)
|
||||
removeDist()
|
||||
.then(removeTypings)
|
||||
.then(function(){
|
||||
plugins.beautylog.ok("Cleaned up!");
|
||||
plugins.beautylog.ok("Cleaned up from previous builds!");
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
|
@ -1 +1 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import "typings-global";
|
15
ts/npmts.compile.helpers.ts
Normal file
15
ts/npmts.compile.helpers.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
|
||||
let outputPathIsDir = function (configArg,keyArg) {
|
||||
return plugins.smartpath.check.isDir(plugins.path.join(paths.cwd, configArg.ts[keyArg]));
|
||||
};
|
||||
|
||||
export let checkOutputPath = function(configArg,keyArg){
|
||||
if(!outputPathIsDir(configArg,keyArg)) {
|
||||
plugins.beautylog.warn("Skipping " + keyArg + " because " + configArg.ts[keyArg] + " it is no directory!")
|
||||
return false
|
||||
} else {
|
||||
return true;
|
||||
};
|
||||
}
|
@ -1,67 +1,88 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
export var run = function(configArg){
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
plugins.beautylog.log("now compiling " + "TypeScript".yellow);
|
||||
var moduleStream = plugins.merge2({end: false});
|
||||
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) {
|
||||
let done = plugins.Q.defer();
|
||||
let config = configArg;
|
||||
npmtsOra.text("now compiling " + "TypeScript".yellow);
|
||||
let moduleStream = plugins.merge2({ end: false });
|
||||
|
||||
/* -------------------------------------------------
|
||||
* ----------- compile TypeScript --------------------------
|
||||
* ----------------------------------------------- */
|
||||
for (var key in config.ts) {
|
||||
var outputPathIsDir:boolean;
|
||||
try {
|
||||
if(plugins.fs.statSync(plugins.path.join(paths.cwd,config.ts[key])).isDirectory()){
|
||||
outputPathIsDir = true;
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
outputPathIsDir = false;
|
||||
}
|
||||
//do some evaluation of the environment
|
||||
var outputNameSpecified:boolean = (
|
||||
!outputPathIsDir
|
||||
&& (plugins.path.extname(config.ts[key]) == ".js")
|
||||
);
|
||||
var outputName = (function(){
|
||||
if(outputNameSpecified){
|
||||
return plugins.path.basename(config.ts[key])
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
})();
|
||||
var outputDir = (function(){
|
||||
if(outputNameSpecified){
|
||||
return plugins.path.dirname(
|
||||
plugins.path.join(paths.cwd,config.ts[key])
|
||||
)
|
||||
} else {
|
||||
return plugins.path.join(paths.cwd,config.ts[key])
|
||||
}
|
||||
})();
|
||||
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,key),"!**/typings/**"])
|
||||
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
||||
.pipe(plugins.g.typescript({
|
||||
out: outputName,
|
||||
target: "ES5",
|
||||
module: "commonjs"
|
||||
}))
|
||||
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
||||
//.pipe(plugins.g.header('#!/usr/bin/env node\n\n'))
|
||||
.pipe(plugins.gulp.dest(outputDir));
|
||||
moduleStream.add(stream);
|
||||
let tsOptionsDefault = {
|
||||
declaration: true,
|
||||
target: "ES5",
|
||||
module: "commonjs"
|
||||
};
|
||||
|
||||
/**
|
||||
* merges default ts options with those found in npmts.json
|
||||
*/
|
||||
let tsOptions = function (keyArg:string) {
|
||||
return plugins.lodashObject.assign(tsOptionsDefault, config.tsOptions)
|
||||
};
|
||||
|
||||
for (let keyArg in config.ts) {
|
||||
if (helpers.checkOutputPath(config,keyArg)) {
|
||||
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.typescript(tsOptions(keyArg)));
|
||||
|
||||
let jsStream = tsStream.js
|
||||
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
||||
.pipe(plugins.gulp.dest(config.ts[keyArg]));
|
||||
let declarationStream = tsStream.dts
|
||||
.pipe(plugins.gulp.dest(config.ts[keyArg]));
|
||||
moduleStream.add(tsStream,jsStream,declarationStream);
|
||||
}
|
||||
}
|
||||
moduleStream.on("queueDrain",function(){
|
||||
plugins.beautylog.ok("TypeScript has been compiled!");
|
||||
moduleStream.on("finish",function(){
|
||||
done.resolve(config);
|
||||
|
||||
moduleStream.on("queueDrain", function () {
|
||||
moduleStream.on("finish", function () {
|
||||
plugins.beautylog.ok("compiled TypeScript!");
|
||||
definitionHandler(config)
|
||||
.then(function(){
|
||||
done.resolve(config);
|
||||
});
|
||||
});
|
||||
moduleStream.end();
|
||||
});
|
||||
/*==================== END TYPESCRIPT =====================*/
|
||||
/*==================== END TS Compilation =====================*/
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
export var run = function(){
|
||||
|
@ -1,18 +1,20 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
import {npmtsOra} from "./npmts.promisechain";
|
||||
|
||||
export var run = function(configArg){
|
||||
var config = configArg;
|
||||
var done = plugins.Q.defer();
|
||||
/* -------------------------------------------------
|
||||
* ----------- 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);
|
||||
plugins.gulp.src(absoluteTypingsArray)
|
||||
.pipe(plugins.g.typings())
|
||||
.pipe(plugins.g.gFunction(function(){
|
||||
plugins.beautylog.ok("typings have been installed!");
|
||||
plugins.beautylog.ok("typings installed!");
|
||||
done.resolve(config);
|
||||
},"atEnd"));
|
||||
return done.promise;
|
||||
|
@ -1,10 +1,11 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
import {npmtsOra} from "./npmts.promisechain";
|
||||
|
||||
let genJsdoc = function(configArg){
|
||||
let done = plugins.Q.defer();
|
||||
plugins.beautylog.log("now generating " + "JsDoc documentation".blue);
|
||||
npmtsOra.text("now generating " + "JsDoc documentation".yellow);
|
||||
plugins.gulp.src([
|
||||
plugins.path.join(paths.cwd,"README.md"),
|
||||
plugins.path.join(paths.distDir,"**/*.js")
|
||||
|
@ -1,5 +1,6 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
import {npmtsOra} from "./npmts.promisechain";
|
||||
|
||||
export let isCi = function(){
|
||||
return plugins.smartci.check.isCi();
|
||||
@ -11,15 +12,20 @@ export let isRelease = function():boolean {
|
||||
};
|
||||
|
||||
export let doPublish = function():boolean {
|
||||
return isRelease()
|
||||
&& plugins.smartci.get.subJobNumber() == 1;
|
||||
try {
|
||||
return isRelease()
|
||||
&& plugins.smartci.get.subJobNumber() == 1;
|
||||
}
|
||||
catch (err){
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
export var run = function(configArg){
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
|
||||
plugins.beautylog.log("now determining build options...");
|
||||
npmtsOra.text("now determining build options...");
|
||||
|
||||
//handle default mode
|
||||
if (config.mode == "default"){
|
||||
@ -32,6 +38,9 @@ export var run = function(configArg){
|
||||
};
|
||||
config.test = ["./index.js"];
|
||||
}
|
||||
|
||||
//check if config.tsOptions is available
|
||||
config.tsOptions ? void(0) : config.tsOptions = {};
|
||||
|
||||
// handle state of current build
|
||||
|
||||
@ -40,9 +49,11 @@ 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!")
|
||||
: plugins.beautylog.info("We are not publishing anything!");
|
||||
|
||||
// handle coveralls
|
||||
config.codecov ? void(0) : config.codecov = true;
|
||||
isCi() ? void(0) : config.codecov = false;
|
||||
// handle codecov
|
||||
config.codecov ? void(0) : config.codecov = {};
|
||||
config.codecov.publish ? void(0) : config.codecov.publish = false;
|
||||
isCi() && (process.env.TRAVIS || config.codecov.token) ? void(0) : config.codecov = false;
|
||||
|
||||
|
||||
config.coverageTreshold ? void(0) : config.coverageTreshold = 70;
|
||||
|
||||
|
@ -1,19 +1,18 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
var paths:any = {};
|
||||
paths.cwd = plugins.smartcli.get.cwd().path;
|
||||
|
||||
export let cwd = plugins.smartcli.get.cwd().path;
|
||||
|
||||
//Directories
|
||||
paths.tsDir = plugins.path.join(paths.cwd,"ts/");
|
||||
paths.distDir = plugins.path.join(paths.cwd,"dist/");
|
||||
paths.docsDir = plugins.path.join(paths.cwd,"docs/");
|
||||
paths.testDir = plugins.path.join(paths.cwd,"test/");
|
||||
paths.coverageDir = plugins.path.join(paths.cwd,"coverage/");
|
||||
export let tsDir = plugins.path.join(cwd,"ts/");
|
||||
export let distDir = plugins.path.join(cwd,"dist/");
|
||||
export let docsDir = plugins.path.join(cwd,"docs/");
|
||||
export let testDir = plugins.path.join(cwd,"test/");
|
||||
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
|
||||
paths.indexTS = plugins.path.join(paths.cwd,"ts/index.ts");
|
||||
paths.testTS = plugins.path.join(paths.cwd,"ts/test.ts");
|
||||
|
||||
export = paths;
|
||||
export let indexTS = plugins.path.join(cwd,"ts/index.ts");
|
||||
export let testTS = plugins.path.join(cwd,"ts/test.ts");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
export let beautylog = require("beautylog");
|
||||
import "typings-global";
|
||||
export import beautylog = require("beautylog");
|
||||
export let fs = require("fs-extra");
|
||||
export let gulp = require("gulp");
|
||||
export let g = {
|
||||
@ -8,11 +8,13 @@ export let g = {
|
||||
istanbul: require("gulp-istanbul"),
|
||||
jsdoc3: require("gulp-jsdoc3"),
|
||||
mocha: require("gulp-mocha"),
|
||||
replace: require("gulp-replace"),
|
||||
sourcemaps: require("gulp-sourcemaps"),
|
||||
typescript: require("gulp-typescript"),
|
||||
typings: require("gulp-typings")
|
||||
|
||||
};
|
||||
export let lodashObject = require('lodash/fp/object');
|
||||
export let merge2 = require("merge2");
|
||||
export let projectinfo = require("projectinfo");
|
||||
export let path = require("path");
|
||||
@ -23,5 +25,6 @@ export let smartcli = require("smartcli");
|
||||
export let smartcov = require("smartcov");
|
||||
export let smartenv = require("smartenv");
|
||||
export let smartfile = require("smartfile");
|
||||
export let smartpath = require("smartpath");
|
||||
export let sourceMapSupport = require("source-map-support").install();
|
||||
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
|
@ -1,6 +1,9 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
|
||||
export let npmtsOra = new plugins.beautylog.Ora("setting up TaskChain","cyan");
|
||||
npmtsOra.start();
|
||||
|
||||
import NpmtsAssets = require("./npmts.assets");
|
||||
import NpmtsClean = require("./npmts.clean");
|
||||
import NpmtsCompile = require("./npmts.compile");
|
||||
@ -11,8 +14,8 @@ import NpmtsOptions = require("./npmts.options");
|
||||
import NpmtsPublish = require("./npmts.publish");
|
||||
import NpmtsTests = require("./npmts.tests");
|
||||
|
||||
export var run = function(){
|
||||
var promisechain;
|
||||
export let promisechain = function(){
|
||||
let done = plugins.Q.defer();
|
||||
NpmtsConfigFile.run()
|
||||
.then(NpmtsOptions.run)
|
||||
.then(NpmtsClean.run)
|
||||
@ -41,9 +44,9 @@ export var run = function(){
|
||||
console.log(shipString);
|
||||
plugins.beautylog.success("READY TO SHIP!");
|
||||
} else {
|
||||
plugins.beautylog.success("Done!")
|
||||
plugins.beautylog.success("Done!");
|
||||
}
|
||||
|
||||
done.resolve();
|
||||
});
|
||||
return promisechain;
|
||||
return done.promise;
|
||||
};
|
@ -1,15 +1,25 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
import NpmtsTests = require("./npmts.tests");
|
||||
import NpmtsJsdoc = require("./npmts.jsdoc");
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
export let run = function(configArg){
|
||||
let done = plugins.Q.defer();
|
||||
let config = configArg;
|
||||
let promiseArray = [];
|
||||
config.codecov ? promiseArray.push(NpmtsTests.publishCoverage(configArg)) : void(0);
|
||||
config.codecov.publish ? promiseArray.push(publishCoverage(configArg)) : void(0);
|
||||
config.docs.publish ? promiseArray.push(NpmtsJsdoc.publishDocs(configArg)) : void(0);
|
||||
promiseArray.length === 0 ? plugins.beautylog.info("Did not publish anything!") : void(0);
|
||||
|
||||
|
@ -1,29 +1,20 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
|
||||
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;
|
||||
};
|
||||
import {npmtsOra} from "./npmts.promisechain";
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
let istanbul = function (configArg) {
|
||||
npmtsOra.text("Instrumentalizing transpiled JS...");
|
||||
let done = plugins.Q.defer();
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"dist/*.js")])
|
||||
.pipe(plugins.g.istanbul()) // Covering files
|
||||
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
|
||||
.pipe(plugins.g.gFunction(function(){
|
||||
plugins.beautylog.ok("JS has been instrumentalized to get test code coverage!");
|
||||
done.resolve(configArg);
|
||||
},"atEnd"));
|
||||
return done.promise;
|
||||
@ -35,6 +26,7 @@ let istanbul = function (configArg) {
|
||||
*/
|
||||
let mocha = function (configArg) {
|
||||
let done = plugins.Q.defer();
|
||||
npmtsOra.end(); // end npmtsOra for tests.
|
||||
let stream = plugins.gulp.src(["./test/test.js"])
|
||||
.pipe(plugins.g.mocha())
|
||||
.pipe(plugins.g.istanbul.writeReports()) // Creating the reports after tests ran
|
||||
@ -71,12 +63,10 @@ export let run = function(configArg) {
|
||||
let done = plugins.Q.defer();
|
||||
let config = configArg;
|
||||
|
||||
plugins.beautylog.log("now starting tests");
|
||||
console.log(
|
||||
"--------------------------------------------------------------\n" +
|
||||
"***************************" +
|
||||
" TESTS: ".blue +
|
||||
"***************************\n" +
|
||||
npmtsOra.text("now starting tests");
|
||||
plugins.beautylog.log(
|
||||
"-------------------------------------------------------\n" +
|
||||
"*************************** TESTS: ***************************\n" +
|
||||
"--------------------------------------------------------------"
|
||||
);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"globalDependencies": {
|
||||
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts#09e37435ffb2c56a6f908081194a74756f24f99d",
|
||||
"istanbul": "registry:dt/istanbul#0.4.0+20160316155526",
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777",
|
||||
|
Reference in New Issue
Block a user