change npmts package name to being @gitzone scoped
This commit is contained in:
parent
7e46b55de5
commit
896e0095fa
@ -7,20 +7,28 @@ cache:
|
||||
key: "$CI_BUILD_STAGE"
|
||||
|
||||
stages:
|
||||
- mirror
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- trigger
|
||||
- pages
|
||||
|
||||
mirror:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: mirror
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
tags:
|
||||
- docker
|
||||
|
||||
snyk:
|
||||
stage: security
|
||||
script:
|
||||
- npmci command yarn global add snyk
|
||||
- npmci command yarn install --ignore-scripts
|
||||
- npmci command snyk test
|
||||
tags:
|
||||
- docker
|
||||
|
||||
testLEGACY:
|
||||
stage: test
|
||||
script:
|
||||
@ -76,7 +84,7 @@ pages:
|
||||
stage: pages
|
||||
script:
|
||||
- npmci command yarn global add npmpage
|
||||
- npmci command npmpage --publish gitlab
|
||||
- npmci command npmpage
|
||||
tags:
|
||||
- docker
|
||||
only:
|
||||
|
3
dist/index.js
vendored
3
dist/index.js
vendored
@ -8,8 +8,7 @@ const early = require("early");
|
||||
early.start('NPMTS');
|
||||
const plugins = require("./npmts.plugins");
|
||||
const cli = require("./npmts.cli");
|
||||
early.stop()
|
||||
.then(() => {
|
||||
early.stop().then(() => {
|
||||
let loaded = plugins; // to make sure plugins get actually loaded
|
||||
cli.run();
|
||||
});
|
||||
|
11
dist/mod_compile/mod.check.js
vendored
11
dist/mod_compile/mod.check.js
vendored
@ -26,13 +26,16 @@ let checkProjectTypings = (configArg) => {
|
||||
const depcheckOptions = {
|
||||
ignoreBinPackage: false,
|
||||
parsers: {
|
||||
// the target parsers
|
||||
'*.ts': plugins.depcheck.parser.typescript
|
||||
},
|
||||
detectors: [
|
||||
// the target detectors
|
||||
plugins.depcheck.detector.requireCallExpression,
|
||||
plugins.depcheck.detector.importDeclaration
|
||||
],
|
||||
specials: [
|
||||
// the target special parsers
|
||||
plugins.depcheck.special.eslint,
|
||||
plugins.depcheck.special.webpack
|
||||
]
|
||||
@ -42,16 +45,18 @@ let checkDependencies = (configArg) => {
|
||||
plugins.beautylog.ora.text('Check Module: Check Dependencies...');
|
||||
let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, {
|
||||
ignoreDirs: [
|
||||
// folder with these names will be ignored
|
||||
'test',
|
||||
'dist',
|
||||
'bower_components'
|
||||
],
|
||||
ignoreMatches: [
|
||||
// ignore dependencies that matches these globs
|
||||
'@types/*',
|
||||
'babel-preset-*'
|
||||
]
|
||||
});
|
||||
plugins.depcheck(paths.cwd, depcheckOptionsMerged, (unused) => {
|
||||
plugins.depcheck(paths.cwd, depcheckOptionsMerged, unused => {
|
||||
for (let item of unused.dependencies) {
|
||||
plugins.beautylog.warn(`Watch out: unused dependency "${item}"`);
|
||||
}
|
||||
@ -77,16 +82,18 @@ let checkDevDependencies = (configArg) => {
|
||||
plugins.beautylog.ora.text('Check Module: Check devDependencies...');
|
||||
let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, {
|
||||
ignoreDirs: [
|
||||
// folder with these names will be ignored
|
||||
'ts',
|
||||
'dist',
|
||||
'bower_components'
|
||||
],
|
||||
ignoreMatches: [
|
||||
// ignore dependencies that matches these globs
|
||||
'@types/*',
|
||||
'babel-preset-*'
|
||||
]
|
||||
});
|
||||
plugins.depcheck(paths.cwd, depcheckOptionsMerged, (unused) => {
|
||||
plugins.depcheck(paths.cwd, depcheckOptionsMerged, unused => {
|
||||
for (let item of unused.devDependencies) {
|
||||
plugins.beautylog.log(`unused devDependency ${item}`);
|
||||
}
|
||||
|
8
dist/mod_compile/mod.compile.js
vendored
8
dist/mod_compile/mod.compile.js
vendored
@ -7,10 +7,14 @@ exports.run = function (configArg) {
|
||||
let done = q.defer();
|
||||
let config = configArg;
|
||||
plugins.beautylog.ora.text('now compiling ' + 'TypeScript');
|
||||
plugins.tsn.compileGlobStringObject(config.ts, config.tsOptions, paths.cwd)
|
||||
plugins.tsn
|
||||
.compileGlobStringObject(config.ts, config.tsOptions, paths.cwd)
|
||||
.then(() => {
|
||||
plugins.beautylog.ok(`compiled the module's TypeScript!`);
|
||||
done.resolve(config);
|
||||
}).catch(err => { console.log(err); });
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
|
34
dist/mod_test/index.js
vendored
34
dist/mod_test/index.js
vendored
@ -18,10 +18,7 @@ let testTypeScriptConfig = {
|
||||
target: 'ES5',
|
||||
emitDecoratorMetadata: true,
|
||||
experimentalDecorators: true,
|
||||
lib: [
|
||||
'DOM',
|
||||
'ESNext'
|
||||
]
|
||||
lib: ['DOM', 'ESNext']
|
||||
};
|
||||
/**
|
||||
* runs mocha
|
||||
@ -57,13 +54,10 @@ let tap = function (configArg) {
|
||||
plugins.smartstream.cleanPipe()
|
||||
]);
|
||||
// lets run the smartstream
|
||||
Promise.all([
|
||||
testableFilesSmartstream.run(),
|
||||
testFilesSmartstream.run()
|
||||
]).then(() => __awaiter(this, void 0, void 0, function* () {
|
||||
Promise.all([testableFilesSmartstream.run(), testFilesSmartstream.run()]).then(() => __awaiter(this, void 0, void 0, function* () {
|
||||
configArg.runData.coverageLcovInfo = yield npmtsTapBuffer.runTests();
|
||||
done.resolve(configArg);
|
||||
}), (err) => {
|
||||
}), err => {
|
||||
plugins.beautylog.error('Tests failed!');
|
||||
console.log(err);
|
||||
if (configArg.watch) {
|
||||
@ -84,14 +78,14 @@ let handleCoverageData = (configArg) => __awaiter(this, void 0, void 0, function
|
||||
plugins.beautylog.warn('Hey... Did your tests import and use your module that you are trying to test?');
|
||||
}
|
||||
if (coverageResult >= configArg.coverageTreshold) {
|
||||
plugins.beautylog.ok(`${(coverageResult).toString()}% `
|
||||
+ `coverage exceeds your treshold of `
|
||||
+ `${configArg.coverageTreshold.toString()}%`);
|
||||
plugins.beautylog.ok(`${coverageResult.toString()}% ` +
|
||||
`coverage exceeds your treshold of ` +
|
||||
`${configArg.coverageTreshold.toString()}%`);
|
||||
}
|
||||
else {
|
||||
plugins.beautylog.warn(`${(coverageResult).toString()}% `
|
||||
+ `coverage fails your treshold of `
|
||||
+ `${configArg.coverageTreshold.toString()}%`);
|
||||
plugins.beautylog.warn(`${coverageResult.toString()}% ` +
|
||||
`coverage fails your treshold of ` +
|
||||
`${configArg.coverageTreshold.toString()}%`);
|
||||
plugins.beautylog.error('exiting due to coverage failure');
|
||||
if (!configArg.watch) {
|
||||
process.exit(1);
|
||||
@ -111,13 +105,19 @@ exports.run = function (configArg) {
|
||||
.then(handleCoverageData)
|
||||
.then(() => {
|
||||
done.resolve(config);
|
||||
}).catch(err => { console.log(err); });
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
else {
|
||||
tap(config)
|
||||
.then(() => {
|
||||
done.resolve(config);
|
||||
}).catch(err => { console.log(err); });
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
28
dist/npmts.cli.js
vendored
28
dist/npmts.cli.js
vendored
@ -33,12 +33,14 @@ let npmtsAnalytics = new plugins.smartanalytics.Analytics({
|
||||
});
|
||||
process.nextTick(() => __awaiter(this, void 0, void 0, function* () {
|
||||
// make the analytics call
|
||||
npmtsAnalytics.recordEvent('npmToolExecution', {
|
||||
npmtsAnalytics
|
||||
.recordEvent('npmToolExecution', {
|
||||
executionMode: (yield NpmtsConfig.configPromise).mode,
|
||||
tsOptions: (yield NpmtsConfig.configPromise).tsOptions,
|
||||
watch: (yield NpmtsConfig.configPromise).watch,
|
||||
coverageTreshold: (yield NpmtsConfig.configPromise).coverageTreshold
|
||||
}).catch(err => {
|
||||
})
|
||||
.catch(err => {
|
||||
plugins.beautylog.warn('Lossless Analytics API not available...');
|
||||
});
|
||||
}));
|
||||
@ -50,21 +52,24 @@ exports.run = () => __awaiter(this, void 0, void 0, function* () {
|
||||
yield plugins.smartupdate.standardHandler.check('npmts', npmtsProjectInfo.version, 'http://gitzone.gitlab.io/npmts/changelog.html');
|
||||
plugins.beautylog.log('---------------------------------------------');
|
||||
let npmtsCli = new plugins.smartcli.Smartcli();
|
||||
npmtsCli.standardTask()
|
||||
.then((argvArg) => {
|
||||
npmtsCli
|
||||
.standardTask()
|
||||
.then(argvArg => {
|
||||
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.modCompile.load()
|
||||
.then((modCompile) => {
|
||||
NpmtsMods.modCompile
|
||||
.load()
|
||||
.then(modCompile => {
|
||||
return modCompile.run(configArg);
|
||||
})
|
||||
.then(configArg => {
|
||||
let done = q.defer();
|
||||
NpmtsMods.modDocs.load()
|
||||
NpmtsMods.modDocs
|
||||
.load()
|
||||
.then(modDocs => {
|
||||
return modDocs.run(configArg);
|
||||
})
|
||||
@ -75,7 +80,8 @@ exports.run = () => __awaiter(this, void 0, void 0, function* () {
|
||||
})
|
||||
.then(configArg => {
|
||||
let done = q.defer();
|
||||
NpmtsMods.modTest.load()
|
||||
NpmtsMods.modTest
|
||||
.load()
|
||||
.then(modTest => {
|
||||
return modTest.run(configArg);
|
||||
})
|
||||
@ -88,9 +94,11 @@ exports.run = () => __awaiter(this, void 0, void 0, function* () {
|
||||
.then(NpmtsShip.run);
|
||||
return done.promise;
|
||||
})
|
||||
.catch((err) => { if (err instanceof Error) {
|
||||
.catch(err => {
|
||||
if (err instanceof Error) {
|
||||
console.log(err);
|
||||
} });
|
||||
}
|
||||
});
|
||||
npmtsCli.addVersion(npmtsProjectInfo.version);
|
||||
npmtsCli.startParse();
|
||||
return yield done.promise;
|
||||
|
2
dist/npmts.watch.js
vendored
2
dist/npmts.watch.js
vendored
@ -16,7 +16,7 @@ exports.run = (configArg) => {
|
||||
pathsToWatch.push(key);
|
||||
}
|
||||
npmtsSmartchok = new smartchok.Smartchok(pathsToWatch);
|
||||
npmtsSmartchok.getObservableFor('change').then((changeObservableArg) => {
|
||||
npmtsSmartchok.getObservableFor('change').then(changeObservableArg => {
|
||||
plugins.beautylog.info('now watching...');
|
||||
changeObservableArg.subscribe(() => {
|
||||
cli.run();
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
## 2017-07-30: Version 7.x.x -> 8.x.x
|
||||
|
||||
Testfiles in ./test/ can now import files directly from the ts dir:
|
||||
|
||||
```javascript
|
||||
|
@ -1,15 +1,19 @@
|
||||
---
|
||||
name: config
|
||||
---
|
||||
|
||||
# Configuration
|
||||
|
||||
npmts can be configured to your needs.
|
||||
|
||||
### npmextra.json
|
||||
|
||||
the npmts section in npmextra.json can be used to configure npmts.
|
||||
|
||||
**Default**
|
||||
|
||||
> Note: When you are using `"mode":"default"` it'll cause npmts to override any other settings you may have made except for tsOptions (ES target etc.)
|
||||
with default behaviour.
|
||||
> with default behaviour.
|
||||
|
||||
```json
|
||||
{
|
||||
@ -20,6 +24,7 @@ with default behaviour.
|
||||
```
|
||||
|
||||
**Custom settings**
|
||||
|
||||
```json
|
||||
{
|
||||
"mode": "custom",
|
||||
@ -38,7 +43,7 @@ with default behaviour.
|
||||
```
|
||||
|
||||
| key | default value | description |
|
||||
| --- | --- | --- |
|
||||
| -------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `"mode"` | `"default"` | "default" will do default stuff and override , "custom" only does what you specify, "merge" will merge default options with whatever you specify on your own |
|
||||
| `"test"` | `true` | test your module |
|
||||
| `"ts"` | `{"./ts/*.ts":"./","./test/test.ts":"./test/"}` | allows you to define multiple ts portions |
|
||||
@ -47,12 +52,14 @@ with default behaviour.
|
||||
| `"testConfig"` | `{ parallel: true, coverage: true }` | allows you to control test behaviour. `"parallel"` controls wether testfiles are run sequentially or in parallel, and `"coverage` wether to create coverage reports |
|
||||
|
||||
### TypeScript
|
||||
|
||||
by default npmts looks for `./ts/*.ts` and `./test/test.ts` that will compile to
|
||||
`./dist/*.js` and `./test/test.js`
|
||||
|
||||
Use commonjs module system for wiring up files.
|
||||
|
||||
### Declaration files
|
||||
|
||||
**npmts** also creates declaration files like `./dist/index.d.ts` by default.
|
||||
You can reference it in your package.json like this.
|
||||
|
||||
@ -66,12 +73,16 @@ You can then import plugins via the TypeScript `import` Syntax
|
||||
and tsc will pick up the declaration file automatically.
|
||||
|
||||
## Some notes:
|
||||
|
||||
#### 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.
|
||||
|
||||
#### Instrumentalize Code
|
||||
|
||||
npmts instrumentalizes (using istanbul) the created JavaScript code to create a coverage report.
|
||||
|
||||
#### Tests
|
||||
|
||||
Any errors will be shown with reference to their originating source in TypeScript
|
||||
thanks to autogenerated source maps.
|
@ -1,7 +1,9 @@
|
||||
---
|
||||
name: Default Behaviour
|
||||
---
|
||||
|
||||
# Default Behaviour
|
||||
|
||||
when you don't configure it otherwise.
|
||||
|
||||
1. **Config:** Check config in ./npmextra.json (Check out [npmextra](https://www.npmjs.com/package/npmextra))
|
||||
|
@ -1,15 +1,17 @@
|
||||
---
|
||||
name: Examples
|
||||
---
|
||||
|
||||
# Examples
|
||||
|
||||
modules that use npmts in theis development workflow
|
||||
|
||||
Module Name | Description
|
||||
--- | ---
|
||||
[gitzone](https://www.npmjs.com/package/gitzone) | fast npm module prototyping
|
||||
[gulp-browser](https://www.npmjs.com/package/gulp-browser) | browserify for gulp
|
||||
[npmdocker](https://www.npmjs.com/package/npmdocker) | dockerized npm development
|
||||
[smartcli](https://www.npmjs.com/package/smartcli) | easy cli tool creation
|
||||
| Module Name | Description |
|
||||
| ---------------------------------------------------------- | --------------------------- |
|
||||
| [gitzone](https://www.npmjs.com/package/gitzone) | fast npm module prototyping |
|
||||
| [gulp-browser](https://www.npmjs.com/package/gulp-browser) | browserify for gulp |
|
||||
| [npmdocker](https://www.npmjs.com/package/npmdocker) | dockerized npm development |
|
||||
| [smartcli](https://www.npmjs.com/package/smartcli) | easy cli tool creation |
|
||||
|
||||
> There are tons more... We will add them here over time.
|
||||
|
||||
|
@ -2,7 +2,9 @@
|
||||
name: Get Started
|
||||
description: learn how to quickly write npm TypeScript modules
|
||||
---
|
||||
|
||||
# Get Started with NPMTS
|
||||
|
||||
and learn how to quickly write npm TypeScript modules
|
||||
|
||||
## Step1: Install the tools
|
||||
|
@ -2,16 +2,20 @@
|
||||
name: Index
|
||||
description: best practice npm TypeScript modules
|
||||
---
|
||||
|
||||
# npmts
|
||||
|
||||
best practice npm TypeScript modules
|
||||
|
||||
## Availabililty
|
||||
|
||||
[![npm](https://gitzone.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/npmts)
|
||||
[![git](https://gitzone.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/gitzone/npmts)
|
||||
[![git](https://gitzone.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/gitzone/npmts)
|
||||
[![docs](https://gitzone.gitlab.io/assets/repo-button-docs.svg)](https://gitzone.gitlab.io/npmts/)
|
||||
|
||||
## Status for master
|
||||
|
||||
[![build status](https://GitLab.com/gitzone/npmts/badges/master/build.svg)](https://GitLab.com/gitzone/npmts/commits/master)
|
||||
[![coverage report](https://GitLab.com/gitzone/npmts/badges/master/coverage.svg)](https://GitLab.com/gitzone/npmts/commits/master)
|
||||
[![npm downloads per month](https://img.shields.io/npm/dm/npmts.svg)](https://www.npmjs.com/package/npmts)
|
||||
@ -23,9 +27,11 @@ best practice npm TypeScript modules
|
||||
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
|
||||
|
||||
## Quick Demo
|
||||
|
||||
[![asciicast](https://asciinema.org/a/9c3assmh21i49qhe5lmi48sze.png)](https://asciinema.org/a/9c3assmh21i49qhe5lmi48sze?speed=2&t=0)
|
||||
|
||||
## Usage
|
||||
|
||||
NPMTS is your friend when writing, testing, publishing and documenting npm modules written in TypeScript.
|
||||
|
||||
npmts will
|
||||
@ -41,6 +47,6 @@ 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/)
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
|
||||
[![repo-footer](https://gitzone.gitlab.io/assets/repo-footer.svg)](https:/git.zone)
|
||||
|
@ -1,8 +1,9 @@
|
||||
# Install npmts
|
||||
|
||||
Get started with TypeScript awesomeness.
|
||||
|
||||
> **npmts-g* checks if the global version of npmts suffices the modules requirements.
|
||||
If not it installs npmts locally in the right version during npm install.
|
||||
> \*_npmts-g_ checks if the global version of npmts suffices the modules requirements.
|
||||
> If not it installs npmts locally in the right version during npm install.
|
||||
|
||||
```sh
|
||||
npm install npmts -g # installs npmts globally
|
||||
|
@ -2,6 +2,7 @@
|
||||
name: npmts project structure
|
||||
description: how npmts projects are structured
|
||||
---
|
||||
|
||||
# npmts - Project Structure
|
||||
|
||||
**locally**
|
||||
|
5
npmextra.json
Normal file
5
npmextra.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"npmci": {
|
||||
"npmAccessLevell": "public"
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "npmts",
|
||||
"name": "@gitzone/npmts",
|
||||
"version": "8.0.27",
|
||||
"description": "best practice npm TypeScript modules",
|
||||
"main": "dist/index.js",
|
||||
|
14
readme.md
14
readme.md
@ -1,27 +1,32 @@
|
||||
# npmts
|
||||
|
||||
best practice npm TypeScript modules
|
||||
|
||||
## Availabililty
|
||||
[![npm](https://gitzone.gitlab.io/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/@gitzone/npmts)
|
||||
[![git](https://gitzone.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/gitzone/npmts)
|
||||
[![git](https://gitzone.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/gitzone/npmts)
|
||||
[![docs](https://gitzone.gitlab.io/assets/repo-button-docs.svg)](https://gitzone.gitlab.io/npmts/)
|
||||
|
||||
## Status for master
|
||||
|
||||
[![build status](https://GitLab.com/gitzone/npmts/badges/master/build.svg)](https://GitLab.com/gitzone/npmts/commits/master)
|
||||
[![coverage report](https://GitLab.com/gitzone/npmts/badges/master/coverage.svg)](https://GitLab.com/gitzone/npmts/commits/master)
|
||||
[![npm downloads per month](https://img.shields.io/npm/dm/npmts.svg)](https://www.npmjs.com/package/npmts)
|
||||
[![Dependency Status](https://david-dm.org/gitzonetools/npmts.svg)](https://david-dm.org/gitzonetools/npmts)
|
||||
[![npm downloads per month](https://img.shields.io/npm/dm/@gitzone/npmts.svg)](https://www.npmjs.com/package/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)
|
||||
[![Known Vulnerabilities](https://snyk.io/test/npm/@gitzone/npmts/badge.svg)]
|
||||
[![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/)
|
||||
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
|
||||
|
||||
## Quick Demo
|
||||
|
||||
[![asciicast](https://asciinema.org/a/9c3assmh21i49qhe5lmi48sze.png)](https://asciinema.org/a/9c3assmh21i49qhe5lmi48sze?speed=2&t=0)
|
||||
|
||||
## Usage
|
||||
|
||||
NPMTS is your friend when writing, testing, publishing and documenting npm modules written in TypeScript.
|
||||
|
||||
npmts will
|
||||
@ -39,11 +44,12 @@ 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/)
|
||||
|
||||
## Changelog
|
||||
|
||||
For breaking changes please see the [changelog](https://gitzone.gitlab.io/npmts/changelog.html).
|
||||
|
||||
For further information read the linked docs at the top of this README.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
|
||||
[![repo-footer](https://gitzone.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
|
||||
|
17
ts/index.ts
17
ts/index.ts
@ -3,12 +3,11 @@
|
||||
Fabulous TypeScript development
|
||||
* ================================================== */
|
||||
|
||||
import * as early from 'early'
|
||||
early.start('NPMTS')
|
||||
import * as plugins from './npmts.plugins'
|
||||
import * as cli from './npmts.cli'
|
||||
early.stop()
|
||||
.then(() => {
|
||||
let loaded = plugins // to make sure plugins get actually loaded
|
||||
cli.run()
|
||||
})
|
||||
import * as early from 'early';
|
||||
early.start('NPMTS');
|
||||
import * as plugins from './npmts.plugins';
|
||||
import * as cli from './npmts.cli';
|
||||
early.stop().then(() => {
|
||||
let loaded = plugins; // to make sure plugins get actually loaded
|
||||
cli.run();
|
||||
});
|
||||
|
@ -2,26 +2,26 @@
|
||||
* This module compiles the module's TypeScript files
|
||||
* Note: Test files are only compiled in memory
|
||||
* -------------------------------------------- */
|
||||
import * as q from 'smartq'
|
||||
import * as q from 'smartq';
|
||||
|
||||
import { INpmtsConfig } from '../npmts.config'
|
||||
import { INpmtsConfig } from '../npmts.config';
|
||||
|
||||
import * as plugins from './mod.plugins'
|
||||
import * as plugins from './mod.plugins';
|
||||
|
||||
import * as NpmtsAssets from './mod.assets'
|
||||
import * as NpmtsCheck from './mod.check'
|
||||
import * as NpmtsClean from './mod.clean'
|
||||
import * as NpmtsCompile from './mod.compile'
|
||||
import * as NpmtsAssets from './mod.assets';
|
||||
import * as NpmtsCheck from './mod.check';
|
||||
import * as NpmtsClean from './mod.clean';
|
||||
import * as NpmtsCompile from './mod.compile';
|
||||
|
||||
export let run = function(configArg: INpmtsConfig): Promise<INpmtsConfig> {
|
||||
let done = q.defer<INpmtsConfig>()
|
||||
plugins.beautylog.ora.text('starting TypeScript Compilation')
|
||||
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
|
||||
}
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
|
@ -1,24 +1,26 @@
|
||||
import * as q from 'smartq'
|
||||
import * as q from 'smartq';
|
||||
|
||||
import paths = require('../npmts.paths')
|
||||
import paths = require('../npmts.paths');
|
||||
|
||||
import plugins = require('./mod.plugins')
|
||||
import { projectInfo } from '../mod_compile/mod.check'
|
||||
import plugins = require('./mod.plugins');
|
||||
import { projectInfo } from '../mod_compile/mod.check';
|
||||
|
||||
export let run = function(configArg) {
|
||||
let done = q.defer()
|
||||
let config = configArg
|
||||
plugins.beautylog.ora.text('now looking at ' + 'required assets')
|
||||
let done = q.defer();
|
||||
let config = configArg;
|
||||
plugins.beautylog.ora.text('now looking at ' + 'required assets');
|
||||
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)
|
||||
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
|
||||
plugins.beautylog.ok('No additional assets required!');
|
||||
done.resolve(config);
|
||||
}
|
||||
return done.promise;
|
||||
};
|
||||
|
@ -1,132 +1,139 @@
|
||||
import * as q from 'smartq'
|
||||
import { ProjectinfoNpm } from 'projectinfo'
|
||||
import * as q from 'smartq';
|
||||
import { ProjectinfoNpm } from 'projectinfo';
|
||||
|
||||
// interfaces
|
||||
import { INpmtsConfig } from '../npmts.config'
|
||||
import { INpmtsConfig } from '../npmts.config';
|
||||
|
||||
import * as paths from '../npmts.paths'
|
||||
import * as paths from '../npmts.paths';
|
||||
|
||||
import * as plugins from './mod.plugins'
|
||||
import * as plugins from './mod.plugins';
|
||||
|
||||
export let projectInfo: ProjectinfoNpm
|
||||
export let projectInfo: ProjectinfoNpm;
|
||||
|
||||
let checkProjectTypings = (configArg: INpmtsConfig) => {
|
||||
let done = q.defer<INpmtsConfig>()
|
||||
plugins.beautylog.ora.text('Check Module: Check Project Typings...')
|
||||
projectInfo = new ProjectinfoNpm(paths.cwd)
|
||||
let done = q.defer<INpmtsConfig>();
|
||||
plugins.beautylog.ora.text('Check Module: Check Project Typings...');
|
||||
projectInfo = new ProjectinfoNpm(paths.cwd);
|
||||
if (typeof projectInfo.packageJson.typings === 'undefined') {
|
||||
plugins.beautylog.error(`please add typings field to package.json`)
|
||||
process.exit(1)
|
||||
}
|
||||
done.resolve(configArg)
|
||||
return done.promise
|
||||
plugins.beautylog.error(`please add typings field to package.json`);
|
||||
process.exit(1);
|
||||
}
|
||||
done.resolve(configArg);
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
const depcheckOptions = {
|
||||
ignoreBinPackage: false, // ignore the packages with bin entry
|
||||
parsers: { // the target parsers
|
||||
parsers: {
|
||||
// the target parsers
|
||||
'*.ts': plugins.depcheck.parser.typescript
|
||||
},
|
||||
detectors: [ // the target detectors
|
||||
detectors: [
|
||||
// the target detectors
|
||||
plugins.depcheck.detector.requireCallExpression,
|
||||
plugins.depcheck.detector.importDeclaration
|
||||
],
|
||||
specials: [ // the target special parsers
|
||||
specials: [
|
||||
// the target special parsers
|
||||
plugins.depcheck.special.eslint,
|
||||
plugins.depcheck.special.webpack
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
let checkDependencies = (configArg: INpmtsConfig) => {
|
||||
let done = q.defer<INpmtsConfig>()
|
||||
plugins.beautylog.ora.text('Check Module: Check Dependencies...')
|
||||
let done = q.defer<INpmtsConfig>();
|
||||
plugins.beautylog.ora.text('Check Module: Check Dependencies...');
|
||||
let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, {
|
||||
ignoreDirs: [ // folder with these names will be ignored
|
||||
ignoreDirs: [
|
||||
// folder with these names will be ignored
|
||||
'test',
|
||||
'dist',
|
||||
'bower_components'
|
||||
],
|
||||
ignoreMatches: [ // ignore dependencies that matches these globs
|
||||
ignoreMatches: [
|
||||
// ignore dependencies that matches these globs
|
||||
'@types/*',
|
||||
'babel-preset-*'
|
||||
]
|
||||
})
|
||||
plugins.depcheck(paths.cwd, depcheckOptionsMerged, (unused) => {
|
||||
});
|
||||
plugins.depcheck(paths.cwd, depcheckOptionsMerged, unused => {
|
||||
for (let item of unused.dependencies) {
|
||||
plugins.beautylog.warn(`Watch out: unused dependency "${item}"`)
|
||||
plugins.beautylog.warn(`Watch out: unused dependency "${item}"`);
|
||||
}
|
||||
for (let item in unused.missing) {
|
||||
plugins.beautylog.error(`missing dependency "${item}" in package.json`)
|
||||
plugins.beautylog.error(`missing dependency "${item}" in package.json`);
|
||||
}
|
||||
if (unused.missing.length > 0) {
|
||||
plugins.beautylog.info('exiting due to missing dependencies in package.json')
|
||||
process.exit(1)
|
||||
plugins.beautylog.info('exiting due to missing dependencies in package.json');
|
||||
process.exit(1);
|
||||
}
|
||||
for (let item in unused.invalidFiles) {
|
||||
plugins.beautylog.warn(`Watch out: could not parse file ${item}`)
|
||||
plugins.beautylog.warn(`Watch out: could not parse file ${item}`);
|
||||
}
|
||||
for (let item in unused.invalidDirs) {
|
||||
plugins.beautylog.warn(`Watch out: could not parse directory ${item}`)
|
||||
}
|
||||
done.resolve(configArg)
|
||||
})
|
||||
return done.promise
|
||||
plugins.beautylog.warn(`Watch out: could not parse directory ${item}`);
|
||||
}
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
let checkDevDependencies = (configArg: INpmtsConfig) => {
|
||||
let done = q.defer<INpmtsConfig>()
|
||||
plugins.beautylog.ora.text('Check Module: Check devDependencies...')
|
||||
let done = q.defer<INpmtsConfig>();
|
||||
plugins.beautylog.ora.text('Check Module: Check devDependencies...');
|
||||
let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, {
|
||||
ignoreDirs: [ // folder with these names will be ignored
|
||||
ignoreDirs: [
|
||||
// folder with these names will be ignored
|
||||
'ts',
|
||||
'dist',
|
||||
'bower_components'
|
||||
],
|
||||
ignoreMatches: [ // ignore dependencies that matches these globs
|
||||
ignoreMatches: [
|
||||
// ignore dependencies that matches these globs
|
||||
'@types/*',
|
||||
'babel-preset-*'
|
||||
]
|
||||
})
|
||||
plugins.depcheck(paths.cwd, depcheckOptionsMerged, (unused) => {
|
||||
});
|
||||
plugins.depcheck(paths.cwd, depcheckOptionsMerged, unused => {
|
||||
for (let item of unused.devDependencies) {
|
||||
plugins.beautylog.log(`unused devDependency ${item}`)
|
||||
plugins.beautylog.log(`unused devDependency ${item}`);
|
||||
}
|
||||
for (let item in unused.missing) {
|
||||
plugins.beautylog.error(`missing devDependency ${item}`)
|
||||
plugins.beautylog.error(`missing devDependency ${item}`);
|
||||
}
|
||||
if (unused.missing.length > 0) {
|
||||
plugins.beautylog.info('exiting due to missing dependencies in package.json')
|
||||
process.exit(1)
|
||||
plugins.beautylog.info('exiting due to missing dependencies in package.json');
|
||||
process.exit(1);
|
||||
}
|
||||
for (let item in unused.invalidFiles) {
|
||||
plugins.beautylog.warn(`Watch out: could not parse file ${item}`)
|
||||
plugins.beautylog.warn(`Watch out: could not parse file ${item}`);
|
||||
}
|
||||
for (let item in unused.invalidDirs) {
|
||||
plugins.beautylog.warn(`Watch out: could not parse directory ${item}`)
|
||||
}
|
||||
done.resolve(configArg)
|
||||
})
|
||||
return done.promise
|
||||
plugins.beautylog.warn(`Watch out: could not parse directory ${item}`);
|
||||
}
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
let checkNodeVersion = (configArg: INpmtsConfig) => {
|
||||
let done = q.defer<INpmtsConfig>()
|
||||
plugins.beautylog.ora.text('checking node version')
|
||||
done.resolve(configArg)
|
||||
return done.promise
|
||||
}
|
||||
let done = q.defer<INpmtsConfig>();
|
||||
plugins.beautylog.ora.text('checking node version');
|
||||
done.resolve(configArg);
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
export let run = async (configArg: INpmtsConfig) => {
|
||||
plugins.beautylog.ora.text('Check Module: ...')
|
||||
plugins.beautylog.ora.text('Check Module: ...');
|
||||
|
||||
if (configArg.checkDependencies) {
|
||||
configArg = await checkProjectTypings(configArg)
|
||||
configArg = await checkDependencies(configArg)
|
||||
configArg = await checkDevDependencies(configArg)
|
||||
configArg = await checkNodeVersion(configArg)
|
||||
return configArg
|
||||
configArg = await checkProjectTypings(configArg);
|
||||
configArg = await checkDependencies(configArg);
|
||||
configArg = await checkDevDependencies(configArg);
|
||||
configArg = await checkNodeVersion(configArg);
|
||||
return configArg;
|
||||
} else {
|
||||
configArg = await checkProjectTypings(configArg)
|
||||
return configArg
|
||||
}
|
||||
configArg = await checkProjectTypings(configArg);
|
||||
return configArg;
|
||||
}
|
||||
};
|
||||
|
@ -1,32 +1,32 @@
|
||||
import * as q from 'smartq'
|
||||
import paths = require('../npmts.paths')
|
||||
import * as q from 'smartq';
|
||||
import paths = require('../npmts.paths');
|
||||
|
||||
import plugins = require('./mod.plugins')
|
||||
import plugins = require('./mod.plugins');
|
||||
|
||||
/**
|
||||
* removes the dist directory which will be entirely rebuild
|
||||
*/
|
||||
let removeDist = function() {
|
||||
plugins.beautylog.ora.text('cleaning dist folder')
|
||||
return plugins.smartfile.fs.remove(paths.distDir)
|
||||
}
|
||||
plugins.beautylog.ora.text('cleaning dist folder');
|
||||
return plugins.smartfile.fs.remove(paths.distDir);
|
||||
};
|
||||
|
||||
/**
|
||||
* remove old pages
|
||||
*/
|
||||
let removePages = function() {
|
||||
plugins.beautylog.ora.text('cleaning pages folder')
|
||||
return plugins.smartfile.fs.remove(paths.pagesDir)
|
||||
}
|
||||
plugins.beautylog.ora.text('cleaning pages folder');
|
||||
return plugins.smartfile.fs.remove(paths.pagesDir);
|
||||
};
|
||||
|
||||
export let run = function(configArg) {
|
||||
plugins.beautylog.ora.text('cleaning up from previous builds...')
|
||||
let done = q.defer()
|
||||
plugins.beautylog.ora.text('cleaning up from previous builds...');
|
||||
let done = q.defer();
|
||||
removeDist()
|
||||
.then(removePages)
|
||||
.then(function() {
|
||||
plugins.beautylog.ok('Cleaned up from previous builds!')
|
||||
done.resolve(configArg)
|
||||
})
|
||||
return done.promise
|
||||
}
|
||||
plugins.beautylog.ok('Cleaned up from previous builds!');
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
|
@ -1,17 +1,21 @@
|
||||
import * as q from 'smartq'
|
||||
import * as q from 'smartq';
|
||||
|
||||
import * as paths from '../npmts.paths'
|
||||
import * as paths from '../npmts.paths';
|
||||
|
||||
import * as plugins from './mod.plugins'
|
||||
import * as plugins from './mod.plugins';
|
||||
|
||||
export let run = function(configArg) {
|
||||
let done = q.defer()
|
||||
let config = configArg
|
||||
plugins.beautylog.ora.text('now compiling ' + 'TypeScript')
|
||||
plugins.tsn.compileGlobStringObject(config.ts, config.tsOptions, paths.cwd)
|
||||
let done = q.defer();
|
||||
let config = configArg;
|
||||
plugins.beautylog.ora.text('now compiling ' + 'TypeScript');
|
||||
plugins.tsn
|
||||
.compileGlobStringObject(config.ts, config.tsOptions, paths.cwd)
|
||||
.then(() => {
|
||||
plugins.beautylog.ok(`compiled the module's TypeScript!`)
|
||||
done.resolve(config)
|
||||
}).catch(err => { console.log(err) })
|
||||
return done.promise
|
||||
}
|
||||
plugins.beautylog.ok(`compiled the module's TypeScript!`);
|
||||
done.resolve(config);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
|
@ -1,11 +1,7 @@
|
||||
export * from '../npmts.plugins'
|
||||
export * from '../npmts.plugins';
|
||||
|
||||
import * as tsn from 'tsn'
|
||||
import * as smartchok from 'smartchok'
|
||||
import * as smartstream from 'smartstream'
|
||||
import * as tsn from 'tsn';
|
||||
import * as smartchok from 'smartchok';
|
||||
import * as smartstream from 'smartstream';
|
||||
|
||||
export {
|
||||
tsn,
|
||||
smartchok,
|
||||
smartstream
|
||||
}
|
||||
export { tsn, smartchok, smartstream };
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* ------------------------------------------
|
||||
* This module creates TypeScript documentation
|
||||
* -------------------------------------------- */
|
||||
import * as q from 'smartq'
|
||||
import * as q from 'smartq';
|
||||
|
||||
import * as paths from '../npmts.paths'
|
||||
import { INpmtsConfig } from '../npmts.config'
|
||||
import * as paths from '../npmts.paths';
|
||||
import { INpmtsConfig } from '../npmts.config';
|
||||
|
||||
import * as plugins from './mod.plugins'
|
||||
import * as plugins from './mod.plugins';
|
||||
|
||||
export let run = function(configArg: INpmtsConfig) {
|
||||
let done = q.defer<INpmtsConfig>()
|
||||
done.resolve(configArg)
|
||||
return done.promise
|
||||
}
|
||||
let done = q.defer<INpmtsConfig>();
|
||||
done.resolve(configArg);
|
||||
return done.promise;
|
||||
};
|
||||
|
@ -1,2 +1 @@
|
||||
export * from '../npmts.plugins'
|
||||
|
||||
export * from '../npmts.plugins';
|
||||
|
@ -1,38 +1,35 @@
|
||||
/* ------------------------------------------
|
||||
* This module tests the compiled TypeScript files
|
||||
* -------------------------------------------- */
|
||||
import plugins = require('./mod.plugins')
|
||||
import paths = require('../npmts.paths')
|
||||
import plugins = require('./mod.plugins');
|
||||
import paths = require('../npmts.paths');
|
||||
|
||||
import * as q from 'smartq'
|
||||
import * as q from 'smartq';
|
||||
|
||||
// interfaces
|
||||
import { INpmtsConfig } from '../npmts.config'
|
||||
import { Smartfile } from 'smartfile'
|
||||
import { INpmtsConfig } from '../npmts.config';
|
||||
import { Smartfile } from 'smartfile';
|
||||
|
||||
let testTypeScriptConfig = {
|
||||
target: 'ES5',
|
||||
emitDecoratorMetadata: true,
|
||||
experimentalDecorators: true,
|
||||
lib: [
|
||||
'DOM',
|
||||
'ESNext'
|
||||
]
|
||||
}
|
||||
lib: ['DOM', 'ESNext']
|
||||
};
|
||||
|
||||
/**
|
||||
* runs mocha
|
||||
* @returns INpmtsConfig
|
||||
*/
|
||||
let tap = function(configArg: INpmtsConfig) {
|
||||
let done = q.defer()
|
||||
let done = q.defer();
|
||||
|
||||
/**
|
||||
* the TabBuffer for npmts
|
||||
*/
|
||||
let npmtsTapBuffer = new plugins.tapbuffer.TabBuffer()
|
||||
let npmtsTapBuffer = new plugins.tapbuffer.TabBuffer();
|
||||
|
||||
npmtsTapBuffer.setConfig(configArg.testConfig)
|
||||
npmtsTapBuffer.setConfig(configArg.testConfig);
|
||||
|
||||
/**
|
||||
* handle the testable files
|
||||
@ -44,7 +41,7 @@ let tap = function (configArg: INpmtsConfig) {
|
||||
plugins.gulpSourcemaps.write(),
|
||||
npmtsTapBuffer.pipeTestableFiles(),
|
||||
plugins.smartstream.cleanPipe()
|
||||
])
|
||||
]);
|
||||
|
||||
/**
|
||||
* handle the test files
|
||||
@ -56,81 +53,89 @@ let tap = function (configArg: INpmtsConfig) {
|
||||
plugins.gulpSourcemaps.write(),
|
||||
npmtsTapBuffer.pipeTestFiles(),
|
||||
plugins.smartstream.cleanPipe()
|
||||
])
|
||||
]);
|
||||
|
||||
// lets run the smartstream
|
||||
Promise.all([
|
||||
testableFilesSmartstream.run(),
|
||||
testFilesSmartstream.run()
|
||||
]).then(
|
||||
Promise.all([testableFilesSmartstream.run(), testFilesSmartstream.run()]).then(
|
||||
async () => {
|
||||
configArg.runData.coverageLcovInfo = await npmtsTapBuffer.runTests()
|
||||
done.resolve(configArg)
|
||||
}, (err) => {
|
||||
plugins.beautylog.error('Tests failed!')
|
||||
console.log(err)
|
||||
configArg.runData.coverageLcovInfo = await npmtsTapBuffer.runTests();
|
||||
done.resolve(configArg);
|
||||
},
|
||||
err => {
|
||||
plugins.beautylog.error('Tests failed!');
|
||||
console.log(err);
|
||||
if (configArg.watch) {
|
||||
done.resolve(configArg)
|
||||
done.resolve(configArg);
|
||||
} else {
|
||||
process.exit(1)
|
||||
process.exit(1);
|
||||
}
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
return done.promise
|
||||
}
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
let handleCoverageData = async (configArg: INpmtsConfig) => {
|
||||
let coverageResult: number = 0 // the coverage in percent
|
||||
let coverageResult: number = 0; // the coverage in percent
|
||||
if (configArg.runData.coverageLcovInfo) {
|
||||
coverageResult = await plugins.smartcov.get.percentageFromLcovString(
|
||||
configArg.runData.coverageLcovInfo,
|
||||
2
|
||||
)
|
||||
);
|
||||
} else {
|
||||
plugins.beautylog.warn('Hey... Did your tests import and use your module that you are trying to test?')
|
||||
plugins.beautylog.warn(
|
||||
'Hey... Did your tests import and use your module that you are trying to test?'
|
||||
);
|
||||
}
|
||||
|
||||
if (coverageResult >= configArg.coverageTreshold) {
|
||||
plugins.beautylog.ok(
|
||||
`${(coverageResult).toString()}% `
|
||||
+ `coverage exceeds your treshold of `
|
||||
+ `${configArg.coverageTreshold.toString()}%`
|
||||
)
|
||||
`${coverageResult.toString()}% ` +
|
||||
`coverage exceeds your treshold of ` +
|
||||
`${configArg.coverageTreshold.toString()}%`
|
||||
);
|
||||
} else {
|
||||
plugins.beautylog.warn(
|
||||
`${(coverageResult).toString()}% `
|
||||
+ `coverage fails your treshold of `
|
||||
+ `${configArg.coverageTreshold.toString()}%`
|
||||
)
|
||||
plugins.beautylog.error('exiting due to coverage failure')
|
||||
if (!configArg.watch) { process.exit(1) }
|
||||
`${coverageResult.toString()}% ` +
|
||||
`coverage fails your treshold of ` +
|
||||
`${configArg.coverageTreshold.toString()}%`
|
||||
);
|
||||
plugins.beautylog.error('exiting due to coverage failure');
|
||||
if (!configArg.watch) {
|
||||
process.exit(1);
|
||||
}
|
||||
return configArg
|
||||
}
|
||||
return configArg;
|
||||
};
|
||||
|
||||
export let run = function(configArg: INpmtsConfig) {
|
||||
let done = q.defer<INpmtsConfig>()
|
||||
let config = configArg
|
||||
let done = q.defer<INpmtsConfig>();
|
||||
let config = configArg;
|
||||
if (config.test === true) {
|
||||
plugins.beautylog.ora.text('now starting tests')
|
||||
plugins.beautylog.ora.end()
|
||||
plugins.beautylog.log('ready for tapbuffer:')
|
||||
plugins.beautylog.ora.text('now starting tests');
|
||||
plugins.beautylog.ora.end();
|
||||
plugins.beautylog.log('ready for tapbuffer:');
|
||||
if (configArg.testConfig.coverage) {
|
||||
tap(config)
|
||||
.then(handleCoverageData)
|
||||
.then(() => {
|
||||
done.resolve(config)
|
||||
}).catch(err => { console.log(err) })
|
||||
done.resolve(config);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
} else {
|
||||
tap(config)
|
||||
.then(() => {
|
||||
done.resolve(config)
|
||||
}).catch(err => { console.log(err) })
|
||||
done.resolve(config);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
plugins.beautylog.ora.end()
|
||||
done.resolve(config)
|
||||
}
|
||||
return done.promise
|
||||
plugins.beautylog.ora.end();
|
||||
done.resolve(config);
|
||||
}
|
||||
return done.promise;
|
||||
};
|
||||
|
@ -1,17 +1,10 @@
|
||||
export * from '../npmts.plugins'
|
||||
export * from '../npmts.plugins';
|
||||
|
||||
import * as gulpFunction from 'gulp-function'
|
||||
import * as gulpSourcemaps from 'gulp-sourcemaps'
|
||||
import * as gulpTypeScript from 'gulp-typescript'
|
||||
import * as smartcov from 'smartcov'
|
||||
import * as smartgulp from 'smartgulp'
|
||||
import * as tapbuffer from 'tapbuffer'
|
||||
import * as gulpFunction from 'gulp-function';
|
||||
import * as gulpSourcemaps from 'gulp-sourcemaps';
|
||||
import * as gulpTypeScript from 'gulp-typescript';
|
||||
import * as smartcov from 'smartcov';
|
||||
import * as smartgulp from 'smartgulp';
|
||||
import * as tapbuffer from 'tapbuffer';
|
||||
|
||||
export {
|
||||
gulpFunction,
|
||||
gulpSourcemaps,
|
||||
gulpTypeScript,
|
||||
smartcov,
|
||||
smartgulp,
|
||||
tapbuffer
|
||||
}
|
||||
export { gulpFunction, gulpSourcemaps, gulpTypeScript, smartcov, smartgulp, tapbuffer };
|
||||
|
104
ts/npmts.cli.ts
104
ts/npmts.cli.ts
@ -1,11 +1,11 @@
|
||||
import * as q from 'smartq'
|
||||
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'
|
||||
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';
|
||||
|
||||
/**
|
||||
* smartanalytics
|
||||
@ -22,70 +22,84 @@ let npmtsAnalytics = new plugins.smartanalytics.Analytics({
|
||||
apiEndPoint: 'https://pubapi.lossless.one/analytics',
|
||||
projectId: 'gitzone',
|
||||
appName: 'npmts'
|
||||
})
|
||||
});
|
||||
|
||||
process.nextTick(async () => {
|
||||
// make the analytics call
|
||||
npmtsAnalytics.recordEvent('npmToolExecution', {
|
||||
npmtsAnalytics
|
||||
.recordEvent('npmToolExecution', {
|
||||
executionMode: (await NpmtsConfig.configPromise).mode,
|
||||
tsOptions: (await NpmtsConfig.configPromise).tsOptions,
|
||||
watch: (await NpmtsConfig.configPromise).watch,
|
||||
coverageTreshold: (await NpmtsConfig.configPromise).coverageTreshold
|
||||
}).catch(err => {
|
||||
plugins.beautylog.warn('Lossless Analytics API not available...')
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
plugins.beautylog.warn('Lossless Analytics API not available...');
|
||||
});
|
||||
});
|
||||
|
||||
export let run = async () => {
|
||||
let done = q.defer()
|
||||
let done = q.defer();
|
||||
|
||||
plugins.beautylog.figletSync('NPMTS')
|
||||
let npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot)
|
||||
plugins.beautylog.figletSync('NPMTS');
|
||||
let npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot);
|
||||
// check for updates
|
||||
await plugins.smartupdate.standardHandler.check('npmts', npmtsProjectInfo.version, 'http://gitzone.gitlab.io/npmts/changelog.html')
|
||||
plugins.beautylog.log('---------------------------------------------')
|
||||
let npmtsCli = new plugins.smartcli.Smartcli()
|
||||
npmtsCli.standardTask()
|
||||
.then((argvArg) => {
|
||||
plugins.beautylog.info('npmts version: ' + npmtsProjectInfo.version)
|
||||
return NpmtsConfig.run(argvArg)
|
||||
await plugins.smartupdate.standardHandler.check(
|
||||
'npmts',
|
||||
npmtsProjectInfo.version,
|
||||
'http://gitzone.gitlab.io/npmts/changelog.html'
|
||||
);
|
||||
plugins.beautylog.log('---------------------------------------------');
|
||||
let npmtsCli = new plugins.smartcli.Smartcli();
|
||||
npmtsCli
|
||||
.standardTask()
|
||||
.then(argvArg => {
|
||||
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.modCompile.load()
|
||||
.then((modCompile) => {
|
||||
return modCompile.run(configArg)
|
||||
let done = q.defer();
|
||||
plugins.beautylog.ora.start('loading additional modules...');
|
||||
NpmtsMods.modCompile
|
||||
.load()
|
||||
.then(modCompile => {
|
||||
return modCompile.run(configArg);
|
||||
})
|
||||
.then(configArg => {
|
||||
let done = q.defer<NpmtsConfig.INpmtsConfig>()
|
||||
NpmtsMods.modDocs.load()
|
||||
let done = q.defer<NpmtsConfig.INpmtsConfig>();
|
||||
NpmtsMods.modDocs
|
||||
.load()
|
||||
.then(modDocs => {
|
||||
return modDocs.run(configArg)
|
||||
return modDocs.run(configArg);
|
||||
})
|
||||
.then(configArg => {
|
||||
done.resolve(configArg)
|
||||
})
|
||||
return done.promise
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
})
|
||||
.then(configArg => {
|
||||
let done = q.defer<NpmtsConfig.INpmtsConfig>()
|
||||
NpmtsMods.modTest.load()
|
||||
let done = q.defer<NpmtsConfig.INpmtsConfig>();
|
||||
NpmtsMods.modTest
|
||||
.load()
|
||||
.then(modTest => {
|
||||
return modTest.run(configArg)
|
||||
return modTest.run(configArg);
|
||||
})
|
||||
.then(configArg => {
|
||||
done.resolve(configArg)
|
||||
})
|
||||
return done.promise
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
})
|
||||
.then(NpmtsWatch.run)
|
||||
.then(NpmtsShip.run)
|
||||
.then(NpmtsShip.run);
|
||||
|
||||
return done.promise
|
||||
return done.promise;
|
||||
})
|
||||
.catch((err) => { if (err instanceof Error) { console.log(err) } })
|
||||
npmtsCli.addVersion(npmtsProjectInfo.version)
|
||||
npmtsCli.startParse()
|
||||
return await done.promise
|
||||
.catch(err => {
|
||||
if (err instanceof Error) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
npmtsCli.addVersion(npmtsProjectInfo.version);
|
||||
npmtsCli.startParse();
|
||||
return await done.promise;
|
||||
};
|
||||
|
@ -1,10 +1,10 @@
|
||||
import plugins = require('./npmts.plugins')
|
||||
import paths = require('./npmts.paths')
|
||||
import plugins = require('./npmts.plugins');
|
||||
import paths = require('./npmts.paths');
|
||||
|
||||
import * as smartq from 'smartq'
|
||||
import * as smartq from 'smartq';
|
||||
|
||||
// interfaces
|
||||
import { ITapbufferConfig } from 'tapbuffer'
|
||||
import { ITapbufferConfig } from 'tapbuffer';
|
||||
|
||||
/**
|
||||
* specifies the different modes available
|
||||
@ -12,27 +12,27 @@ import { ITapbufferConfig } from 'tapbuffer'
|
||||
* merge -> uses merged default + custom options
|
||||
* custom -> only uses specified options
|
||||
*/
|
||||
export type npmtsMode = 'default' | 'custom' | 'merge'
|
||||
export type npmtsMode = 'default' | 'custom' | 'merge';
|
||||
|
||||
export interface INpmtsConfig {
|
||||
argv: any
|
||||
coverageTreshold: number
|
||||
checkDependencies: boolean
|
||||
mode: npmtsMode
|
||||
test: boolean
|
||||
testTs: any
|
||||
testConfig: ITapbufferConfig
|
||||
ts: any
|
||||
tsOptions: any
|
||||
watch: boolean
|
||||
argv: any;
|
||||
coverageTreshold: number;
|
||||
checkDependencies: boolean;
|
||||
mode: npmtsMode;
|
||||
test: boolean;
|
||||
testTs: any;
|
||||
testConfig: ITapbufferConfig;
|
||||
ts: any;
|
||||
tsOptions: any;
|
||||
watch: boolean;
|
||||
runData: {
|
||||
coverageLcovInfo?: string
|
||||
coverageResult?: number
|
||||
}
|
||||
coverageLcovInfo?: string;
|
||||
coverageResult?: number;
|
||||
};
|
||||
}
|
||||
|
||||
export let run = function(argvArg) {
|
||||
let done = smartq.defer()
|
||||
let done = smartq.defer();
|
||||
let defaultConfig: INpmtsConfig = {
|
||||
argv: undefined,
|
||||
coverageTreshold: 70,
|
||||
@ -48,66 +48,63 @@ export let run = function (argvArg) {
|
||||
tsOptions: {},
|
||||
watch: false,
|
||||
runData: {}
|
||||
}
|
||||
};
|
||||
|
||||
// mix with configfile
|
||||
plugins.beautylog.ora.text('running npmextra')
|
||||
plugins.beautylog.ora.text('running npmextra');
|
||||
|
||||
let localNpmextra = new plugins.npmextra.Npmextra(paths.cwd)
|
||||
let config: INpmtsConfig = localNpmextra.dataFor<INpmtsConfig>(
|
||||
'npmts',
|
||||
defaultConfig
|
||||
)
|
||||
let localNpmextra = new plugins.npmextra.Npmextra(paths.cwd);
|
||||
let config: INpmtsConfig = localNpmextra.dataFor<INpmtsConfig>('npmts', defaultConfig);
|
||||
|
||||
// add argv
|
||||
config.argv = argvArg
|
||||
config.argv = argvArg;
|
||||
|
||||
// check mode
|
||||
switch (config.mode) {
|
||||
case 'default':
|
||||
case 'custom':
|
||||
case 'merge':
|
||||
plugins.beautylog.ok('mode is ' + config.mode)
|
||||
done.resolve(config)
|
||||
break
|
||||
plugins.beautylog.ok('mode is ' + config.mode);
|
||||
done.resolve(config);
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.error(`mode not recognised! Can be default or custom`)
|
||||
process.exit(1)
|
||||
plugins.beautylog.error(`mode not recognised! Can be default or custom`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// handle default mode
|
||||
if (config.mode === 'default' || config.mode === 'merge') {
|
||||
config.ts = {
|
||||
'./ts/**/*.ts': './dist/'
|
||||
}
|
||||
};
|
||||
config.testTs = {
|
||||
'./test/**/*.ts': './test/'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// mix with commandline
|
||||
if (config.argv.notest) {
|
||||
config.test = false
|
||||
config.test = false;
|
||||
}
|
||||
|
||||
if (config.argv.nocoverage) {
|
||||
config.testConfig.coverage = false
|
||||
config.testConfig.coverage = false;
|
||||
}
|
||||
|
||||
if (config.argv.nochecks) {
|
||||
config.checkDependencies = false
|
||||
config.checkDependencies = false;
|
||||
}
|
||||
|
||||
if (config.argv.watch) {
|
||||
config.watch = true
|
||||
config.watch = true;
|
||||
}
|
||||
|
||||
plugins.beautylog.ok('build options are ready!')
|
||||
done.resolve(config)
|
||||
configDeferred.resolve(config)
|
||||
return done.promise
|
||||
}
|
||||
plugins.beautylog.ok('build options are ready!');
|
||||
done.resolve(config);
|
||||
configDeferred.resolve(config);
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
// config deferred usage
|
||||
let configDeferred = smartq.defer<INpmtsConfig>()
|
||||
export let configPromise = configDeferred.promise
|
||||
let configDeferred = smartq.defer<INpmtsConfig>();
|
||||
export let configPromise = configDeferred.promise;
|
||||
|
@ -1,11 +1,11 @@
|
||||
import * as plugins from './npmts.plugins'
|
||||
import * as plugins from './npmts.plugins';
|
||||
|
||||
import { LazyModule } from 'smartsystem'
|
||||
import { LazyModule } from 'smartsystem';
|
||||
|
||||
import * as _modCompile from './mod_compile/index'
|
||||
import * as _modDocs from './mod_docs/index'
|
||||
import * as _modTest from './mod_test/index'
|
||||
import * as _modCompile from './mod_compile/index';
|
||||
import * as _modDocs from './mod_docs/index';
|
||||
import * as _modTest from './mod_test/index';
|
||||
|
||||
export let modCompile = new LazyModule<typeof _modCompile>('./mod_compile/index',__dirname)
|
||||
export let modDocs = new LazyModule<typeof _modDocs>('./mod_docs/index',__dirname)
|
||||
export let modTest = new LazyModule<typeof _modTest>('./mod_test/index',__dirname)
|
||||
export let modCompile = new LazyModule<typeof _modCompile>('./mod_compile/index', __dirname);
|
||||
export let modDocs = new LazyModule<typeof _modDocs>('./mod_docs/index', __dirname);
|
||||
export let modTest = new LazyModule<typeof _modTest>('./mod_test/index', __dirname);
|
||||
|
@ -1,24 +1,24 @@
|
||||
import plugins = require('./npmts.plugins')
|
||||
import plugins = require('./npmts.plugins');
|
||||
|
||||
// NPMTS Paths
|
||||
export let npmtsPackageRoot = plugins.path.join(__dirname,'../')
|
||||
export let npmtsPackageRoot = plugins.path.join(__dirname, '../');
|
||||
|
||||
// Project paths
|
||||
export let cwd = process.cwd()
|
||||
export let cwd = process.cwd();
|
||||
|
||||
// Directories
|
||||
export let tsDir = plugins.path.join(cwd,'ts/')
|
||||
export let distDir = plugins.path.join(cwd,'dist/')
|
||||
export let testDir = plugins.path.join(cwd,'test/')
|
||||
export let typingsDir = plugins.path.join(cwd,'ts/typings/')
|
||||
export let coverageDir = plugins.path.join(cwd,'coverage/')
|
||||
export let tsDir = plugins.path.join(cwd, 'ts/');
|
||||
export let distDir = plugins.path.join(cwd, 'dist/');
|
||||
export let testDir = plugins.path.join(cwd, 'test/');
|
||||
export let typingsDir = plugins.path.join(cwd, 'ts/typings/');
|
||||
export let coverageDir = plugins.path.join(cwd, 'coverage/');
|
||||
|
||||
// Pages
|
||||
export let pagesDir = plugins.path.join(cwd,'pages/')
|
||||
export let pagesApiDir = plugins.path.join(pagesDir,'/api')
|
||||
export let pagesDir = plugins.path.join(cwd, 'pages/');
|
||||
export let pagesApiDir = plugins.path.join(pagesDir, '/api');
|
||||
|
||||
export let npmtsAssetsDir = plugins.path.join(__dirname,'../assets/')
|
||||
export let npmtsAssetsDir = plugins.path.join(__dirname, '../assets/');
|
||||
|
||||
// Files
|
||||
export let indexTS = plugins.path.join(cwd,'ts/index.ts')
|
||||
export let testTS = plugins.path.join(cwd,'ts/test.ts')
|
||||
export let indexTS = plugins.path.join(cwd, 'ts/index.ts');
|
||||
export let testTS = plugins.path.join(cwd, 'ts/test.ts');
|
||||
|
@ -1,20 +1,20 @@
|
||||
import * as beautylog from 'beautylog'
|
||||
let depcheck = require('depcheck')
|
||||
import * as beautylog from 'beautylog';
|
||||
let depcheck = require('depcheck');
|
||||
|
||||
import * as lodash from 'lodash'
|
||||
import * as npmextra from 'npmextra'
|
||||
import * as projectinfo from 'projectinfo'
|
||||
import * as path from 'path'
|
||||
import * as smartanalytics from 'smartanalytics'
|
||||
import * as smartcli from 'smartcli'
|
||||
import * as smarterror from 'smarterror'
|
||||
import * as smartfile from 'smartfile'
|
||||
import * as smartpath from 'smartpath'
|
||||
import * as smartstream from 'smartstream'
|
||||
import * as smartstring from 'smartstring'
|
||||
import * as smartsystem from 'smartsystem'
|
||||
import * as smartupdate from 'smartupdate'
|
||||
import * as through2 from 'through2'
|
||||
import * as lodash from 'lodash';
|
||||
import * as npmextra from 'npmextra';
|
||||
import * as projectinfo from 'projectinfo';
|
||||
import * as path from 'path';
|
||||
import * as smartanalytics from 'smartanalytics';
|
||||
import * as smartcli from 'smartcli';
|
||||
import * as smarterror from 'smarterror';
|
||||
import * as smartfile from 'smartfile';
|
||||
import * as smartpath from 'smartpath';
|
||||
import * as smartstream from 'smartstream';
|
||||
import * as smartstring from 'smartstring';
|
||||
import * as smartsystem from 'smartsystem';
|
||||
import * as smartupdate from 'smartupdate';
|
||||
import * as through2 from 'through2';
|
||||
|
||||
export {
|
||||
beautylog,
|
||||
@ -33,4 +33,4 @@ export {
|
||||
smartsystem,
|
||||
smartupdate,
|
||||
through2
|
||||
}
|
||||
};
|
||||
|
@ -1,12 +1,13 @@
|
||||
import * as q from 'smartq'
|
||||
import * as q from 'smartq';
|
||||
|
||||
import * as plugins from './npmts.plugins'
|
||||
import * as plugins from './npmts.plugins';
|
||||
|
||||
import { INpmtsConfig } from './npmts.config'
|
||||
import { INpmtsConfig } from './npmts.config';
|
||||
|
||||
export let run = (configArg: INpmtsConfig) => {
|
||||
let done = q.defer()
|
||||
let shipString = '' +
|
||||
let done = q.defer();
|
||||
let shipString =
|
||||
'' +
|
||||
'\n' +
|
||||
'\n' +
|
||||
' # # ( )\n' +
|
||||
@ -19,12 +20,12 @@ export let run = (configArg: INpmtsConfig) => {
|
||||
' \\___________________________________________________________/\n' +
|
||||
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n' +
|
||||
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n' +
|
||||
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n'
|
||||
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n';
|
||||
if (process.env.CI) {
|
||||
console.log(shipString)
|
||||
plugins.beautylog.success('READY TO SHIP!')
|
||||
console.log(shipString);
|
||||
plugins.beautylog.success('READY TO SHIP!');
|
||||
} else {
|
||||
plugins.beautylog.success('Done!')
|
||||
}
|
||||
done.resolve(configArg)
|
||||
plugins.beautylog.success('Done!');
|
||||
}
|
||||
done.resolve(configArg);
|
||||
};
|
||||
|
@ -1,34 +1,34 @@
|
||||
import * as q from 'smartq'
|
||||
import * as smartchok from 'smartchok'
|
||||
import * as q from 'smartq';
|
||||
import * as smartchok from 'smartchok';
|
||||
|
||||
import * as plugins from './npmts.plugins'
|
||||
import * as cli from './npmts.cli'
|
||||
import * as plugins from './npmts.plugins';
|
||||
import * as cli from './npmts.cli';
|
||||
|
||||
import { INpmtsConfig } from './npmts.config'
|
||||
import { INpmtsConfig } from './npmts.config';
|
||||
|
||||
let npmtsSmartchok: smartchok.Smartchok = null
|
||||
let npmtsSmartchok: smartchok.Smartchok = null;
|
||||
export let run = (configArg: INpmtsConfig) => {
|
||||
let done = q.defer()
|
||||
let done = q.defer();
|
||||
if (configArg.watch && npmtsSmartchok === null) {
|
||||
let pathsToWatch: string[] = []
|
||||
let pathsToWatch: string[] = [];
|
||||
for (let key in configArg.ts) {
|
||||
pathsToWatch.push(key)
|
||||
pathsToWatch.push(key);
|
||||
}
|
||||
for (let key in configArg.testTs) {
|
||||
pathsToWatch.push(key)
|
||||
pathsToWatch.push(key);
|
||||
}
|
||||
npmtsSmartchok = new smartchok.Smartchok(pathsToWatch)
|
||||
npmtsSmartchok.getObservableFor('change').then((changeObservableArg) => {
|
||||
plugins.beautylog.info('now watching...')
|
||||
npmtsSmartchok = new smartchok.Smartchok(pathsToWatch);
|
||||
npmtsSmartchok.getObservableFor('change').then(changeObservableArg => {
|
||||
plugins.beautylog.info('now watching...');
|
||||
changeObservableArg.subscribe(() => {
|
||||
cli.run()
|
||||
})
|
||||
})
|
||||
npmtsSmartchok.start()
|
||||
done.resolve(configArg)
|
||||
cli.run();
|
||||
});
|
||||
});
|
||||
npmtsSmartchok.start();
|
||||
done.resolve(configArg);
|
||||
} else {
|
||||
plugins.beautylog.info('not watching')
|
||||
done.resolve(configArg)
|
||||
}
|
||||
return done.promise
|
||||
plugins.beautylog.info('not watching');
|
||||
done.resolve(configArg);
|
||||
}
|
||||
return done.promise;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user