Compare commits

...

15 Commits

Author SHA1 Message Date
aca85d2ff3 6.0.0 2017-01-15 14:32:32 +01:00
f03c4a45c2 remove TypeDoc 2017-01-15 14:32:28 +01:00
faf55e4e31 5.5.12 2016-12-18 23:14:01 +01:00
b78fe35e88 5.5.11 2016-12-18 21:35:37 +01:00
7ab4561727 add new npmpage 2016-12-18 21:35:23 +01:00
200f44a792 5.5.10 2016-11-25 13:42:53 +01:00
312dc4bd7f remove unnecessary logging 2016-11-25 13:42:46 +01:00
60bed4cb1f 5.5.9 2016-11-25 13:19:02 +01:00
8831a8d173 empty Buffer at end of transpilation 2016-11-25 13:18:59 +01:00
36f540a22e 5.5.8 2016-11-25 13:03:44 +01:00
7e61b49d04 fix 16 file treshold 2016-11-25 13:03:41 +01:00
57aa38af89 5.5.7 2016-11-25 00:52:25 +01:00
12cf37f01f update messages for better feedback 2016-11-25 00:52:17 +01:00
44150f4d83 5.5.6 2016-11-25 00:36:50 +01:00
3fd755691d now catching babel errors 2016-11-25 00:36:44 +01:00
20 changed files with 127 additions and 217 deletions

View File

@ -1,3 +1,4 @@
# standard ci
image: hosttoday/ht-docker-node:npmci image: hosttoday/ht-docker-node:npmci
stages: stages:
@ -50,7 +51,7 @@ pages:
image: hosttoday/ht-docker-node:npmpage image: hosttoday/ht-docker-node:npmpage
stage: pages stage: pages
script: script:
- npmci command npmpage --host gitlab - npmci command npmpage --publish gitlab
only: only:
- tags - tags
artifacts: artifacts:

View File

@ -1,4 +1,3 @@
.idea/
compile/ compile/
coverage/ coverage/
test/ test/

View File

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

46
dist/mod01/index.js vendored
View File

@ -3,52 +3,8 @@
* This module creates TypeScript documentation * This module creates TypeScript documentation
* -------------------------------------------- */ * -------------------------------------------- */
const q = require("q"); const q = require("q");
const paths = require("../npmts.paths");
const npmts_log_1 = require("../npmts.log");
const plugins = require("./mod01.plugins");
const mod00_check_1 = require("../mod00/mod00.check");
let genTypeDoc = function (configArg) {
let done = q.defer();
npmts_log_1.npmtsOra.text('now generating ' + 'TypeDoc documentation'.yellow);
plugins.beautylog.log('TypeDoc Output:');
let localSmartstream = new plugins.smartstream.Smartstream([
plugins.gulp.src(plugins.path.join(paths.tsDir, '**/*.ts')),
plugins.gulpTypedoc({
// TypeScript options (see typescript docs)
module: 'commonjs',
target: 'es6',
includeDeclarations: true,
// Output options (see typedoc docs)
out: paths.pagesApiDir,
json: plugins.path.join(paths.pagesApiDir, 'file.json'),
// TypeDoc options (see typedoc docs)
name: mod00_check_1.projectInfo.name,
readme: plugins.path.join(paths.cwd, 'README.md'),
// theme: "default",
version: true
})
]);
localSmartstream.run().then(() => {
plugins.beautylog.ok('TypeDoc documentation generated!');
done.resolve(configArg);
}, (err) => {
plugins.beautylog.warn('TypeDoc documentation generation failed!');
console.log(err);
done.resolve(configArg);
});
return done.promise;
};
exports.run = function (configArg) { exports.run = function (configArg) {
let done = q.defer(); let done = q.defer();
if (configArg.docs) { done.resolve(configArg);
genTypeDoc(configArg)
.then(() => {
done.resolve(configArg);
});
}
else {
done.resolve(configArg);
}
;
return done.promise; return done.promise;
}; };

View File

@ -1,4 +1 @@
export * from '../npmts.plugins'; export * from '../npmts.plugins';
import * as gulp from 'gulp';
declare let gulpTypedoc: any;
export { gulp, gulpTypedoc };

View File

@ -3,7 +3,3 @@ function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
} }
__export(require("../npmts.plugins")); __export(require("../npmts.plugins"));
const gulp = require("gulp");
exports.gulp = gulp;
let gulpTypedoc = require('gulp-typedoc');
exports.gulpTypedoc = gulpTypedoc;

67
dist/mod02/index.js vendored
View File

@ -14,32 +14,41 @@ let mocha = function (configArg) {
npmts_log_1.npmtsOra.text('Instrumentalizing and testing transpiled JS'); npmts_log_1.npmtsOra.text('Instrumentalizing and testing transpiled JS');
npmts_log_1.npmtsOra.end(); // end npmtsOra for tests. npmts_log_1.npmtsOra.end(); // end npmtsOra for tests.
let done = q.defer(); let done = q.defer();
plugins.gulp.src([plugins.path.join(paths.cwd, 'dist/*.js')]) let coverageSmartstream = new plugins.smartstream.Smartstream([
.pipe(plugins.gulpSourcemaps.init()) plugins.gulp.src([plugins.path.join(paths.cwd, './dist/**/*.js')]),
.pipe(plugins.gulpBabel({ plugins.gulpSourcemaps.init(),
presets: [ plugins.gulpBabel({
require.resolve('babel-preset-es2015') presets: [
] require.resolve('babel-preset-es2015')
})) ]
.pipe(plugins.gulpIstanbul({})) }),
.pipe(plugins.gulpSourcemaps.write()) plugins.gulpIstanbul({}),
.pipe(plugins.gulpInjectModules()) plugins.gulpSourcemaps.write(),
.on('finish', function () { plugins.gulpInjectModules(),
let localSmartstream = new plugins.smartstream.Smartstream([ plugins.through2.obj((file, enc, cb) => {
plugins.gulp.src([plugins.path.join(paths.cwd, 'test/test.js')]), cb();
plugins.gulpBabel({ }, (cb) => {
presets: [ cb();
require.resolve('babel-preset-es2015') })
] ]);
}), let localSmartstream = new plugins.smartstream.Smartstream([
plugins.gulpInjectModules(), plugins.gulp.src([plugins.path.join(paths.cwd, 'test/test.js')]),
plugins.gulpMocha(), plugins.gulpBabel({
plugins.gulpIstanbul.writeReports({ presets: [
dir: plugins.path.join(paths.cwd, './coverage'), require.resolve('babel-preset-es2015')
reporters: ['lcovonly', 'json', 'text', 'text-summary'] ]
}) }),
]); plugins.gulpInjectModules(),
localSmartstream.run() plugins.gulpMocha(),
plugins.gulpIstanbul.writeReports({
dir: plugins.path.join(paths.cwd, './coverage'),
reporters: ['lcovonly', 'json', 'text', 'text-summary']
})
]);
coverageSmartstream.run()
.then(() => {
plugins.beautylog.info('code is now transpiled to ES5, instrumented with istanbul, and injected for mocha!');
return localSmartstream.run()
.then(() => { done.resolve(configArg); }, (err) => { .then(() => { done.resolve(configArg); }, (err) => {
plugins.beautylog.error('Tests failed!'); plugins.beautylog.error('Tests failed!');
console.log(err); console.log(err);
@ -50,6 +59,8 @@ let mocha = function (configArg) {
process.exit(1); process.exit(1);
} }
}); });
}, (err) => {
console.log(err);
}); });
return done.promise; return done.promise;
}; };
@ -80,14 +91,14 @@ exports.run = function (configArg) {
let config = configArg; let config = configArg;
if (config.test === true) { if (config.test === true) {
npmts_log_1.npmtsOra.text('now starting tests'); npmts_log_1.npmtsOra.text('now starting tests');
plugins.beautylog.log('-------------------------------------------------------\n' + plugins.beautylog.log('------------------------------------------------------\n' +
'*************************** TESTS: ***************************\n' + '*************************** TESTS: ***************************\n' +
'--------------------------------------------------------------'); '--------------------------------------------------------------');
mocha(config) mocha(config)
.then(coverage) .then(coverage)
.then(() => { .then(() => {
done.resolve(config); done.resolve(config);
}); }).catch(err => { console.log(err); });
} }
else { else {
npmts_log_1.npmtsOra.end(); npmts_log_1.npmtsOra.end();

View File

@ -4,7 +4,6 @@ export declare type npmtsMode = 'default' | 'custom';
export interface INpmtsConfig { export interface INpmtsConfig {
argv: any; argv: any;
coverageTreshold: number; coverageTreshold: number;
docs: boolean;
mode: npmtsMode; mode: npmtsMode;
test: boolean; test: boolean;
testTs: any; testTs: any;

View File

@ -9,7 +9,6 @@ exports.run = function (argvArg) {
let defaultConfig = { let defaultConfig = {
argv: undefined, argv: undefined,
coverageTreshold: 70, coverageTreshold: 70,
docs: true,
mode: 'default', mode: 'default',
test: true, test: true,
testTs: {}, testTs: {},
@ -50,10 +49,6 @@ exports.run = function (argvArg) {
config.test = false; config.test = false;
} }
; ;
if (config.argv.nodocs) {
config.docs = false;
}
;
if (config.argv.watch) { if (config.argv.watch) {
config.watch = true; config.watch = true;
} }

View File

@ -13,5 +13,6 @@ import * as smartpath from 'smartpath';
import * as smartstream from 'smartstream'; import * as smartstream from 'smartstream';
import * as smartstring from 'smartstring'; import * as smartstring from 'smartstring';
import * as smartsystem from 'smartsystem'; import * as smartsystem from 'smartsystem';
import * as through2 from 'through2';
export declare let sourceMapSupport: any; export declare let sourceMapSupport: any;
export { beautylog, depcheck, lodash, npmextra, projectinfo, path, smartcli, smartcov, smartenv, smartfile, smartpath, smartstream, smartstring, smartsystem }; export { beautylog, depcheck, lodash, npmextra, projectinfo, path, smartcli, smartcov, smartenv, smartfile, smartpath, smartstream, smartstring, smartsystem, through2 };

View File

@ -28,4 +28,6 @@ const smartstring = require("smartstring");
exports.smartstring = smartstring; exports.smartstring = smartstring;
const smartsystem = require("smartsystem"); const smartsystem = require("smartsystem");
exports.smartsystem = smartsystem; exports.smartsystem = smartsystem;
const through2 = require("through2");
exports.through2 = through2;
exports.sourceMapSupport = require('source-map-support').install(); // display errors correctly during testing exports.sourceMapSupport = require('source-map-support').install(); // display errors correctly during testing

View File

@ -20,7 +20,6 @@ with default behaviour.
```json ```json
{ {
"mode":"custom", "mode":"custom",
"docs":false,
"test":true, "test":true,
"npmts":{ "npmts":{
"ts":{ "ts":{
@ -38,7 +37,6 @@ with default behaviour.
| key | default value | description | | key | default value | description |
| --- | --- | --- | | --- | --- | --- |
| `"mode"` | `"default"` | "default" will do default stuff and override , "custom" only does what you specify | | `"mode"` | `"default"` | "default" will do default stuff and override , "custom" only does what you specify |
| `"docs"` | `true` | create docs for your module |
| `"test"` | `true` | test your module | | `"test"` | `true` | test your module |
| `"ts"` | `{"./ts/*.ts":"./","./test/test.ts":"./test/"}` | allows you to define multiple ts portions | | `"ts"` | `{"./ts/*.ts":"./","./test/test.ts":"./test/"}` | allows you to define multiple ts portions |
| `"tsOptions"` | `{"target":"ES5", "declaration":"true"}` | specify options for tsc | | `"tsOptions"` | `{"target":"ES5", "declaration":"true"}` | specify options for tsc |
@ -63,11 +61,6 @@ This is in line with the latest TypeScript best practices.
You can then import plugins via the TypeScript `import` Syntax You can then import plugins via the TypeScript `import` Syntax
and tsc will pick up the declaration file automatically. and tsc will pick up the declaration file automatically.
### TypeDoc
By default TypeDoc will create docs for your module in `./pages/api/` directory.
> Note: Use [npmpage](https://www.npmjs.com/package/npmpage) to build a website for the module.
It also allows you to integrate api docs with a gitbook located in `./docs/`
## Some notes: ## Some notes:
#### Typings for third party modules that do not bundle declaration files #### Typings for third party modules that do not bundle declaration files
NPMTS no longer supports typings.json. Instead use the new TypeScript 2.x approach to typings using the @types/ npm scope. NPMTS no longer supports typings.json. Instead use the new TypeScript 2.x approach to typings using the @types/ npm scope.

View File

@ -4,5 +4,4 @@
1. **Clean:** Clean up from any previous builds (old js files) 1. **Clean:** Clean up from any previous builds (old js files)
1. **Check:** Check project for typings declaration in package.json, unused dependencies and missing dependencies 1. **Check:** Check project for typings declaration in package.json, unused dependencies and missing dependencies
1. **Transpile:** Transpile TypeScript with **inline sourcemaps** and **declaration files** to ES target 1. **Transpile:** Transpile TypeScript with **inline sourcemaps** and **declaration files** to ES target
1. **Documentation:** Create TypeDoc Documentation from TypeScript files
1. **Test:** Babelify ES6 to ES5 on the fly, instrumentalize ES5 JavaScript with istanbul and run tests with Mocha. 1. **Test:** Babelify ES6 to ES5 on the fly, instrumentalize ES5 JavaScript with istanbul and run tests with Mocha.

View File

@ -5,11 +5,13 @@ Write npm modules with TypeScript without hassle. TypeScript ready. Fully ES6.
[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/npmts) [![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/npmts)
[![git](https://push.rocks/assets/repo-button-git.svg)](https://gitlab.com/pushrocks/npmts) [![git](https://push.rocks/assets/repo-button-git.svg)](https://gitlab.com/pushrocks/npmts)
[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/npmts) [![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/npmts)
[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/npmts/gitbook) [![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/npmts/)
## Status for master ## Status for master
[![build status](https://gitlab.com/pushrocks/npmts/badges/master/build.svg)](https://gitlab.com/pushrocks/npmts/commits/master) [![build status](https://gitlab.com/pushrocks/npmts/badges/master/build.svg)](https://gitlab.com/pushrocks/npmts/commits/master)
[![coverage report](https://gitlab.com/pushrocks/npmts/badges/master/coverage.svg)](https://gitlab.com/pushrocks/npmts/commits/master) [![coverage report](https://gitlab.com/pushrocks/npmts/badges/master/coverage.svg)](https://gitlab.com/pushrocks/npmts/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/npmts.svg)](https://www.npmjs.com/package/npmts)
[![docker pulls](https://img.shields.io/docker/pulls/hosttoday/ht-docker-node.svg)](https://hub.docker.com/r/hosttoday/ht-docker-node/)
[![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)
@ -32,11 +34,11 @@ This works on your machine and in CI. There is a prebuild docker image available
[hosttoday/ht-docker-node:npmts on Dockerhub](https://hub.docker.com/r/hosttoday/ht-docker-node/) [hosttoday/ht-docker-node:npmts on Dockerhub](https://hub.docker.com/r/hosttoday/ht-docker-node/)
For further information read the docs: For further information read the docs:
* [1. Intro](https://pushrocks.gitlab.io/npmts/gitbook/index.md) 1. [Intro](https://pushrocks.gitlab.io/npmts/index.html)
* [2. Install](https://pushrocks.gitlab.io/npmts/gitbook/install.md) 2. [Install](https://pushrocks.gitlab.io/npmts/install.html)
* [3. Default Behaviour](https://pushrocks.gitlab.io/npmts/gitbook/default.md) 3. [Default Behaviour](https://pushrocks.gitlab.io/npmts/default.html)
* [4. Configuration](https://pushrocks.gitlab.io/npmts/gitbook/config.md) 4. [Configuration](https://pushrocks.gitlab.io/npmts/config.html)
* [5. Examples](https://pushrocks.gitlab.io/npmts/gitbook/examples.md) 5. [Examples](https://pushrocks.gitlab.io/npmts/examples.html)
* [6. Info](https://pushrocks.gitlab.io/npmts/gitbook/info.md) 6. [Info](https://pushrocks.gitlab.io/npmts/info.html)
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks) [![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)

View File

@ -1,6 +1,6 @@
{ {
"name": "npmts", "name": "npmts",
"version": "5.5.5", "version": "6.0.0",
"description": "Write npm modules with TypeScript without hassle. TypeScript ready. Fully ES6.", "description": "Write npm modules with TypeScript without hassle. TypeScript ready. Fully ES6.",
"main": "dist/index.js", "main": "dist/index.js",
"bin": { "bin": {
@ -10,7 +10,7 @@
"test": "(npm run compile && npm run prepareTest && npm run setupCheck && npm run check && npm run checkVersion && npm run checkNoTest && npm run checkNoDocs)", "test": "(npm run compile && npm run prepareTest && npm run setupCheck && npm run check && npm run checkVersion && npm run checkNoTest && npm run checkNoDocs)",
"testShort": "(npm run compile && npm run check)", "testShort": "(npm run compile && npm run check)",
"prepareTest": "(rm -rf test/)", "prepareTest": "(rm -rf test/)",
"compile": "(rm -r dist/ && tsc)", "compile": "(rm -rf dist/ && tsc)",
"setupCheck": "(git clone https://gitlab.com/sandboxzone/sandbox-npmts.git test/)", "setupCheck": "(git clone https://gitlab.com/sandboxzone/sandbox-npmts.git test/)",
"typedoc": "(typedoc --out ./pages/api --target ES6 ./ts/)", "typedoc": "(typedoc --out ./pages/api --target ES6 ./ts/)",
"npmpage": "(npmpage)", "npmpage": "(npmpage)",
@ -41,41 +41,41 @@
"@types/gulp-sourcemaps": "0.0.29", "@types/gulp-sourcemaps": "0.0.29",
"@types/minimatch": "^2.0.29", "@types/minimatch": "^2.0.29",
"@types/q": "^0.x.x", "@types/q": "^0.x.x",
"@types/shelljs": "^0.3.32", "@types/shelljs": "^0.3.33",
"@types/through2": "^2.0.32",
"babel-preset-es2015": "^6.18.0", "babel-preset-es2015": "^6.18.0",
"beautylog": "6.0.0", "beautylog": "6.0.0",
"depcheck": "^0.6.4", "depcheck": "^0.6.7",
"early": "^2.0.35", "early": "^2.0.35",
"gulp": "3.9.1", "gulp": "3.9.1",
"gulp-babel": "^6.1.2", "gulp-babel": "^6.1.2",
"gulp-function": "^2.2.0", "gulp-function": "^2.2.3",
"gulp-inject-modules": "^1.0.0", "gulp-inject-modules": "^1.0.0",
"gulp-istanbul": "^1.1.1", "gulp-istanbul": "^1.1.1",
"gulp-mocha": "^3.0.1", "gulp-mocha": "^3.0.1",
"gulp-sourcemaps": "^2.2.0", "gulp-sourcemaps": "^2.4.0",
"gulp-typedoc": "^2.0.0", "lodash": "^4.17.4",
"lodash": "^4.16.4",
"npmextra": "^2.0.3", "npmextra": "^2.0.3",
"projectinfo": "1.0.4", "projectinfo": "3.0.1",
"q": "^1.4.1", "q": "^1.4.1",
"shelljs": "^0.7.5", "shelljs": "^0.7.6",
"smartchok": "^1.0.2", "smartchok": "^1.0.4",
"smartcli": "1.0.10", "smartcli": "2.0.1",
"smartcov": "1.0.0", "smartcov": "1.0.0",
"smartenv": "1.2.5", "smartenv": "2.0.0",
"smartfile": "4.1.0", "smartfile": "4.1.2",
"smartpath": "3.2.5", "smartpath": "3.2.7",
"smartstream": "^1.0.5", "smartstream": "^1.0.5",
"smartstring": "^2.0.17", "smartstring": "^2.0.22",
"smartsystem": "^1.0.9", "smartsystem": "^1.0.12",
"source-map-support": "^0.4.5", "source-map-support": "^0.4.8",
"tsn": "^2.0.13", "through2": "^2.0.3",
"typedoc": "^0.5.0", "tsn": "^2.0.14",
"typescript": "next", "typescript": "next",
"typings-global": "^1.0.14" "typings-global": "^1.0.14"
}, },
"devDependencies": { "devDependencies": {
"@types/should": "^8.1.30", "@types/should": "^8.1.30",
"should": "^11.1.1" "should": "^11.1.2"
} }
} }

View File

@ -9,55 +9,8 @@ import { INpmtsConfig } from '../npmts.config'
import * as plugins from './mod01.plugins' import * as plugins from './mod01.plugins'
import { projectInfo } from '../mod00/mod00.check'
let genTypeDoc = function (configArg: INpmtsConfig) {
let done = q.defer()
npmtsOra.text('now generating ' + 'TypeDoc documentation'.yellow)
plugins.beautylog.log('TypeDoc Output:')
let localSmartstream = new plugins.smartstream.Smartstream([
plugins.gulp.src(plugins.path.join(paths.tsDir, '**/*.ts')),
plugins.gulpTypedoc({
// TypeScript options (see typescript docs)
module: 'commonjs',
target: 'es6',
includeDeclarations: true,
// Output options (see typedoc docs)
out: paths.pagesApiDir,
json: plugins.path.join(paths.pagesApiDir, 'file.json'),
// TypeDoc options (see typedoc docs)
name: projectInfo.name,
readme: plugins.path.join(paths.cwd, 'README.md'),
// theme: "default",
version: true
})
])
localSmartstream.run().then(
() => {
plugins.beautylog.ok('TypeDoc documentation generated!')
done.resolve(configArg)
},
(err) => {
plugins.beautylog.warn('TypeDoc documentation generation failed!')
console.log(err)
done.resolve(configArg)
}
)
return done.promise
}
export let run = function (configArg: INpmtsConfig) { export let run = function (configArg: INpmtsConfig) {
let done = q.defer<INpmtsConfig>() let done = q.defer<INpmtsConfig>()
if (configArg.docs) { done.resolve(configArg)
genTypeDoc(configArg)
.then(() => {
done.resolve(configArg)
})
} else {
done.resolve(configArg)
};
return done.promise return done.promise
} }

View File

@ -1,9 +1,2 @@
export * from '../npmts.plugins' export * from '../npmts.plugins'
import * as gulp from 'gulp'
let gulpTypedoc = require('gulp-typedoc')
export {
gulp,
gulpTypedoc
}

View File

@ -17,33 +17,48 @@ let mocha = function (configArg: INpmtsConfig) {
npmtsOra.text('Instrumentalizing and testing transpiled JS') npmtsOra.text('Instrumentalizing and testing transpiled JS')
npmtsOra.end() // end npmtsOra for tests. npmtsOra.end() // end npmtsOra for tests.
let done = q.defer() let done = q.defer()
plugins.gulp.src([plugins.path.join(paths.cwd, 'dist/*.js')])
.pipe(plugins.gulpSourcemaps.init()) let coverageSmartstream = new plugins.smartstream.Smartstream([
.pipe(plugins.gulpBabel({ plugins.gulp.src([plugins.path.join(paths.cwd, './dist/**/*.js')]),
plugins.gulpSourcemaps.init(),
plugins.gulpBabel({
presets: [ presets: [
require.resolve('babel-preset-es2015') require.resolve('babel-preset-es2015')
] ]
})) }),
.pipe(plugins.gulpIstanbul({ plugins.gulpIstanbul({
})) }),
.pipe(plugins.gulpSourcemaps.write()) plugins.gulpSourcemaps.write(),
.pipe(plugins.gulpInjectModules()) plugins.gulpInjectModules(),
.on('finish', function () { plugins.through2.obj(
let localSmartstream = new plugins.smartstream.Smartstream([ (file, enc, cb) => {
plugins.gulp.src([plugins.path.join(paths.cwd, 'test/test.js')]), cb()
plugins.gulpBabel({ },
presets: [ (cb) => {
require.resolve('babel-preset-es2015') cb()
] }
}), )
plugins.gulpInjectModules(), ])
plugins.gulpMocha(),
plugins.gulpIstanbul.writeReports({ let localSmartstream = new plugins.smartstream.Smartstream([
dir: plugins.path.join(paths.cwd, './coverage'), plugins.gulp.src([plugins.path.join(paths.cwd, 'test/test.js')]),
reporters: ['lcovonly', 'json', 'text', 'text-summary'] plugins.gulpBabel({
}) presets: [
]) require.resolve('babel-preset-es2015')
localSmartstream.run() ]
}),
plugins.gulpInjectModules(),
plugins.gulpMocha(),
plugins.gulpIstanbul.writeReports({
dir: plugins.path.join(paths.cwd, './coverage'),
reporters: ['lcovonly', 'json', 'text', 'text-summary']
})
])
coverageSmartstream.run()
.then(
() => {
plugins.beautylog.info('code is now transpiled to ES5, instrumented with istanbul, and injected for mocha!')
return localSmartstream.run()
.then(() => { done.resolve(configArg) }, (err) => { .then(() => { done.resolve(configArg) }, (err) => {
plugins.beautylog.error('Tests failed!') plugins.beautylog.error('Tests failed!')
console.log(err) console.log(err)
@ -53,6 +68,9 @@ let mocha = function (configArg: INpmtsConfig) {
process.exit(1) process.exit(1)
} }
}) })
},
(err) => {
console.log(err)
}) })
return done.promise return done.promise
} }
@ -87,7 +105,7 @@ export let run = function (configArg: INpmtsConfig) {
if (config.test === true) { if (config.test === true) {
npmtsOra.text('now starting tests') npmtsOra.text('now starting tests')
plugins.beautylog.log( plugins.beautylog.log(
'-------------------------------------------------------\n' + '------------------------------------------------------\n' +
'*************************** TESTS: ***************************\n' + '*************************** TESTS: ***************************\n' +
'--------------------------------------------------------------' '--------------------------------------------------------------'
) )
@ -96,7 +114,7 @@ export let run = function (configArg: INpmtsConfig) {
.then(coverage) .then(coverage)
.then(() => { .then(() => {
done.resolve(config) done.resolve(config)
}) }).catch(err => { console.log(err) })
} else { } else {
npmtsOra.end() npmtsOra.end()
done.resolve(config) done.resolve(config)

View File

@ -10,7 +10,6 @@ export type npmtsMode = 'default' | 'custom'
export interface INpmtsConfig { export interface INpmtsConfig {
argv: any, argv: any,
coverageTreshold: number, coverageTreshold: number,
docs: boolean,
mode: npmtsMode, mode: npmtsMode,
test: boolean, test: boolean,
testTs: any, testTs: any,
@ -25,7 +24,6 @@ export var run = function (argvArg) {
let defaultConfig: INpmtsConfig = { let defaultConfig: INpmtsConfig = {
argv: undefined, argv: undefined,
coverageTreshold: 70, coverageTreshold: 70,
docs: true,
mode: 'default', mode: 'default',
test: true, test: true,
testTs: {}, testTs: {},
@ -72,9 +70,6 @@ export var run = function (argvArg) {
if (config.argv.notest) { if (config.argv.notest) {
config.test = false config.test = false
}; };
if (config.argv.nodocs) {
config.docs = false
};
if (config.argv.watch) { if (config.argv.watch) {
config.watch = true config.watch = true
}; };

View File

@ -14,6 +14,7 @@ import * as smartpath from 'smartpath'
import * as smartstream from 'smartstream' import * as smartstream from 'smartstream'
import * as smartstring from 'smartstring' import * as smartstring from 'smartstring'
import * as smartsystem from 'smartsystem' import * as smartsystem from 'smartsystem'
import * as through2 from 'through2'
export let sourceMapSupport = require('source-map-support').install() // display errors correctly during testing export let sourceMapSupport = require('source-map-support').install() // display errors correctly during testing
export { export {
@ -30,5 +31,6 @@ export {
smartpath, smartpath,
smartstream, smartstream,
smartstring, smartstring,
smartsystem smartsystem,
through2
} }