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/
# 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
cache:
@ -37,18 +37,6 @@ snyk:
# ====================
# 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:
stage: test
@ -90,19 +78,11 @@ release:
# ====================
codequality:
stage: metadata
image: docker:stable
allow_failure: true
services:
- docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD"
--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]
- npmci command npm install -g tslint typescript
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- docker
- priv
@ -121,10 +101,10 @@ pages:
image: hosttoday/ht-docker-node:npmci
stage: metadata
script:
- npmci command npm install -g typedoc typescript
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
- npmci command tsdoc
tags:
- docker
- notpriv
@ -135,13 +115,3 @@ pages:
paths:
- public
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
## Availabililty
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/beautylog)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/beautylog)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/beautylog)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/beautylog/)
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartlog-destination-local)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartlog-destination-local)
* [github.com (source mirror)](https://github.com/pushrocks/smartlog-destination-local)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartlog-destination-local/)
## 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)
[![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/)
## Usage
## Quick Demo
[![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.
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://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": {
"globalNpmTools": [],
"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": {
"@pushrocks/consolecolor": "^2.0.1",
"@pushrocks/smartlog-interfaces": "^2.0.2",
"@pushrocks/smartpromise": "^2.0.5",
"ora": "^3.0.0"
"@pushrocks/smartpromise": "^2.0.5"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.0.22",
@ -40,5 +39,15 @@
"@types/node": "^10.12.2",
"tslint": "^5.11.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);
});
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();

View File

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