BREAKING CHANGE(ora): remove support for ora which is now handled in smartlog-source-ora

This commit is contained in:
Philipp Kunz 2019-06-07 12:00:58 +02:00
parent f1e3ca6014
commit 78bd0605aa
9 changed files with 68 additions and 168 deletions

29
.gitignore vendored
View File

@ -1,11 +1,22 @@
dist/
node_modules/
coverage/
pages/
public/
npm-debug.log
.nogit/ .nogit/
# artifacts
coverage/
public/
pages/
# installs
node_modules/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_web/
dist_serve/
dist_ts_web/
# custom

View File

@ -1,4 +1,4 @@
# gitzone standard # gitzone ci_default
image: hosttoday/ht-docker-node:npmci image: hosttoday/ht-docker-node:npmci
cache: cache:
@ -37,18 +37,6 @@ snyk:
# ==================== # ====================
# test stage # test stage
# ==================== # ====================
testLEGACY:
stage: test
script:
- npmci npm prepare
- npmci node install legacy
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
allow_failure: true
testLTS: testLTS:
stage: test stage: test
@ -90,19 +78,11 @@ release:
# ==================== # ====================
codequality: codequality:
stage: metadata stage: metadata
image: docker:stable
allow_failure: true allow_failure: true
services:
- docker:stable-dind
script: script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') - npmci command npm install -g tslint typescript
- docker run - npmci npm install
--env SOURCE_CODE="$PWD" - npmci command "tslint -c tslint.json ./ts/**/*.ts"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [codeclimate.json]
tags: tags:
- docker - docker
- priv - priv
@ -121,10 +101,10 @@ pages:
image: hosttoday/ht-docker-node:npmci image: hosttoday/ht-docker-node:npmci
stage: metadata stage: metadata
script: script:
- npmci command npm install -g typedoc typescript - npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/ - npmci command tsdoc
tags: tags:
- docker - docker
- notpriv - notpriv
@ -135,13 +115,3 @@ pages:
paths: paths:
- public - public
allow_failure: true allow_failure: true
windowsCompatibility:
image: stefanscherer/node-windows:10-build-tools
stage: metadata
script:
- npm install & npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- windows
allow_failure: true

View File

@ -1,33 +1,26 @@
# smartlog-destination-local # @pushrocks/smartlog-destination-local
a smartlog destination targeting the local console a smartlog destination targeting the local console
## Availabililty ## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartlog-destination-local)
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/beautylog) * [gitlab.com (source)](https://gitlab.com/pushrocks/smartlog-destination-local)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/beautylog) * [github.com (source mirror)](https://github.com/pushrocks/smartlog-destination-local)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/beautylog) * [docs (typedoc)](https://pushrocks.gitlab.io/smartlog-destination-local/)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/beautylog/)
## Status for master ## Status for master
[![build status](https://gitlab.com/pushrocks/smartlog-destination-local/badges/master/build.svg)](https://gitlab.com/pushrocks/smartlog-destination-local/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartlog-destination-local/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartlog-destination-local/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartlog-destination-local.svg)](https://www.npmjs.com/package/@pushrocks/smartlog-destination-local)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartlog-destination-local/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartlog-destination-local)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
[![build status](https://GitLab.com/pushrocks/beautylog/badges/master/build.svg)](https://GitLab.com/pushrocks/beautylog/commits/master) ## Usage
[![coverage report](https://GitLab.com/pushrocks/beautylog/badges/master/coverage.svg)](https://GitLab.com/pushrocks/beautylog/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/beautylog.svg)](https://www.npmjs.com/package/beautylog)
[![Dependency Status](https://david-dm.org/pushrocks/beautylog.svg)](https://david-dm.org/pushrocks/beautylog)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/beautylog/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/beautylog/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/beautylog/badges/code.svg)](https://www.bithound.io/github/pushrocks/beautylog)
[![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 For further information read the linked docs at the top of this readme.
[![asciicast](https://asciinema.org/a/46djsde96ecsho9wqibjx2zye.png)](https://asciinema.org/a/46djsde96ecsho9wqibjx2zye)
For further information read the linked docs at the top of this README.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) > 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://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks) [![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)

View File

@ -2,5 +2,15 @@
"npmci": { "npmci": {
"globalNpmTools": [], "globalNpmTools": [],
"npmAccessLevel": "public" "npmAccessLevel": "public"
},
"gitzone": {
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "smartlog-destination-local",
"shortDescription": "a smartlog destination targeting the local console",
"npmPackagename": "@pushrocks/smartlog-destination-local",
"license": "MIT"
}
} }
} }

View File

@ -28,8 +28,7 @@
"dependencies": { "dependencies": {
"@pushrocks/consolecolor": "^2.0.1", "@pushrocks/consolecolor": "^2.0.1",
"@pushrocks/smartlog-interfaces": "^2.0.2", "@pushrocks/smartlog-interfaces": "^2.0.2",
"@pushrocks/smartpromise": "^2.0.5", "@pushrocks/smartpromise": "^2.0.5"
"ora": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.0.22", "@gitzone/tsbuild": "^2.0.22",
@ -40,5 +39,15 @@
"@types/node": "^10.12.2", "@types/node": "^10.12.2",
"tslint": "^5.11.0", "tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0" "tslint-config-prettier": "^1.15.0"
} },
"files": [
"ts/*",
"ts_web/*",
"dist/*",
"dist_web/*",
"assets/*",
"cli.js",
"npmextra.json",
"readme.md"
]
} }

View File

@ -43,19 +43,4 @@ tap.test('.newLine(number) create specified amount of new lines', async () => {
testLocalInstance.newLine(1); testLocalInstance.newLine(1);
}); });
tap.test('.ora(text,color) should display, update, and end a message', async () => {
testLocalInstance.ora.start('This is a test text', 'green');
await smartdelay.delayFor(2000);
testLocalInstance.ora.text('updated text!');
await smartdelay.delayFor(2000);
await smartdelay.delayFor(2000);
testLocalInstance.ora.stop();
});
tap.test('.ora(text,color) should display an error message when ended with error', async () => {
testLocalInstance.ora.start('This is another test text', 'green');
await smartdelay.delayFor(2000);
testLocalInstance.ora.stop();
});
tap.start(); tap.start();

View File

@ -2,11 +2,9 @@ import * as plugins from './sl.destlocal.plugins';
import { ILogDestination, ILogPackage, TLogLevel } from '@pushrocks/smartlog-interfaces'; import { ILogDestination, ILogPackage, TLogLevel } from '@pushrocks/smartlog-interfaces';
// other beautylog classes // other beautylog classes
import { Ora } from './sl.destlocal.classes.ora';
import { TColorName } from '@pushrocks/consolecolor'; import { TColorName } from '@pushrocks/consolecolor';
export class DestinationLocal implements ILogDestination { export class DestinationLocal implements ILogDestination {
private oraInstance: Ora;
/** /**
* handles a log according to the smartlog standard * handles a log according to the smartlog standard
@ -16,13 +14,6 @@ export class DestinationLocal implements ILogDestination {
this.logToConsole(logPackage); this.logToConsole(logPackage);
} }
get ora(): Ora {
if (!this.oraInstance) {
this.oraInstance = new Ora(this);
}
return this.oraInstance;
}
/** /**
* creates a new empty line * creates a new empty line
* @param linesArg * @param linesArg
@ -66,7 +57,7 @@ export class DestinationLocal implements ILogDestination {
private sameMessageCounter: number = 0; private sameMessageCounter: number = 0;
// default logging // default logging
logToConsole(logPackageArg: ILogPackage) { private logToConsole(logPackageArg: ILogPackage) {
let logString: string; let logString: string;
try { try {
logString = logString =
@ -75,14 +66,7 @@ export class DestinationLocal implements ILogDestination {
logPackageArg.message, logPackageArg.message,
this.localBl[logPackageArg.level].textColor this.localBl[logPackageArg.level].textColor
); );
if (this.ora.state === 'running') {
this.ora.pause();
}
console.log(logString); console.log(logString);
if (this.ora.state === 'paused') {
this.ora.start();
}
return true; return true;
} catch (error) { } catch (error) {
console.log( console.log(

View File

@ -1,61 +0,0 @@
import * as plugins from './sl.destlocal.plugins';
import { DestinationLocal } from './sl.destlocal.classes.destinationlocal';
export class Ora {
/**
* the destinationLocalInstance that ora talks to
*/
destinationLocalInstance: DestinationLocal;
/**
* the state of the current ora
*/
state: 'running' | 'stopped' | 'paused' = 'stopped';
/**
* the actual ora object
*/
private _oraObject;
constructor(destinationLocalInstanceArg: DestinationLocal = new DestinationLocal()) {
this.destinationLocalInstance = destinationLocalInstanceArg;
this._oraObject = plugins.ora({
spinner: 'dots',
text: '',
color: 'blue'
});
}
text(textArg) {
this._oraObject.text = textArg;
}
start(textArg?: string, colorArg?: string) {
if (textArg) {
this.text(textArg);
}
if (colorArg) {
this._oraObject.color = colorArg;
}
this.state = 'running';
this._oraObject.start();
}
end() {
this._oraObject.stop();
this._oraObject.clear();
this.state = 'stopped';
}
pause() {
this._oraObject.stop();
this.state = 'paused';
}
/**
* stop is an alias for end
*/
stop() {
this.end();
}
}

View File

@ -1,6 +1,5 @@
import * as consolecolor from '@pushrocks/consolecolor'; import * as consolecolor from '@pushrocks/consolecolor';
import * as smartlogInterfaces from '@pushrocks/smartlog-interfaces'; import * as smartlogInterfaces from '@pushrocks/smartlog-interfaces';
import * as smartpromise from '@pushrocks/smartpromise'; import * as smartpromise from '@pushrocks/smartpromise';
let ora = require('ora');
export { consolecolor, smartlogInterfaces, smartpromise, ora }; export { consolecolor, smartlogInterfaces, smartpromise};