Compare commits

...

81 Commits

Author SHA1 Message Date
f99605da8f 6.1.15 2017-02-27 23:52:30 +01:00
508aa23e59 6.1.14 2017-02-27 23:52:04 +01:00
ce7f28404a update projectinfo 2017-02-27 23:52:02 +01:00
237b084411 6.1.14 2017-02-27 23:51:02 +01:00
bc6a7ae1da update projectinfo 2017-02-27 23:50:59 +01:00
31fdd4c0a7 6.1.13 2017-02-27 22:19:22 +01:00
c820350bb6 updated dependencies 2017-02-27 22:19:14 +01:00
92bf6d7bab fix README 2017-02-05 11:33:44 +01:00
e77bece3fc fix README 2017-02-05 11:32:50 +01:00
df96486d2f 6.1.12 2017-02-05 11:27:38 +01:00
980db3eb28 fix git links 2017-02-05 11:15:36 +01:00
34d3d4d963 fix README 2017-02-05 11:14:25 +01:00
a3c02cad4e update README to reflect gitzone 2017-02-05 10:15:26 +01:00
a12190638d 6.1.11 2017-02-02 21:48:12 +01:00
f2a36e7a45 update README 2017-02-02 21:48:09 +01:00
60c025e638 6.1.10 2017-02-02 20:57:52 +01:00
5d16734c00 shift to push.rocks brand 2017-02-02 20:57:46 +01:00
65fe421de1 6.1.9 2017-01-21 23:23:03 +01:00
d94d66ef19 update beautylog 2017-01-21 23:23:00 +01:00
3e4ac03a63 6.1.8 2017-01-21 20:45:35 +01:00
0948fa806c update deps 2017-01-21 20:45:32 +01:00
53980160df 6.1.7 2017-01-21 19:59:22 +01:00
886f1ae6f4 update dependencies 2017-01-21 19:59:20 +01:00
4602e7e3c9 6.1.6 2017-01-21 19:37:32 +01:00
1dbb5f6f36 update dependencies 2017-01-21 19:37:29 +01:00
1023bf9f3c 6.1.5 2017-01-20 18:42:05 +01:00
78bebcda25 fix testing for rxjs 2017-01-20 18:38:02 +01:00
74deee70a3 6.1.4 2017-01-18 01:04:22 +01:00
019864a484 remove shelljs 2017-01-18 01:04:19 +01:00
80db0fc581 6.1.3 2017-01-18 00:58:16 +01:00
9a25b4ef91 remove q in favour of smartq 2017-01-18 00:58:09 +01:00
9f42a20e4b Merge branch 'master' into 'master'
add ES2015.iterable

See merge request !1
2017-01-17 17:42:21 +00:00
dbb8fd0fff add ES2015.iterable 2017-01-17 16:47:19 +01:00
4368713ad5 6.1.2 2017-01-15 21:45:12 +01:00
58cea5cb48 fix lib inclusion for tests 2017-01-15 21:45:08 +01:00
329e0dc101 6.1.1 2017-01-15 20:12:26 +01:00
da45d002a3 some fixes for es5 transpilation 2017-01-15 20:12:12 +01:00
59e811247f remove unused dep 2017-01-15 20:06:07 +01:00
7bcd2f4f5d 6.1.0 2017-01-15 20:01:15 +01:00
78d77c003c remove babel and instead use typescript 2017-01-15 20:01:10 +01:00
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
00983205ce 5.5.5 2016-11-22 18:54:56 +01:00
a0b1b1847c improve README 2016-11-22 18:54:35 +01:00
be9e98ad0c 5.5.4 2016-11-22 18:52:48 +01:00
84578e8dd0 update README 2016-11-22 18:51:51 +01:00
6d759706ac 5.5.3 2016-10-27 21:59:24 +02:00
2bd4063d22 speed bump 2016-10-27 21:59:19 +02:00
c274590184 5.5.2 2016-10-22 02:38:59 +02:00
de8992da84 fix some minor issues 2016-10-22 02:38:55 +02:00
dc598e1627 5.5.1 2016-10-22 01:34:11 +02:00
bfcd78b169 fix version display 2016-10-22 01:34:07 +02:00
2352456be1 5.5.0 2016-10-21 17:51:19 +02:00
8e4a4e5766 now modularized, implements #11 2016-10-21 17:48:52 +02:00
4f93ef3fb2 update dependencies 2016-10-20 22:57:32 +02:00
69742fd6a7 moved cli into its own file 2016-10-06 21:03:30 +02:00
d7b08034da 5.4.49 2016-10-05 12:59:46 +02:00
349c6cce77 fix 2016-10-05 12:59:30 +02:00
4770b1e349 5.4.48 2016-10-05 12:37:48 +02:00
7043a844f0 fix cli 2016-10-05 12:37:45 +02:00
5f4a8d3ee5 5.4.47 2016-10-05 12:27:34 +02:00
0b6fc610e8 made cli.js path discovery smarter 2016-10-05 12:27:30 +02:00
3d78bf268d 5.4.46 2016-10-03 12:45:56 +02:00
36887512ee 5.4.45 2016-10-03 12:38:56 +02:00
fb7025d7ec 5.4.44 2016-10-02 20:35:17 +02:00
8dcdad9e2c some more es6 module syntax 2016-10-02 20:35:13 +02:00
1898db5472 5.4.43 2016-09-29 16:25:29 +02:00
1f01bee204 fix README 2016-09-29 16:25:16 +02:00
82 changed files with 4395 additions and 748 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

View File

@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2016 Push.Rocks Copyright (c) 2016 Lossless GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -2,17 +2,19 @@
Write npm modules with TypeScript without hassle. TypeScript ready. Fully ES6. Write npm modules with TypeScript without hassle. TypeScript ready. Fully ES6.
## Availabililty ## Availabililty
[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/npmts) [![npm](https://gitzone.gitlab.io/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://gitzone.gitlab.io/assets/repo-button-git.svg)](https://gitlab.com/gitzone/npmts)
[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/npmts) [![git](https://gitzone.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/gitzonetools/npmts)
[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/npmts/) [![docs](https://gitzone.gitlab.io/assets/repo-button-docs.svg)](https://gitzone.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/gitzone/npmts/badges/master/build.svg)](https://gitlab.com/gitzone/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/gitzone/npmts/badges/master/coverage.svg)](https://gitlab.com/gitzone/npmts/commits/master)
[![Dependency Status](https://david-dm.org/pushrocks/npmts.svg)](https://david-dm.org/pushrocks/npmts) [![npm downloads per month](https://img.shields.io/npm/dm/npmts.svg)](https://www.npmjs.com/package/npmts)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/npmts/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/npmts/master/dependencies/npm) [![docker pulls](https://img.shields.io/docker/pulls/hosttoday/ht-docker-node.svg)](https://hub.docker.com/r/hosttoday/ht-docker-node/)
[![bitHound Code](https://www.bithound.io/github/pushrocks/npmts/badges/code.svg)](https://www.bithound.io/github/pushrocks/npmts) [![Dependency Status](https://david-dm.org/gitzonetools/npmts.svg)](https://david-dm.org/gitzonetools/npmts)
[![bitHound Dependencies](https://www.bithound.io/github/gitzonetools/npmts/badges/dependencies.svg)](https://www.bithound.io/github/gitzonetools/npmts/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/gitzonetools/npmts/badges/code.svg)](https://www.bithound.io/github/gitzonetools/npmts)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) [![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) [![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
@ -22,21 +24,16 @@ NPMTS is your friend when writing, testing, publishing and documenting npm modul
npmts will npmts will
1. check your dependencies and package.json 1. check your dependencies and package.json (unused, missing, updates, security)
1. transpile your code with tsc, 1. transpile your code with tsc,
1. document your code with typedoc, 1. test your code with mocha (supports the fancy stuff like Promises, Generators, async/await, sourcemaps)
1. test your code with mocha 1. create coverage with istanbul (supports tracing of the originating TypeScript)
1. create coverage with istanbul
This works on your machine and in CI. There is a prebuild docker image available that includes npmts to make CI a breeze: This works on your machine and in CI. There is a prebuild docker image available that includes npmts to make CI a breeze:
[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 linked docs at the top of this README.
1. [Intro](https://pushrocks.gitlab.io/npmts/gitbook/index.html)
2. [Install](https://pushrocks.gitlab.io/npmts/gitbook/install.html)
3. [Default Behaviour](https://pushrocks.gitlab.io/npmts/gitbook/default.html)
4. [Configuration](https://pushrocks.gitlab.io/npmts/gitbook/config.html)
5. [Examples](https://pushrocks.gitlab.io/npmts/gitbook/examples.html)
6. [Info](https://pushrocks.gitlab.io/npmts/gitbook/info.html)
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks) > MIT licensed | **©** 2016 - 2017 [Lossless GmbH](https://lossless.gmbh)
[![npm](https://gitzone.gitlab.io/assets/repo-footer.svg)](https://git.zone)

View File

@ -1,2 +1,2 @@
#!/usr/bin/env node #!/usr/bin/env node
var index = require("./index.js"); var index = require("../{{pathToIndex}}");

2
assets/cliNpmts.js Normal file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env node
var index = require("../dist/index.js");

2
dist/cli.js vendored
View File

@ -1,2 +0,0 @@
#!/usr/bin/env node
var index = require("./index.js");

1
dist/index.d.ts vendored
View File

@ -1 +0,0 @@
import 'typings-global';

22
dist/index.js vendored
View File

@ -1,23 +1,15 @@
"use strict";
require("typings-global");
/* ================================================== * /* ================================================== *
Starting NPMTS main process. **** NPMTS ****
Fabulous TypeScript development
* ================================================== */ * ================================================== */
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const early = require("early"); const early = require("early");
early.start('NPMTS'); early.start('NPMTS');
const plugins = require("./npmts.plugins"); const plugins = require("./npmts.plugins");
const paths = require("./npmts.paths"); const cli = require("./npmts.cli");
const promisechain = require("./npmts.promisechain");
early.stop() early.stop()
.then(() => { .then(() => {
let npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot); let loaded = plugins; // to make sure plugins get actually loaded
let npmtsCli = new plugins.smartcli.Smartcli(); cli.run();
npmtsCli.standardTask()
.then((argvArg) => {
plugins.beautylog.figletSync('NPMTS');
plugins.beautylog.info('npmts version: ' + npmtsProjectInfo.version);
promisechain.run(argvArg).catch((err) => { console.log(err); });
});
npmtsCli.addVersion(npmtsProjectInfo.version);
npmtsCli.startParse();
}); });

2
dist/mod00/index.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
import { INpmtsConfig } from '../npmts.config';
export declare let run: (configArg: INpmtsConfig) => Promise<INpmtsConfig>;

23
dist/mod00/index.js vendored Normal file
View File

@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* ------------------------------------------
* This module compiles TypeScript files
* -------------------------------------------- */
const q = require("smartq");
const plugins = require("./mod00.plugins");
const NpmtsAssets = require("./mod00.assets");
const NpmtsCheck = require("./mod00.check");
const NpmtsClean = require("./mod00.clean");
const NpmtsCompile = require("./mod00.compile");
exports.run = function (configArg) {
let done = q.defer();
plugins.beautylog.ora.text('starting TypeScript Compilation');
NpmtsClean.run(configArg)
.then(NpmtsCheck.run)
.then(NpmtsCompile.run)
.then(NpmtsAssets.run)
.then(function () {
done.resolve(configArg);
});
return done.promise;
};

1
dist/mod00/mod00.assets.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export declare let run: (configArg: any) => Promise<{}>;

24
dist/mod00/mod00.assets.js vendored Normal file
View File

@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const q = require("smartq");
const paths = require("../npmts.paths");
const plugins = require("./mod00.plugins");
const mod00_check_1 = require("../mod00/mod00.check");
exports.run = function (configArg) {
let done = q.defer();
let config = configArg;
plugins.beautylog.ora.text('now looking at ' + 'required assets'.yellow);
if (config.cli === true) {
let mainJsPath = mod00_check_1.projectInfo.packageJson.main;
let cliJsString = plugins.smartfile.fs.toStringSync(plugins.path.join(paths.npmtsAssetsDir, 'cli.js'));
cliJsString = cliJsString.replace('{{pathToIndex}}', mainJsPath);
plugins.smartfile.memory.toFsSync(cliJsString, plugins.path.join(paths.distDir, 'cli.js'));
plugins.beautylog.ok('installed CLI assets!');
done.resolve(config);
}
else {
plugins.beautylog.ok('No additional assets required!');
done.resolve(config);
}
return done.promise;
};

3
dist/mod00/mod00.check.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { ProjectinfoNpm } from 'projectinfo';
export declare let projectInfo: ProjectinfoNpm;
export declare let run: (configArg: any) => Promise<{}>;

View File

@ -1,11 +1,12 @@
"use strict"; "use strict";
const plugins = require("./npmts.plugins"); Object.defineProperty(exports, "__esModule", { value: true });
const paths = require("./npmts.paths"); const q = require("smartq");
const npmts_promisechain_1 = require("./npmts.promisechain");
const projectinfo_1 = require("projectinfo"); const projectinfo_1 = require("projectinfo");
const paths = require("../npmts.paths");
const plugins = require("./mod00.plugins");
let checkProjectTypings = (configArg) => { let checkProjectTypings = (configArg) => {
let done = plugins.q.defer(); let done = q.defer();
npmts_promisechain_1.npmtsOra.text('Check Module: Check Project Typings...'); plugins.beautylog.ora.text('Check Module: Check Project Typings...');
exports.projectInfo = new projectinfo_1.ProjectinfoNpm(paths.cwd); exports.projectInfo = new projectinfo_1.ProjectinfoNpm(paths.cwd);
if (typeof exports.projectInfo.packageJson.typings === 'undefined') { if (typeof exports.projectInfo.packageJson.typings === 'undefined') {
plugins.beautylog.error(`please add typings field to package.json`); plugins.beautylog.error(`please add typings field to package.json`);
@ -30,8 +31,8 @@ const depcheckOptions = {
] ]
}; };
let checkDependencies = (configArg) => { let checkDependencies = (configArg) => {
let done = plugins.q.defer(); let done = q.defer();
npmts_promisechain_1.npmtsOra.text('Check Module: Check Dependencies...'); plugins.beautylog.ora.text('Check Module: Check Dependencies...');
let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, { let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, {
ignoreDirs: [ ignoreDirs: [
'test', 'test',
@ -48,7 +49,7 @@ let checkDependencies = (configArg) => {
plugins.beautylog.warn(`Watch out: unused dependency "${item}"`); plugins.beautylog.warn(`Watch out: unused dependency "${item}"`);
} }
for (let item in unused.missing) { for (let item in unused.missing) {
plugins.beautylog.error(`unused devDependency "${item}"`); plugins.beautylog.error(`missing dependency "${item}" in package.json`);
} }
if (unused.missing.length > 0) { if (unused.missing.length > 0) {
plugins.beautylog.info('exiting due to missing dependencies in package.json'); plugins.beautylog.info('exiting due to missing dependencies in package.json');
@ -66,8 +67,8 @@ let checkDependencies = (configArg) => {
return done.promise; return done.promise;
}; };
let checkDevDependencies = (configArg) => { let checkDevDependencies = (configArg) => {
let done = plugins.q.defer(); let done = q.defer();
npmts_promisechain_1.npmtsOra.text('Check Module: Check devDependencies...'); plugins.beautylog.ora.text('Check Module: Check devDependencies...');
let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, { let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, {
ignoreDirs: [ ignoreDirs: [
'ts', 'ts',
@ -101,14 +102,14 @@ let checkDevDependencies = (configArg) => {
return done.promise; return done.promise;
}; };
let checkNodeVersion = (configArg) => { let checkNodeVersion = (configArg) => {
let done = plugins.q.defer(); let done = q.defer();
npmts_promisechain_1.npmtsOra.text('checking node version'); plugins.beautylog.ora.text('checking node version');
done.resolve(configArg); done.resolve(configArg);
return done.promise; return done.promise;
}; };
exports.run = (configArg) => { exports.run = (configArg) => {
let done = plugins.q.defer(); let done = q.defer();
npmts_promisechain_1.npmtsOra.text('Check Module: ...'); plugins.beautylog.ora.text('Check Module: ...');
checkProjectTypings(configArg) checkProjectTypings(configArg)
.then(checkDependencies) .then(checkDependencies)
.then(checkDevDependencies) .then(checkDevDependencies)

1
dist/mod00/mod00.clean.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export declare let run: (configArg: any) => Promise<{}>;

View File

@ -1,20 +1,20 @@
"use strict"; "use strict";
require("typings-global"); Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./npmts.plugins"); const q = require("smartq");
const paths = require("./npmts.paths"); const paths = require("../npmts.paths");
const npmts_promisechain_1 = require("./npmts.promisechain"); const plugins = require("./mod00.plugins");
/** /**
* removes the dist directory which will be entirely rebuild * removes the dist directory which will be entirely rebuild
*/ */
let removeDist = function () { let removeDist = function () {
npmts_promisechain_1.npmtsOra.text('cleaning dist folder'); plugins.beautylog.ora.text('cleaning dist folder');
return plugins.smartfile.fs.remove(paths.distDir); return plugins.smartfile.fs.remove(paths.distDir);
}; };
/** /**
* remove .d.ts files from testDirctory * remove .d.ts files from testDirctory
*/ */
let removeTestDeclarations = function () { let removeTestDeclarations = function () {
let done = plugins.q.defer(); let done = q.defer();
plugins.smartfile.fs.listFileTree('./test/', '**/*.d.ts').then(fileArray => { plugins.smartfile.fs.listFileTree('./test/', '**/*.d.ts').then(fileArray => {
let fileArrayToRemove = plugins.smartpath.transform.toAbsolute(fileArray, process.cwd() + '//test/'); let fileArrayToRemove = plugins.smartpath.transform.toAbsolute(fileArray, process.cwd() + '//test/');
plugins.smartfile.fs.removeManySync(fileArrayToRemove); plugins.smartfile.fs.removeManySync(fileArrayToRemove);
@ -25,12 +25,12 @@ let removeTestDeclarations = function () {
* remove old pages * remove old pages
*/ */
let removePages = function () { let removePages = function () {
npmts_promisechain_1.npmtsOra.text('cleaning pages folder'); plugins.beautylog.ora.text('cleaning pages folder');
return plugins.smartfile.fs.remove(paths.pagesDir); return plugins.smartfile.fs.remove(paths.pagesDir);
}; };
exports.run = function (configArg) { exports.run = function (configArg) {
npmts_promisechain_1.npmtsOra.text('cleaning up from previous builds...'); plugins.beautylog.ora.text('cleaning up from previous builds...');
let done = plugins.q.defer(); let done = q.defer();
removeDist() removeDist()
.then(removeTestDeclarations) .then(removeTestDeclarations)
.then(removePages) .then(removePages)

1
dist/mod00/mod00.compile.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export declare let run: (configArg: any) => Promise<{}>;

View File

@ -1,12 +1,12 @@
"use strict"; "use strict";
require("typings-global"); Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./npmts.plugins"); const q = require("smartq");
const paths = require("./npmts.paths"); const paths = require("../npmts.paths");
const npmts_promisechain_1 = require("./npmts.promisechain"); const plugins = require("./mod00.plugins");
exports.run = function (configArg) { exports.run = function (configArg) {
let done = plugins.q.defer(); let done = q.defer();
let config = configArg; let config = configArg;
npmts_promisechain_1.npmtsOra.text('now compiling ' + 'TypeScript'.yellow); plugins.beautylog.ora.text('now compiling ' + 'TypeScript'.yellow);
plugins.tsn.compileGlobStringObject(config.ts, config.tsOptions, paths.cwd) plugins.tsn.compileGlobStringObject(config.ts, config.tsOptions, paths.cwd)
.then(() => { .then(() => {
plugins.beautylog.ok('compiled main TypeScript!'); plugins.beautylog.ok('compiled main TypeScript!');

5
dist/mod00/mod00.plugins.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
export * from '../npmts.plugins';
import * as tsn from 'tsn';
import * as smartchok from 'smartchok';
import * as smartstream from 'smartstream';
export { tsn, smartchok, smartstream };

12
dist/mod00/mod00.plugins.js vendored Normal file
View File

@ -0,0 +1,12 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("../npmts.plugins"));
const tsn = require("tsn");
exports.tsn = tsn;
const smartchok = require("smartchok");
exports.smartchok = smartchok;
const smartstream = require("smartstream");
exports.smartstream = smartstream;

2
dist/mod01/index.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
import { INpmtsConfig } from '../npmts.config';
export declare let run: (configArg: INpmtsConfig) => Promise<INpmtsConfig>;

11
dist/mod01/index.js vendored Normal file
View File

@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* ------------------------------------------
* This module creates TypeScript documentation
* -------------------------------------------- */
const q = require("smartq");
exports.run = function (configArg) {
let done = q.defer();
done.resolve(configArg);
return done.promise;
};

1
dist/mod01/mod01.plugins.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from '../npmts.plugins';

6
dist/mod01/mod01.plugins.js vendored Normal file
View File

@ -0,0 +1,6 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("../npmts.plugins"));

2
dist/mod02/index.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
import { INpmtsConfig } from '../npmts.config';
export declare let run: (configArg: INpmtsConfig) => Promise<INpmtsConfig>;

121
dist/mod02/index.js vendored Normal file
View File

@ -0,0 +1,121 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
/* ------------------------------------------
* This module tests the compiled TypeScript files
* -------------------------------------------- */
const plugins = require("./mod02.plugins");
const paths = require("../npmts.paths");
const q = require("smartq");
/**
* runs mocha
* @returns INpmtsConfig
*/
let mocha = function (configArg) {
plugins.beautylog.ora.text('Instrumentalizing and testing transpiled JS');
plugins.beautylog.ora.end(); // end plugins.beautylog.ora for tests.
let done = q.defer();
let coverageSmartstream = new plugins.smartstream.Smartstream([
plugins.gulp.src([plugins.path.join(paths.cwd, './ts/**/*.ts')]),
plugins.gulpSourcemaps.init(),
plugins.gulpTypeScript({
target: 'ES5',
emitDecoratorMetadata: true,
experimentalDecorators: true,
lib: ['DOM', 'ES5', 'ES2015.Promise', 'ES2015.Generator', 'ES2015.Iterable']
}),
plugins.gulpIstanbul({}),
plugins.gulpSourcemaps.write(),
plugins.gulpFunction.forEach((file) => __awaiter(this, void 0, void 0, function* () {
file.path = file.path.replace(paths.tsDir, paths.distDir);
})),
plugins.gulpInjectModules(),
plugins.through2.obj((file, enc, cb) => {
cb();
}, (cb) => {
cb();
})
]);
let localSmartstream = new plugins.smartstream.Smartstream([
plugins.gulp.src([plugins.path.join(paths.cwd, 'test/test.ts')]),
plugins.gulpTypeScript({
target: 'ES5',
emitDecoratorMetadata: true,
experimentalDecorators: true,
lib: ['DOM', 'ES5', 'ES2015.Promise', 'ES2015.Generator', 'ES2015.Iterable']
}),
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) => {
plugins.beautylog.error('Tests failed!');
console.log(err);
if (configArg.watch) {
done.resolve(configArg);
}
else {
process.exit(1);
}
});
}, (err) => {
console.log(err);
});
return done.promise;
};
let coverage = function (configArg) {
let done = q.defer();
plugins.smartcov.get.percentage(plugins.path.join(paths.coverageDir, 'lcov.info'), 2)
.then(function (percentageArg) {
if (percentageArg >= configArg.coverageTreshold) {
plugins.beautylog.ok(`${percentageArg.toString()}% `
+ `coverage exceeds your treshold of `
+ `${configArg.coverageTreshold.toString()}%`);
}
else {
plugins.beautylog.warn(`${percentageArg.toString()}% `
+ `coverage fails your treshold of `
+ `${configArg.coverageTreshold.toString()}%`);
plugins.beautylog.error('exiting due to coverage failure');
if (!configArg.watch) {
process.exit(1);
}
}
done.resolve(configArg);
});
return done.promise;
};
exports.run = function (configArg) {
let done = q.defer();
let config = configArg;
if (config.test === true) {
plugins.beautylog.ora.text('now starting tests');
plugins.beautylog.log('------------------------------------------------------\n' +
'*************************** TESTS: ***************************\n' +
'--------------------------------------------------------------');
mocha(config)
.then(coverage)
.then(() => {
done.resolve(config);
}).catch(err => { console.log(err); });
}
else {
plugins.beautylog.ora.end();
done.resolve(config);
}
return done.promise;
};

9
dist/mod02/mod02.plugins.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
export * from '../npmts.plugins';
import * as gulp from 'gulp';
import * as gulpFunction from 'gulp-function';
import * as gulpIstanbul from 'gulp-istanbul';
declare let gulpInjectModules: any;
import * as gulpMocha from 'gulp-mocha';
import * as gulpSourcemaps from 'gulp-sourcemaps';
import * as gulpTypeScript from 'gulp-typescript';
export { gulp, gulpFunction, gulpIstanbul, gulpInjectModules, gulpMocha, gulpSourcemaps, gulpTypeScript };

20
dist/mod02/mod02.plugins.js vendored Normal file
View File

@ -0,0 +1,20 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("../npmts.plugins"));
const gulp = require("gulp");
exports.gulp = gulp;
const gulpFunction = require("gulp-function");
exports.gulpFunction = gulpFunction;
const gulpIstanbul = require("gulp-istanbul");
exports.gulpIstanbul = gulpIstanbul;
let gulpInjectModules = require('gulp-inject-modules');
exports.gulpInjectModules = gulpInjectModules;
const gulpMocha = require("gulp-mocha");
exports.gulpMocha = gulpMocha;
const gulpSourcemaps = require("gulp-sourcemaps");
exports.gulpSourcemaps = gulpSourcemaps;
const gulpTypeScript = require("gulp-typescript");
exports.gulpTypeScript = gulpTypeScript;

View File

@ -1,4 +0,0 @@
/// <reference types="q" />
import 'typings-global';
import plugins = require('./npmts.plugins');
export declare var run: (configArg: any) => plugins.q.Promise<{}>;

20
dist/npmts.assets.js vendored
View File

@ -1,20 +0,0 @@
"use strict";
require("typings-global");
const plugins = require("./npmts.plugins");
const paths = require("./npmts.paths");
const npmts_promisechain_1 = require("./npmts.promisechain");
exports.run = function (configArg) {
let done = plugins.q.defer();
let config = configArg;
npmts_promisechain_1.npmtsOra.text('now looking at ' + 'required assets'.yellow);
if (config.cli === true) {
plugins.smartfile.fs.copySync(plugins.path.join(paths.npmtsAssetsDir, 'cli.js'), plugins.path.join(paths.distDir, 'cli.js'));
plugins.beautylog.ok('installed CLI assets!');
done.resolve(config);
}
else {
plugins.beautylog.ok('No additional assets required!');
done.resolve(config);
}
return done.promise;
};

View File

@ -1,5 +0,0 @@
/// <reference types="q" />
import * as plugins from './npmts.plugins';
import { ProjectinfoNpm } from 'projectinfo';
export declare let projectInfo: ProjectinfoNpm;
export declare let run: (configArg: any) => plugins.q.Promise<{}>;

View File

@ -1,4 +0,0 @@
/// <reference types="q" />
import 'typings-global';
import plugins = require('./npmts.plugins');
export declare let run: (configArg: any) => plugins.q.Promise<{}>;

1
dist/npmts.cli.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export declare let run: () => Promise<{}>;

59
dist/npmts.cli.js vendored Normal file
View File

@ -0,0 +1,59 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const q = require("smartq");
const plugins = require("./npmts.plugins");
const paths = require("./npmts.paths");
const NpmtsConfig = require("./npmts.config");
const NpmtsMods = require("./npmts.mods");
const NpmtsWatch = require("./npmts.watch");
const NpmtsShip = require("./npmts.ship");
exports.run = () => {
let done = q.defer();
let npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot);
let npmtsCli = new plugins.smartcli.Smartcli();
npmtsCli.standardTask()
.then((argvArg) => {
plugins.beautylog.figletSync('NPMTS');
plugins.beautylog.info('npmts version: ' + npmtsProjectInfo.version);
return NpmtsConfig.run(argvArg);
})
.then((configArg) => {
let done = q.defer();
plugins.beautylog.ora.start('loading additional modules...');
NpmtsMods.mod00.load()
.then((mod00) => {
return mod00.run(configArg);
})
.then(configArg => {
let done = q.defer();
NpmtsMods.mod01.load()
.then(mod01 => {
return mod01.run(configArg);
})
.then(configArg => {
done.resolve(configArg);
});
return done.promise;
})
.then(configArg => {
let done = q.defer();
NpmtsMods.mod02.load()
.then(mod02 => {
return mod02.run(configArg);
})
.then(configArg => {
done.resolve(configArg);
});
return done.promise;
})
.then(NpmtsWatch.run)
.then(NpmtsShip.run);
return done.promise;
})
.catch((err) => { if (err instanceof Error) {
console.log(err);
} });
npmtsCli.addVersion(npmtsProjectInfo.version);
npmtsCli.startParse();
return done.promise;
};

View File

@ -1,4 +0,0 @@
/// <reference types="q" />
import 'typings-global';
import plugins = require('./npmts.plugins');
export declare let run: (configArg: any) => plugins.q.Promise<{}>;

View File

@ -1,11 +1,7 @@
/// <reference types="q" />
import 'typings-global';
import plugins = require('./npmts.plugins');
export declare type npmtsMode = 'default' | 'custom'; 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;
@ -13,4 +9,4 @@ export interface INpmtsConfig {
tsOptions: any; tsOptions: any;
watch: boolean; watch: boolean;
} }
export declare var run: (argvArg: any) => plugins.q.Promise<{}>; export declare let run: (argvArg: any) => Promise<{}>;

View File

@ -1,15 +1,14 @@
"use strict"; "use strict";
require("typings-global"); Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./npmts.plugins"); const plugins = require("./npmts.plugins");
const paths = require("./npmts.paths"); const paths = require("./npmts.paths");
const npmts_promisechain_1 = require("./npmts.promisechain"); const q = require("smartq");
; ;
exports.run = function (argvArg) { exports.run = function (argvArg) {
let done = plugins.q.defer(); let done = q.defer();
let defaultConfig = { let defaultConfig = {
argv: undefined, argv: undefined,
coverageTreshold: 70, coverageTreshold: 70,
docs: true,
mode: 'default', mode: 'default',
test: true, test: true,
testTs: {}, testTs: {},
@ -18,7 +17,7 @@ exports.run = function (argvArg) {
watch: false watch: false
}; };
// mix with configfile // mix with configfile
npmts_promisechain_1.npmtsOra.text('running npmextra'); plugins.beautylog.ora.text('running npmextra');
let localNpmextra = new plugins.npmextra.Npmextra(paths.cwd); let localNpmextra = new plugins.npmextra.Npmextra(paths.cwd);
let config = localNpmextra.dataFor('npmts', defaultConfig); let config = localNpmextra.dataFor('npmts', defaultConfig);
// add argv // add argv
@ -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;
} }

7
dist/npmts.mods.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
import { LazyModule } from 'smartsystem';
import * as _mod00 from './mod00/index';
import * as _mod01 from './mod01/index';
import * as _mod02 from './mod02/index';
export declare let mod00: LazyModule<typeof _mod00>;
export declare let mod01: LazyModule<typeof _mod01>;
export declare let mod02: LazyModule<typeof _mod02>;

6
dist/npmts.mods.js vendored Normal file
View File

@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const smartsystem_1 = require("smartsystem");
exports.mod00 = new smartsystem_1.LazyModule('./mod00/index', __dirname);
exports.mod01 = new smartsystem_1.LazyModule('./mod01/index', __dirname);
exports.mod02 = new smartsystem_1.LazyModule('./mod02/index', __dirname);

View File

@ -1,4 +1,3 @@
import 'typings-global';
export declare let npmtsPackageRoot: string; export declare let npmtsPackageRoot: string;
export declare let cwd: string; export declare let cwd: string;
export declare let tsDir: string; export declare let tsDir: string;

2
dist/npmts.paths.js vendored
View File

@ -1,5 +1,5 @@
"use strict"; "use strict";
require("typings-global"); Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./npmts.plugins"); const plugins = require("./npmts.plugins");
// NPMTS Paths // NPMTS Paths
exports.npmtsPackageRoot = plugins.path.join(__dirname, '../'); exports.npmtsPackageRoot = plugins.path.join(__dirname, '../');

View File

@ -1,29 +1,18 @@
import 'typings-global'; import 'typings-global';
export import beautylog = require('beautylog'); import * as beautylog from 'beautylog';
export declare let depcheck: any; declare let depcheck: any;
export import gulp = require('gulp'); import * as lodash from 'lodash';
export declare let g: { import * as npmextra from 'npmextra';
babel: any; import * as projectinfo from 'projectinfo';
istanbul: any; import * as path from 'path';
gFunction: any; import * as smartcli from 'smartcli';
injectModules: any; import * as smartcov from 'smartcov';
mocha: any; import * as smartenv from 'smartenv';
sourcemaps: any; import * as smartfile from 'smartfile';
typedoc: any; import * as smartpath from 'smartpath';
}; import * as smartstream from 'smartstream';
export import lodash = require('lodash'); import * as smartstring from 'smartstring';
export import npmextra = require('npmextra'); import * as smartsystem from 'smartsystem';
export import projectinfo = require('projectinfo'); import * as through2 from 'through2';
export import path = require('path');
export import q = require('q');
export import shelljs = require('shelljs');
export import smartchok = require('smartchok');
export import smartcli = require('smartcli');
export import smartcov = require('smartcov');
export import smartenv = require('smartenv');
export import smartfile = require('smartfile');
export import smartpath = require('smartpath');
export import smartstream = require('smartstream');
export import smartstring = require('smartstring');
export declare let sourceMapSupport: any; export declare let sourceMapSupport: any;
export import tsn = require('tsn'); export { beautylog, depcheck, lodash, npmextra, projectinfo, path, smartcli, smartcov, smartenv, smartfile, smartpath, smartstream, smartstring, smartsystem, through2 };

58
dist/npmts.plugins.js vendored
View File

@ -1,30 +1,34 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global"); require("typings-global");
exports.beautylog = require("beautylog"); const beautylog = require("beautylog");
exports.depcheck = require('depcheck'); exports.beautylog = beautylog;
exports.gulp = require("gulp"); let depcheck = require('depcheck');
exports.g = { exports.depcheck = depcheck;
babel: require('gulp-babel'), const lodash = require("lodash");
istanbul: require('gulp-istanbul'), exports.lodash = lodash;
gFunction: require('gulp-function'), const npmextra = require("npmextra");
injectModules: require('gulp-inject-modules'), exports.npmextra = npmextra;
mocha: require('gulp-mocha'), const projectinfo = require("projectinfo");
sourcemaps: require('gulp-sourcemaps'), exports.projectinfo = projectinfo;
typedoc: require('gulp-typedoc') const path = require("path");
}; exports.path = path;
exports.lodash = require("lodash"); const smartcli = require("smartcli");
exports.npmextra = require("npmextra"); exports.smartcli = smartcli;
exports.projectinfo = require("projectinfo"); const smartcov = require("smartcov");
exports.path = require("path"); exports.smartcov = smartcov;
exports.q = require("q"); const smartenv = require("smartenv");
exports.shelljs = require("shelljs"); exports.smartenv = smartenv;
exports.smartchok = require("smartchok"); const smartfile = require("smartfile");
exports.smartcli = require("smartcli"); exports.smartfile = smartfile;
exports.smartcov = require("smartcov"); const smartpath = require("smartpath");
exports.smartenv = require("smartenv"); exports.smartpath = smartpath;
exports.smartfile = require("smartfile"); const smartstream = require("smartstream");
exports.smartpath = require("smartpath"); exports.smartstream = smartstream;
exports.smartstream = require("smartstream"); const smartstring = require("smartstring");
exports.smartstring = require("smartstring"); exports.smartstring = smartstring;
const smartsystem = require("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
exports.tsn = require("tsn");

View File

@ -1,6 +0,0 @@
/// <reference types="q" />
import 'typings-global';
import plugins = require('./npmts.plugins');
import { Ora } from 'beautylog';
export declare let npmtsOra: Ora;
export declare let run: (argvArg: any) => plugins.q.Promise<{}>;

View File

@ -1,50 +0,0 @@
"use strict";
require("typings-global");
const plugins = require("./npmts.plugins");
const beautylog_1 = require("beautylog");
exports.npmtsOra = new beautylog_1.Ora('setting up TaskChain', 'cyan');
const NpmtsAssets = require("./npmts.assets");
const NpmtsCheck = require("./npmts.check");
const NpmtsClean = require("./npmts.clean");
const NpmtsCompile = require("./npmts.compile");
const NpmtsTypeDoc = require("./npmts.typedoc");
const NpmtsOptions = require("./npmts.options");
const NpmtsTests = require("./npmts.tests");
const NpmtsWatch = require("./npmts.watch");
exports.run = function (argvArg) {
let done = plugins.q.defer();
exports.npmtsOra.start();
NpmtsOptions.run(argvArg)
.then(NpmtsClean.run)
.then(NpmtsCheck.run)
.then(NpmtsCompile.run)
.then(NpmtsAssets.run)
.then(NpmtsTypeDoc.run)
.then(NpmtsTests.run)
.then(NpmtsWatch.run)
.then(function (configArg) {
let shipString = '' +
'\n' +
'\n' +
' # # ( )\n' +
' ___#_#___|__\n' +
' _ |____________| _\n' +
' _=====| | | | | |==== _\n' +
' =====| |.---------------------------. | |====\n' +
" <--------------------' . . . . . . . . '--------------/\n" +
' \\ /\n' +
' \\___________________________________________________________/\n' +
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n' +
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n' +
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n';
if (process.env.CI) {
console.log(shipString);
plugins.beautylog.success('READY TO SHIP!');
}
else {
plugins.beautylog.success('Done!');
}
done.resolve(configArg);
});
return done.promise;
};

2
dist/npmts.ship.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
import { INpmtsConfig } from './npmts.config';
export declare let run: (configArg: INpmtsConfig) => void;

29
dist/npmts.ship.js vendored Normal file
View File

@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const q = require("smartq");
const plugins = require("./npmts.plugins");
exports.run = (configArg) => {
let done = q.defer();
let shipString = '' +
'\n' +
'\n' +
' # # ( )\n' +
' ___#_#___|__\n' +
' _ |____________| _\n' +
' _=====| | | | | |==== _\n' +
' =====| |.---------------------------. | |====\n' +
" <--------------------' . . . . . . . . '--------------/\n" +
' \\ /\n' +
' \\___________________________________________________________/\n' +
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n' +
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n' +
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n';
if (process.env.CI) {
console.log(shipString);
plugins.beautylog.success('READY TO SHIP!');
}
else {
plugins.beautylog.success('Done!');
}
done.resolve(configArg);
};

View File

@ -1,5 +0,0 @@
/// <reference types="q" />
import 'typings-global';
import plugins = require('./npmts.plugins');
import { INpmtsConfig } from './npmts.options';
export declare let run: (configArg: INpmtsConfig) => plugins.q.Promise<{}>;

93
dist/npmts.tests.js vendored
View File

@ -1,93 +0,0 @@
"use strict";
require("typings-global");
const plugins = require("./npmts.plugins");
const paths = require("./npmts.paths");
const npmts_promisechain_1 = require("./npmts.promisechain");
/**
* runs mocha
* @returns INpmtsConfig
*/
let mocha = function (configArg) {
npmts_promisechain_1.npmtsOra.text('Instrumentalizing and testing transpiled JS');
npmts_promisechain_1.npmtsOra.end(); // end npmtsOra for tests.
let done = plugins.q.defer();
plugins.gulp.src([plugins.path.join(paths.cwd, 'dist/*.js')])
.pipe(plugins.g.sourcemaps.init())
.pipe(plugins.g.babel({
presets: [
require.resolve('babel-preset-es2015')
]
}))
.pipe(plugins.g.istanbul({}))
.pipe(plugins.g.sourcemaps.write())
.pipe(plugins.g.injectModules())
.on('finish', function () {
let localSmartstream = new plugins.smartstream.Smartstream([
plugins.gulp.src([plugins.path.join(paths.cwd, 'test/test.js')]),
plugins.g.babel({
presets: [
require.resolve('babel-preset-es2015')
]
}),
plugins.g.injectModules(),
plugins.g.mocha(),
plugins.g.istanbul.writeReports({
dir: plugins.path.join(paths.cwd, './coverage'),
reporters: ['lcovonly', 'json', 'text', 'text-summary']
})
]);
localSmartstream.run()
.then(() => { done.resolve(configArg); }, (err) => {
plugins.beautylog.error('Tests failed!');
if (configArg.watch) {
done.resolve(configArg);
}
else {
process.exit(1);
}
});
});
return done.promise;
};
let coverage = function (configArg) {
let done = plugins.q.defer();
plugins.smartcov.get.percentage(plugins.path.join(paths.coverageDir, 'lcov.info'), 2)
.then(function (percentageArg) {
if (percentageArg >= configArg.coverageTreshold) {
plugins.beautylog.ok(`${percentageArg.toString()}% `
+ `coverage exceeds your treshold of `
+ `${configArg.coverageTreshold.toString()}%`);
}
else {
plugins.beautylog.warn(`${percentageArg.toString()}% `
+ `coverage fails your treshold of `
+ `${configArg.coverageTreshold.toString()}%`);
plugins.beautylog.error('exiting due to coverage failure');
if (!configArg.watch) {
process.exit(1);
}
}
done.resolve(configArg);
});
return done.promise;
};
exports.run = function (configArg) {
let done = plugins.q.defer();
let config = configArg;
if (config.test === true) {
npmts_promisechain_1.npmtsOra.text('now starting tests');
plugins.beautylog.log('-------------------------------------------------------\n' +
'*************************** TESTS: ***************************\n' +
'--------------------------------------------------------------');
mocha(config)
.then(coverage)
.then(() => {
done.resolve(config);
});
}
else {
npmts_promisechain_1.npmtsOra.end();
done.resolve(config);
}
return done.promise;
};

View File

@ -1,4 +0,0 @@
/// <reference types="q" />
import 'typings-global';
import plugins = require('./npmts.plugins');
export declare let run: (configArg: any) => plugins.q.Promise<{}>;

43
dist/npmts.typedoc.js vendored
View File

@ -1,43 +0,0 @@
"use strict";
require("typings-global");
const plugins = require("./npmts.plugins");
const paths = require("./npmts.paths");
const npmts_promisechain_1 = require("./npmts.promisechain");
const npmts_check_1 = require("./npmts.check");
let genTypeDoc = function (configArg) {
let done = plugins.q.defer();
npmts_promisechain_1.npmtsOra.text('now generating ' + 'TypeDoc documentation'.yellow);
plugins.beautylog.log('TypeDoc Output:');
plugins.gulp.src(plugins.path.join(paths.tsDir, '**/*.ts'))
.pipe(plugins.g.typedoc({
// 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: npmts_check_1.projectInfo.name,
readme: plugins.path.join(paths.cwd, 'README.md'),
// theme: "default",
ignoreCompilerErrors: true,
version: true
}))
.pipe(plugins.g.gFunction(done.resolve, 'atEnd'));
return done.promise;
};
exports.run = function (configArg) {
let done = plugins.q.defer();
if (configArg.docs) {
genTypeDoc(configArg)
.then(() => {
done.resolve(configArg);
});
}
else {
done.resolve(configArg);
}
;
return done.promise;
};

View File

@ -1,4 +1,2 @@
/// <reference types="q" /> import { INpmtsConfig } from './npmts.config';
import * as plugins from './npmts.plugins'; export declare let run: (configArg: INpmtsConfig) => Promise<{}>;
import { INpmtsConfig } from './npmts.options';
export declare let run: (configArg: INpmtsConfig) => plugins.q.Promise<{}>;

12
dist/npmts.watch.js vendored
View File

@ -1,9 +1,12 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const q = require("smartq");
const smartchok = require("smartchok");
const plugins = require("./npmts.plugins"); const plugins = require("./npmts.plugins");
const promisechain = require("./npmts.promisechain"); const cli = require("./npmts.cli");
let npmtsSmartchok = null; let npmtsSmartchok = null;
exports.run = (configArg) => { exports.run = (configArg) => {
let done = plugins.q.defer(); let done = q.defer();
if (configArg.watch && npmtsSmartchok === null) { if (configArg.watch && npmtsSmartchok === null) {
let pathsToWatch = []; let pathsToWatch = [];
for (let key in configArg.ts) { for (let key in configArg.ts) {
@ -12,17 +15,18 @@ exports.run = (configArg) => {
for (let key in configArg.testTs) { for (let key in configArg.testTs) {
pathsToWatch.push(key); pathsToWatch.push(key);
} }
npmtsSmartchok = new plugins.smartchok.Smartchok(pathsToWatch); npmtsSmartchok = new smartchok.Smartchok(pathsToWatch);
npmtsSmartchok.getObservableFor('change').then((changeObservableArg) => { npmtsSmartchok.getObservableFor('change').then((changeObservableArg) => {
plugins.beautylog.info('now watching...'); plugins.beautylog.info('now watching...');
changeObservableArg.subscribe(() => { changeObservableArg.subscribe(() => {
promisechain.run(configArg); cli.run();
}); });
}); });
npmtsSmartchok.start(); npmtsSmartchok.start();
done.resolve(configArg); done.resolve(configArg);
} }
else { else {
plugins.beautylog.info('not watching');
done.resolve(configArg); done.resolve(configArg);
} }
return done.promise; return done.promise;

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,16 +1,16 @@
{ {
"name": "npmts", "name": "npmts",
"version": "5.4.42", "version": "6.1.15",
"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": {
"npmts": "dist/cli.js" "npmts": "assets/cliNpmts.js"
}, },
"scripts": { "scripts": {
"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 && cp assets/cli.js dist/ )", "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)",
@ -21,52 +21,52 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://gitlab.com/pushrocks/npmts.git" "url": "git+https://gitlab.com/gitzone/npmts.git"
}, },
"keywords": [ "keywords": [
"TypeScript", "TypeScript",
"Declaration" "Declaration"
], ],
"author": "Lossless Digital UG (haftungsbeschraenkt)", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {
"url": "https://gitlab.com/pushrocks/npmts/issues" "url": "https://gitlab.com/gitzone/npmts/issues"
}, },
"homepage": "https://gitlab.com/pushrocks/npmts#readme", "homepage": "https://gitlab.com/gitzone/npmts#readme",
"dependencies": { "dependencies": {
"@types/gulp": "^3.8.32", "@types/gulp": "^3.8.32",
"@types/gulp-istanbul": "^0.9.30",
"@types/gulp-mocha": "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/through2": "^2.0.32",
"@types/shelljs": "^0.3.31", "beautylog": "6.1.1",
"babel-preset-es2015": "^6.16.0", "depcheck": "^0.6.7",
"beautylog": "5.0.23", "early": "^2.0.36",
"depcheck": "^0.6.4",
"early": "^2.0.35",
"gulp": "3.9.1", "gulp": "3.9.1",
"gulp-babel": "^6.1.2", "gulp-function": "^2.2.3",
"gulp-function": "^1.3.6",
"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": "^1.6.0", "gulp-sourcemaps": "^2.4.1",
"gulp-typedoc": "^2.0.0", "gulp-typescript": "^3.1.5",
"lodash": "^4.16.2", "lodash": "^4.17.4",
"npmextra": "^2.0.3", "npmextra": "^2.0.3",
"projectinfo": "1.0.3", "projectinfo": "^3.0.2",
"q": "^1.4.1", "smartchok": "^1.0.5",
"shelljs": "^0.7.4", "smartcli": "2.0.1",
"smartchok": "^1.0.2",
"smartcli": "1.0.9",
"smartcov": "1.0.0", "smartcov": "1.0.0",
"smartenv": "1.2.5", "smartenv": "2.0.0",
"smartfile": "4.0.22", "smartfile": "^4.1.6",
"smartpath": "3.2.2", "smartpath": "^3.2.8",
"smartq": "^1.1.1",
"smartstream": "^1.0.5", "smartstream": "^1.0.5",
"smartstring": "^2.0.17", "smartstring": "^2.0.24",
"source-map-support": "^0.4.3", "smartsystem": "^1.0.12",
"tsn": "^2.0.4", "source-map-support": "^0.4.11",
"typedoc": "^0.4.5", "through2": "^2.0.3",
"typescript": "next", "tsn": "^2.0.15",
"typescript": "^2.2.1",
"typings-global": "^1.0.14" "typings-global": "^1.0.14"
}, },
"devDependencies": {} "devDependencies": {}

View File

@ -1,24 +1,14 @@
import 'typings-global'
/* ================================================== * /* ================================================== *
Starting NPMTS main process. **** NPMTS ****
Fabulous TypeScript development
* ================================================== */ * ================================================== */
import * as early from 'early' import * as early from 'early'
early.start('NPMTS') early.start('NPMTS')
import * as plugins from './npmts.plugins' import * as plugins from './npmts.plugins'
import * as paths from './npmts.paths' import * as cli from './npmts.cli'
import * as promisechain from './npmts.promisechain'
early.stop() early.stop()
.then(() => { .then(() => {
let npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot) let loaded = plugins // to make sure plugins get actually loaded
let npmtsCli = new plugins.smartcli.Smartcli() cli.run()
npmtsCli.standardTask()
.then((argvArg) => {
plugins.beautylog.figletSync('NPMTS')
plugins.beautylog.info('npmts version: ' + npmtsProjectInfo.version)
promisechain.run(argvArg).catch((err) => { console.log(err) })
})
npmtsCli.addVersion(npmtsProjectInfo.version)
npmtsCli.startParse()
}) })

26
ts/mod00/index.ts Normal file
View File

@ -0,0 +1,26 @@
/* ------------------------------------------
* This module compiles TypeScript files
* -------------------------------------------- */
import * as q from 'smartq'
import { INpmtsConfig } from '../npmts.config'
import * as plugins from './mod00.plugins'
import * as NpmtsAssets from './mod00.assets'
import * as NpmtsCheck from './mod00.check'
import * as NpmtsClean from './mod00.clean'
import * as NpmtsCompile from './mod00.compile'
export let run = function(configArg: INpmtsConfig): Promise<INpmtsConfig> {
let done = q.defer<INpmtsConfig>()
plugins.beautylog.ora.text('starting TypeScript Compilation')
NpmtsClean.run(configArg)
.then(NpmtsCheck.run)
.then(NpmtsCompile.run)
.then(NpmtsAssets.run)
.then(function(){
done.resolve(configArg)
})
return done.promise
}

24
ts/mod00/mod00.assets.ts Normal file
View File

@ -0,0 +1,24 @@
import * as q from 'smartq'
import paths = require('../npmts.paths')
import plugins = require('./mod00.plugins')
import { projectInfo } from '../mod00/mod00.check'
export let run = function(configArg){
let done = q.defer()
let config = configArg
plugins.beautylog.ora.text('now looking at ' + 'required assets'.yellow)
if (config.cli === true) {
let mainJsPath = projectInfo.packageJson.main
let cliJsString: string = plugins.smartfile.fs.toStringSync(plugins.path.join(paths.npmtsAssetsDir,'cli.js'))
cliJsString = cliJsString.replace('{{pathToIndex}}',mainJsPath)
plugins.smartfile.memory.toFsSync(cliJsString, plugins.path.join(paths.distDir,'cli.js'))
plugins.beautylog.ok('installed CLI assets!')
done.resolve(config)
} else {
plugins.beautylog.ok('No additional assets required!')
done.resolve(config)
}
return done.promise
}

View File

@ -1,15 +1,16 @@
import * as plugins from './npmts.plugins' import * as q from 'smartq'
import * as paths from './npmts.paths' import { ProjectinfoNpm } from 'projectinfo'
import { npmtsOra } from './npmts.promisechain'
import {ProjectinfoNpm} from 'projectinfo' import * as paths from '../npmts.paths'
import * as plugins from './mod00.plugins'
export let projectInfo: ProjectinfoNpm export let projectInfo: ProjectinfoNpm
let checkProjectTypings = (configArg) => { let checkProjectTypings = (configArg) => {
let done = plugins.q.defer() let done = q.defer()
npmtsOra.text('Check Module: Check Project Typings...') plugins.beautylog.ora.text('Check Module: Check Project Typings...')
projectInfo = new ProjectinfoNpm(paths.cwd) projectInfo = new ProjectinfoNpm(paths.cwd)
if (typeof projectInfo.packageJson.typings === 'undefined') { if (typeof projectInfo.packageJson.typings === 'undefined') {
plugins.beautylog.error(`please add typings field to package.json`) plugins.beautylog.error(`please add typings field to package.json`)
process.exit(1) process.exit(1)
@ -34,8 +35,8 @@ const depcheckOptions = {
} }
let checkDependencies = (configArg) => { let checkDependencies = (configArg) => {
let done = plugins.q.defer() let done = q.defer()
npmtsOra.text('Check Module: Check Dependencies...') plugins.beautylog.ora.text('Check Module: Check Dependencies...')
let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, { let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, {
ignoreDirs: [ // folder with these names will be ignored ignoreDirs: [ // folder with these names will be ignored
'test', 'test',
@ -52,7 +53,7 @@ let checkDependencies = (configArg) => {
plugins.beautylog.warn(`Watch out: unused dependency "${item}"`) plugins.beautylog.warn(`Watch out: unused dependency "${item}"`)
} }
for (let item in unused.missing) { for (let item in unused.missing) {
plugins.beautylog.error(`unused devDependency "${item}"`) plugins.beautylog.error(`missing dependency "${item}" in package.json`)
} }
if (unused.missing.length > 0) { if (unused.missing.length > 0) {
plugins.beautylog.info('exiting due to missing dependencies in package.json') plugins.beautylog.info('exiting due to missing dependencies in package.json')
@ -70,8 +71,8 @@ let checkDependencies = (configArg) => {
} }
let checkDevDependencies = (configArg) => { let checkDevDependencies = (configArg) => {
let done = plugins.q.defer() let done = q.defer()
npmtsOra.text('Check Module: Check devDependencies...') plugins.beautylog.ora.text('Check Module: Check devDependencies...')
let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, { let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, {
ignoreDirs: [ // folder with these names will be ignored ignoreDirs: [ // folder with these names will be ignored
'ts', 'ts',
@ -106,15 +107,15 @@ let checkDevDependencies = (configArg) => {
} }
let checkNodeVersion = (configArg) => { let checkNodeVersion = (configArg) => {
let done = plugins.q.defer() let done = q.defer()
npmtsOra.text('checking node version') plugins.beautylog.ora.text('checking node version')
done.resolve(configArg) done.resolve(configArg)
return done.promise return done.promise
} }
export let run = (configArg) => { export let run = (configArg) => {
let done = plugins.q.defer() let done = q.defer()
npmtsOra.text('Check Module: ...') plugins.beautylog.ora.text('Check Module: ...')
checkProjectTypings(configArg) checkProjectTypings(configArg)
.then(checkDependencies) .then(checkDependencies)
.then(checkDevDependencies) .then(checkDevDependencies)

View File

@ -1,13 +1,13 @@
import 'typings-global' import * as q from 'smartq'
import plugins = require('./npmts.plugins') import paths = require('../npmts.paths')
import paths = require('./npmts.paths')
import { npmtsOra } from './npmts.promisechain' import plugins = require('./mod00.plugins')
/** /**
* removes the dist directory which will be entirely rebuild * removes the dist directory which will be entirely rebuild
*/ */
let removeDist = function () { let removeDist = function () {
npmtsOra.text('cleaning dist folder') plugins.beautylog.ora.text('cleaning dist folder')
return plugins.smartfile.fs.remove(paths.distDir) return plugins.smartfile.fs.remove(paths.distDir)
} }
@ -15,7 +15,7 @@ let removeDist = function () {
* remove .d.ts files from testDirctory * remove .d.ts files from testDirctory
*/ */
let removeTestDeclarations = function () { let removeTestDeclarations = function () {
let done = plugins.q.defer() let done = q.defer()
plugins.smartfile.fs.listFileTree('./test/', '**/*.d.ts').then(fileArray => { plugins.smartfile.fs.listFileTree('./test/', '**/*.d.ts').then(fileArray => {
let fileArrayToRemove = plugins.smartpath.transform.toAbsolute(fileArray, process.cwd() + '//test/') let fileArrayToRemove = plugins.smartpath.transform.toAbsolute(fileArray, process.cwd() + '//test/')
plugins.smartfile.fs.removeManySync(fileArrayToRemove) plugins.smartfile.fs.removeManySync(fileArrayToRemove)
@ -27,13 +27,13 @@ let removeTestDeclarations = function () {
* remove old pages * remove old pages
*/ */
let removePages = function () { let removePages = function () {
npmtsOra.text('cleaning pages folder') plugins.beautylog.ora.text('cleaning pages folder')
return plugins.smartfile.fs.remove(paths.pagesDir) return plugins.smartfile.fs.remove(paths.pagesDir)
} }
export let run = function (configArg) { export let run = function (configArg) {
npmtsOra.text('cleaning up from previous builds...') plugins.beautylog.ora.text('cleaning up from previous builds...')
let done = plugins.q.defer() let done = q.defer()
removeDist() removeDist()
.then(removeTestDeclarations) .then(removeTestDeclarations)
.then(removePages) .then(removePages)

View File

@ -1,12 +1,13 @@
import 'typings-global' import * as q from 'smartq'
import plugins = require('./npmts.plugins')
import paths = require('./npmts.paths') import * as paths from '../npmts.paths'
import {npmtsOra} from './npmts.promisechain'
import * as plugins from './mod00.plugins'
export let run = function (configArg) { export let run = function (configArg) {
let done = plugins.q.defer() let done = q.defer()
let config = configArg let config = configArg
npmtsOra.text('now compiling ' + 'TypeScript'.yellow) plugins.beautylog.ora.text('now compiling ' + 'TypeScript'.yellow)
plugins.tsn.compileGlobStringObject(config.ts,config.tsOptions,paths.cwd) plugins.tsn.compileGlobStringObject(config.ts,config.tsOptions,paths.cwd)
.then(() => { .then(() => {
plugins.beautylog.ok('compiled main TypeScript!') plugins.beautylog.ok('compiled main TypeScript!')

11
ts/mod00/mod00.plugins.ts Normal file
View File

@ -0,0 +1,11 @@
export * from '../npmts.plugins'
import * as tsn from 'tsn'
import * as smartchok from 'smartchok'
import * as smartstream from 'smartstream'
export {
tsn,
smartchok,
smartstream
}

15
ts/mod01/index.ts Normal file
View File

@ -0,0 +1,15 @@
/* ------------------------------------------
* This module creates TypeScript documentation
* -------------------------------------------- */
import * as q from 'smartq'
import * as paths from '../npmts.paths'
import { INpmtsConfig } from '../npmts.config'
import * as plugins from './mod01.plugins'
export let run = function (configArg: INpmtsConfig) {
let done = q.defer<INpmtsConfig>()
done.resolve(configArg)
return done.promise
}

View File

@ -0,0 +1,2 @@
export * from '../npmts.plugins'

127
ts/mod02/index.ts Normal file
View File

@ -0,0 +1,127 @@
/* ------------------------------------------
* This module tests the compiled TypeScript files
* -------------------------------------------- */
import plugins = require('./mod02.plugins')
import paths = require('../npmts.paths')
import * as q from 'smartq'
import { INpmtsConfig } from '../npmts.config'
/**
* runs mocha
* @returns INpmtsConfig
*/
let mocha = function (configArg: INpmtsConfig) {
plugins.beautylog.ora.text('Instrumentalizing and testing transpiled JS')
plugins.beautylog.ora.end() // end plugins.beautylog.ora for tests.
let done = q.defer()
let coverageSmartstream = new plugins.smartstream.Smartstream([
plugins.gulp.src([plugins.path.join(paths.cwd, './ts/**/*.ts')]),
plugins.gulpSourcemaps.init(),
plugins.gulpTypeScript({
target: 'ES5',
emitDecoratorMetadata: true,
experimentalDecorators: true,
lib: ['DOM', 'ES5', 'ES2015.Promise', 'ES2015.Generator', 'ES2015.Iterable']
}),
plugins.gulpIstanbul({
}),
plugins.gulpSourcemaps.write(),
plugins.gulpFunction.forEach(async file => {
file.path = file.path.replace(paths.tsDir, paths.distDir)
}),
plugins.gulpInjectModules(),
plugins.through2.obj(
(file, enc, cb) => {
cb()
},
(cb) => {
cb()
}
)
])
let localSmartstream = new plugins.smartstream.Smartstream([
plugins.gulp.src([plugins.path.join(paths.cwd, 'test/test.ts')]),
plugins.gulpTypeScript({
target: 'ES5',
emitDecoratorMetadata: true,
experimentalDecorators: true,
lib: ['DOM', 'ES5', 'ES2015.Promise', 'ES2015.Generator', 'ES2015.Iterable']
}),
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) => {
plugins.beautylog.error('Tests failed!')
console.log(err)
if (configArg.watch) {
done.resolve(configArg)
} else {
process.exit(1)
}
})
},
(err) => {
console.log(err)
})
return done.promise
}
let coverage = function (configArg: INpmtsConfig) {
let done = q.defer()
plugins.smartcov.get.percentage(plugins.path.join(paths.coverageDir, 'lcov.info'), 2)
.then(function (percentageArg) {
if (percentageArg >= configArg.coverageTreshold) {
plugins.beautylog.ok(
`${percentageArg.toString()}% `
+ `coverage exceeds your treshold of `
+ `${configArg.coverageTreshold.toString()}%`
)
} else {
plugins.beautylog.warn(
`${percentageArg.toString()}% `
+ `coverage fails your treshold of `
+ `${configArg.coverageTreshold.toString()}%`
)
plugins.beautylog.error('exiting due to coverage failure')
if (!configArg.watch) { process.exit(1) }
}
done.resolve(configArg)
})
return done.promise
}
export let run = function (configArg: INpmtsConfig) {
let done = q.defer<INpmtsConfig>()
let config = configArg
if (config.test === true) {
plugins.beautylog.ora.text('now starting tests')
plugins.beautylog.log(
'------------------------------------------------------\n' +
'*************************** TESTS: ***************************\n' +
'--------------------------------------------------------------'
)
mocha(config)
.then(coverage)
.then(() => {
done.resolve(config)
}).catch(err => { console.log(err) })
} else {
plugins.beautylog.ora.end()
done.resolve(config)
}
return done.promise
}

19
ts/mod02/mod02.plugins.ts Normal file
View File

@ -0,0 +1,19 @@
export * from '../npmts.plugins'
import * as gulp from 'gulp'
import * as gulpFunction from 'gulp-function'
import * as gulpIstanbul from 'gulp-istanbul'
let gulpInjectModules = require('gulp-inject-modules')
import * as gulpMocha from 'gulp-mocha'
import * as gulpSourcemaps from 'gulp-sourcemaps'
import * as gulpTypeScript from 'gulp-typescript'
export {
gulp,
gulpFunction,
gulpIstanbul,
gulpInjectModules,
gulpMocha,
gulpSourcemaps,
gulpTypeScript
}

View File

@ -1,22 +0,0 @@
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
npmtsOra.text('now looking at ' + 'required assets'.yellow)
if (config.cli === true) {
plugins.smartfile.fs.copySync(
plugins.path.join(paths.npmtsAssetsDir,'cli.js'),
plugins.path.join(paths.distDir,'cli.js')
)
plugins.beautylog.ok('installed CLI assets!')
done.resolve(config)
} else {
plugins.beautylog.ok('No additional assets required!')
done.resolve(config)
}
return done.promise
}

58
ts/npmts.cli.ts Normal file
View File

@ -0,0 +1,58 @@
import * as q from 'smartq'
import * as plugins from './npmts.plugins'
import * as paths from './npmts.paths'
import * as NpmtsConfig from './npmts.config'
import * as NpmtsMods from './npmts.mods'
import * as NpmtsWatch from './npmts.watch'
import * as NpmtsShip from './npmts.ship'
export let run = () => {
let done = q.defer()
let npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot)
let npmtsCli = new plugins.smartcli.Smartcli()
npmtsCli.standardTask()
.then((argvArg) => {
plugins.beautylog.figletSync('NPMTS')
plugins.beautylog.info('npmts version: ' + npmtsProjectInfo.version)
return NpmtsConfig.run(argvArg)
})
.then((configArg: NpmtsConfig.INpmtsConfig) => {
let done = q.defer()
plugins.beautylog.ora.start('loading additional modules...')
NpmtsMods.mod00.load()
.then((mod00) => {
return mod00.run(configArg)
})
.then(configArg => {
let done = q.defer<NpmtsConfig.INpmtsConfig>()
NpmtsMods.mod01.load()
.then(mod01 => {
return mod01.run(configArg)
})
.then(configArg => {
done.resolve(configArg)
})
return done.promise
})
.then(configArg => {
let done = q.defer<NpmtsConfig.INpmtsConfig>()
NpmtsMods.mod02.load()
.then(mod02 => {
return mod02.run(configArg)
})
.then(configArg => {
done.resolve(configArg)
})
return done.promise
})
.then(NpmtsWatch.run)
.then(NpmtsShip.run)
return done.promise
})
.catch((err) => { if (err instanceof Error) { console.log(err) } } )
npmtsCli.addVersion(npmtsProjectInfo.version)
npmtsCli.startParse()
return done.promise
}

View File

@ -1,14 +1,13 @@
import 'typings-global'
import plugins = require('./npmts.plugins') import plugins = require('./npmts.plugins')
import paths = require('./npmts.paths') import paths = require('./npmts.paths')
import { npmtsOra } from './npmts.promisechain'
import * as q from 'smartq'
export type npmtsMode = 'default' | 'custom' 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,
@ -18,12 +17,11 @@ export interface INpmtsConfig {
}; };
export var run = function (argvArg) { export let run = function (argvArg) {
let done = plugins.q.defer() let done = q.defer()
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: {},
@ -33,7 +31,7 @@ export var run = function (argvArg) {
} }
// mix with configfile // mix with configfile
npmtsOra.text('running npmextra') plugins.beautylog.ora.text('running npmextra')
let localNpmextra = new plugins.npmextra.Npmextra(paths.cwd) let localNpmextra = new plugins.npmextra.Npmextra(paths.cwd)
let config: INpmtsConfig = localNpmextra.dataFor<INpmtsConfig>( let config: INpmtsConfig = localNpmextra.dataFor<INpmtsConfig>(
@ -70,9 +68,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
}; };

11
ts/npmts.mods.ts Normal file
View File

@ -0,0 +1,11 @@
import * as plugins from './npmts.plugins'
import { LazyModule } from 'smartsystem'
import * as _mod00 from './mod00/index'
import * as _mod01 from './mod01/index'
import * as _mod02 from './mod02/index'
export let mod00 = new LazyModule<typeof _mod00>('./mod00/index',__dirname)
export let mod01 = new LazyModule<typeof _mod01>('./mod01/index',__dirname)
export let mod02 = new LazyModule<typeof _mod02>('./mod02/index',__dirname)

View File

@ -1,4 +1,3 @@
import 'typings-global'
import plugins = require('./npmts.plugins') import plugins = require('./npmts.plugins')
// NPMTS Paths // NPMTS Paths

View File

@ -1,29 +1,36 @@
import 'typings-global' import 'typings-global'
export import beautylog = require('beautylog') import * as beautylog from 'beautylog'
export let depcheck = require('depcheck') let depcheck = require('depcheck')
export import gulp = require('gulp')
export let g = { import * as lodash from 'lodash'
babel: require('gulp-babel'), import * as npmextra from 'npmextra'
istanbul: require('gulp-istanbul'), import * as projectinfo from 'projectinfo'
gFunction: require('gulp-function'), import * as path from 'path'
injectModules: require('gulp-inject-modules'), import * as smartcli from 'smartcli'
mocha: require('gulp-mocha'), import * as smartcov from 'smartcov'
sourcemaps: require('gulp-sourcemaps'), import * as smartenv from 'smartenv'
typedoc: require('gulp-typedoc') import * as smartfile from 'smartfile'
} import * as smartpath from 'smartpath'
export import lodash = require('lodash') import * as smartstream from 'smartstream'
export import npmextra = require('npmextra') import * as smartstring from 'smartstring'
export import projectinfo = require('projectinfo') import * as smartsystem from 'smartsystem'
export import path = require('path') import * as through2 from 'through2'
export import q = require('q')
export import shelljs = require('shelljs')
export import smartchok = require('smartchok')
export import smartcli = require('smartcli')
export import smartcov = require('smartcov')
export import smartenv = require('smartenv')
export import smartfile = require('smartfile')
export import smartpath = require('smartpath')
export import smartstream = require('smartstream')
export import smartstring = require('smartstring')
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 import tsn = require('tsn')
export {
beautylog,
depcheck,
lodash,
npmextra,
projectinfo,
path,
smartcli,
smartcov,
smartenv,
smartfile,
smartpath,
smartstream,
smartstring,
smartsystem,
through2
}

View File

@ -1,51 +0,0 @@
import 'typings-global'
import plugins = require('./npmts.plugins')
import {Ora} from 'beautylog'
export let npmtsOra = new Ora('setting up TaskChain','cyan')
import * as NpmtsAssets from './npmts.assets'
import * as NpmtsCheck from './npmts.check'
import * as NpmtsClean from './npmts.clean'
import * as NpmtsCompile from './npmts.compile'
import * as NpmtsTypeDoc from './npmts.typedoc'
import * as NpmtsOptions from './npmts.options'
import * as NpmtsTests from './npmts.tests'
import * as NpmtsWatch from './npmts.watch'
export let run = function(argvArg){
let done = plugins.q.defer()
npmtsOra.start()
NpmtsOptions.run(argvArg)
.then(NpmtsClean.run)
.then(NpmtsCheck.run)
.then(NpmtsCompile.run)
.then(NpmtsAssets.run)
.then(NpmtsTypeDoc.run)
.then(NpmtsTests.run)
.then(NpmtsWatch.run)
.then(function(configArg){
let shipString = '' +
'\n' +
'\n' +
' # # ( )\n' +
' ___#_#___|__\n' +
' _ |____________| _\n' +
' _=====| | | | | |==== _\n' +
' =====| |.---------------------------. | |====\n' +
" <--------------------' . . . . . . . . '--------------/\n" +
' \\ /\n' +
' \\___________________________________________________________/\n' +
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n' +
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n' +
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n'
if (process.env.CI) {
console.log(shipString)
plugins.beautylog.success('READY TO SHIP!')
} else {
plugins.beautylog.success('Done!')
}
done.resolve(configArg)
})
return done.promise
}

30
ts/npmts.ship.ts Normal file
View File

@ -0,0 +1,30 @@
import * as q from 'smartq'
import * as plugins from './npmts.plugins'
import { INpmtsConfig } from './npmts.config'
export let run = (configArg: INpmtsConfig) => {
let done = q.defer()
let shipString = '' +
'\n' +
'\n' +
' # # ( )\n' +
' ___#_#___|__\n' +
' _ |____________| _\n' +
' _=====| | | | | |==== _\n' +
' =====| |.---------------------------. | |====\n' +
" <--------------------' . . . . . . . . '--------------/\n" +
' \\ /\n' +
' \\___________________________________________________________/\n' +
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n' +
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n' +
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n'
if (process.env.CI) {
console.log(shipString)
plugins.beautylog.success('READY TO SHIP!')
} else {
plugins.beautylog.success('Done!')
}
done.resolve(configArg)
}

View File

@ -1,99 +0,0 @@
import 'typings-global'
import plugins = require('./npmts.plugins')
import paths = require('./npmts.paths')
import { npmtsOra } from './npmts.promisechain'
import { INpmtsConfig } from './npmts.options'
/**
* runs mocha
* @returns INpmtsConfig
*/
let mocha = function (configArg: INpmtsConfig) {
npmtsOra.text('Instrumentalizing and testing transpiled JS')
npmtsOra.end() // end npmtsOra for tests.
let done = plugins.q.defer()
plugins.gulp.src([plugins.path.join(paths.cwd, 'dist/*.js')])
.pipe(plugins.g.sourcemaps.init())
.pipe(plugins.g.babel({
presets: [
require.resolve('babel-preset-es2015')
]
}))
.pipe(plugins.g.istanbul({
}))
.pipe(plugins.g.sourcemaps.write())
.pipe(plugins.g.injectModules())
.on('finish', function () {
let localSmartstream = new plugins.smartstream.Smartstream([
plugins.gulp.src([plugins.path.join(paths.cwd, 'test/test.js')]),
plugins.g.babel({
presets: [
require.resolve('babel-preset-es2015')
]
}),
plugins.g.injectModules(),
plugins.g.mocha(),
plugins.g.istanbul.writeReports({
dir: plugins.path.join(paths.cwd, './coverage'),
reporters: ['lcovonly', 'json', 'text', 'text-summary']
})
])
localSmartstream.run()
.then(() => { done.resolve(configArg) }, (err) => {
plugins.beautylog.error('Tests failed!')
if (configArg.watch) {
done.resolve(configArg)
} else {
process.exit(1)
}
})
})
return done.promise
}
let coverage = function (configArg: INpmtsConfig) {
let done = plugins.q.defer()
plugins.smartcov.get.percentage(plugins.path.join(paths.coverageDir, 'lcov.info'), 2)
.then(function (percentageArg) {
if (percentageArg >= configArg.coverageTreshold) {
plugins.beautylog.ok(
`${percentageArg.toString()}% `
+ `coverage exceeds your treshold of `
+ `${configArg.coverageTreshold.toString()}%`
)
} else {
plugins.beautylog.warn(
`${percentageArg.toString()}% `
+ `coverage fails your treshold of `
+ `${configArg.coverageTreshold.toString()}%`
)
plugins.beautylog.error('exiting due to coverage failure')
if (!configArg.watch) { process.exit(1) }
}
done.resolve(configArg)
})
return done.promise
}
export let run = function (configArg: INpmtsConfig) {
let done = plugins.q.defer()
let config = configArg
if (config.test === true) {
npmtsOra.text('now starting tests')
plugins.beautylog.log(
'-------------------------------------------------------\n' +
'*************************** TESTS: ***************************\n' +
'--------------------------------------------------------------'
)
mocha(config)
.then(coverage)
.then(() => {
done.resolve(config)
})
} else {
npmtsOra.end()
done.resolve(config)
}
return done.promise
}

View File

@ -1,45 +0,0 @@
import 'typings-global'
import plugins = require('./npmts.plugins')
import paths = require('./npmts.paths')
import { npmtsOra } from './npmts.promisechain'
import { projectInfo } from './npmts.check'
let genTypeDoc = function (configArg) {
let done = plugins.q.defer()
npmtsOra.text('now generating ' + 'TypeDoc documentation'.yellow)
plugins.beautylog.log('TypeDoc Output:')
plugins.gulp.src(plugins.path.join(paths.tsDir, '**/*.ts'))
.pipe(plugins.g.typedoc({
// 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",
ignoreCompilerErrors: true,
version: true
}))
.pipe(plugins.g.gFunction(done.resolve, 'atEnd'))
return done.promise
}
export let run = function (configArg) {
let done = plugins.q.defer()
if (configArg.docs) {
genTypeDoc(configArg)
.then(() => {
done.resolve(configArg)
})
} else {
done.resolve(configArg)
};
return done.promise
}

View File

@ -1,10 +1,14 @@
import * as plugins from './npmts.plugins' import * as q from 'smartq'
import * as promisechain from './npmts.promisechain' import * as smartchok from 'smartchok'
let npmtsSmartchok: plugins.smartchok.Smartchok = null
import { INpmtsConfig } from './npmts.options'
import * as plugins from './npmts.plugins'
import * as cli from './npmts.cli'
import { INpmtsConfig } from './npmts.config'
let npmtsSmartchok: smartchok.Smartchok = null
export let run = (configArg: INpmtsConfig) => { export let run = (configArg: INpmtsConfig) => {
let done = plugins.q.defer() let done = q.defer()
if (configArg.watch && npmtsSmartchok === null) { if (configArg.watch && npmtsSmartchok === null) {
let pathsToWatch: string[] = [] let pathsToWatch: string[] = []
for (let key in configArg.ts) { for (let key in configArg.ts) {
@ -13,16 +17,17 @@ export let run = (configArg: INpmtsConfig) => {
for (let key in configArg.testTs) { for (let key in configArg.testTs) {
pathsToWatch.push(key) pathsToWatch.push(key)
} }
npmtsSmartchok = new plugins.smartchok.Smartchok(pathsToWatch) npmtsSmartchok = new smartchok.Smartchok(pathsToWatch)
npmtsSmartchok.getObservableFor('change').then((changeObservableArg) => { npmtsSmartchok.getObservableFor('change').then((changeObservableArg) => {
plugins.beautylog.info('now watching...') plugins.beautylog.info('now watching...')
changeObservableArg.subscribe(() => { changeObservableArg.subscribe(() => {
promisechain.run(configArg) cli.run()
}) })
}) })
npmtsSmartchok.start() npmtsSmartchok.start()
done.resolve(configArg) done.resolve(configArg)
} else { } else {
plugins.beautylog.info('not watching')
done.resolve(configArg) done.resolve(configArg)
} }
return done.promise return done.promise

3467
yarn.lock Normal file

File diff suppressed because it is too large Load Diff