upgrade to latest standards

This commit is contained in:
Philipp Kunz 2018-04-12 18:02:48 +02:00
parent 5f0a7ceaa3
commit d295b2e070
13 changed files with 177 additions and 89 deletions

View File

@ -7,19 +7,28 @@ cache:
key: "$CI_BUILD_STAGE" key: "$CI_BUILD_STAGE"
stages: stages:
- mirror - security
- test - test
- release - release
- trigger - trigger
- pages - pages
mirror: mirror:
stage: mirror stage: security
script: script:
- npmci git mirror - npmci git mirror
tags: tags:
- docker - docker
snyk:
stage: security
script:
- npmci command yarn global add snyk
- npmci command yarn install --ignore-scripts
- npmci command snyk test
tags:
- docker
testLEGACY: testLEGACY:
stage: test stage: test
script: script:

View File

@ -1,4 +0,0 @@
module.name: smartmodule
module.description: a smart description
module.author: Lossless GmbH
module.license: MIT

11
dist/index.d.ts vendored
View File

@ -1,11 +1,20 @@
export declare class SmartDebug { export declare class SmartDebug {
private debugEnabled; private _debugEnabled;
readonly debugEnabled: boolean;
/** /**
* enables debugging output * enables debugging output
*/ */
enableDebugging(): void; enableDebugging(): void;
/**
* disables debugging
*/
disableDebugging(): void;
/** /**
* logs a message based on the contraints of the SmartDebug instance * logs a message based on the contraints of the SmartDebug instance
*/ */
log(logObject: any): void; log(logObject: any): void;
/**
* a function returning
*/
isDebugMode(): boolean;
} }

24
dist/index.js vendored
View File

@ -2,22 +2,38 @@
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
class SmartDebug { class SmartDebug {
constructor() { constructor() {
this.debugEnabled = false; this._debugEnabled = false;
}
get debugEnabled() {
return this._debugEnabled;
} }
/** /**
* enables debugging output * enables debugging output
*/ */
enableDebugging() { enableDebugging() {
this.debugEnabled = true; this._debugEnabled = true;
}
/**
* disables debugging
*/
disableDebugging() {
this._debugEnabled = false;
} }
/** /**
* logs a message based on the contraints of the SmartDebug instance * logs a message based on the contraints of the SmartDebug instance
*/ */
log(logObject) { log(logObject) {
if (this.debugEnabled) { if (this._debugEnabled) {
// tslint:disable-next-line:no-console
console.log(logObject); console.log(logObject);
} }
} }
/**
* a function returning
*/
isDebugMode() {
return this._debugEnabled;
}
} }
exports.SmartDebug = SmartDebug; exports.SmartDebug = SmartDebug;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVBO0lBQUE7UUFDVSxpQkFBWSxHQUFZLEtBQUssQ0FBQTtJQWtCdkMsQ0FBQztJQWhCQzs7T0FFRztJQUNILGVBQWU7UUFDYixJQUFJLENBQUMsWUFBWSxHQUFHLElBQUksQ0FBQTtJQUMxQixDQUFDO0lBRUQ7O09BRUc7SUFDSCxHQUFHLENBQUUsU0FBYztRQUNqQixFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQztZQUN0QixPQUFPLENBQUMsR0FBRyxDQUFDLFNBQVMsQ0FBQyxDQUFBO1FBQ3hCLENBQUM7SUFDSCxDQUFDO0NBRUY7QUFuQkQsZ0NBbUJDIn0= //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVBO0lBQUE7UUFDVSxrQkFBYSxHQUFZLEtBQUssQ0FBQztJQW1DekMsQ0FBQztJQWxDQyxJQUFJLFlBQVk7UUFDZCxPQUFPLElBQUksQ0FBQyxhQUFhLENBQUM7SUFDNUIsQ0FBQztJQUVEOztPQUVHO0lBQ0ksZUFBZTtRQUNwQixJQUFJLENBQUMsYUFBYSxHQUFHLElBQUksQ0FBQztJQUM1QixDQUFDO0lBRUQ7O09BRUc7SUFDSSxnQkFBZ0I7UUFDckIsSUFBSSxDQUFDLGFBQWEsR0FBRyxLQUFLLENBQUM7SUFDN0IsQ0FBQztJQUVEOztPQUVHO0lBQ0ksR0FBRyxDQUFDLFNBQWM7UUFDdkIsSUFBSSxJQUFJLENBQUMsYUFBYSxFQUFFO1lBQ3RCLHNDQUFzQztZQUN0QyxPQUFPLENBQUMsR0FBRyxDQUFDLFNBQVMsQ0FBQyxDQUFDO1NBQ3hCO0lBQ0gsQ0FBQztJQUVEOztPQUVHO0lBQ0ksV0FBVztRQUNoQixPQUFPLElBQUksQ0FBQyxhQUFhLENBQUM7SUFDNUIsQ0FBQztDQUNGO0FBcENELGdDQW9DQyJ9

View File

@ -1 +1 @@
import 'typings-global'; export { };

View File

@ -1,4 +1,3 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global"); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkZWJ1Zy5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRkZWJ1Zy5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkZWJ1Zy5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRkZWJ1Zy5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMEJBQXVCIn0=

View File

@ -1,5 +1,5 @@
{ {
"name": "smartdebug", "name": "@pushrocks/smartdebug",
"version": "2.0.7", "version": "2.0.7",
"description": "debug the smart way", "description": "debug the smart way",
"main": "dist/index.js", "main": "dist/index.js",
@ -10,9 +10,7 @@
"test": "(npmts)" "test": "(npmts)"
}, },
"devDependencies": { "devDependencies": {
"tapbundle": "^1.0.13" "tapbundle": "^2.0.0"
}, },
"dependencies": { "dependencies": {}
"typings-global": "^1.0.16"
}
} }

29
readme.md Normal file
View File

@ -0,0 +1,29 @@
# smartdebug
debug the smart way
## Availabililty
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/@pushrocks/smartdebug)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartdebug)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartdebug)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartdebug/)
## Status for master
[![build status](https://GitLab.com/pushrocks/smartdebug/badges/master/build.svg)](https://GitLab.com/pushrocks/smartdebug/commits/master)
[![coverage report](https://GitLab.com/pushrocks/smartdebug/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartdebug/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartdebug.svg)](https://www.npmjs.com/package/@pushrocks/smartdebug)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartdebug/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartdebug/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartdebug/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartdebug)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartdebug/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartdebug)
[![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
Use TypeScript for best in class instellisense.
For further information read the linked docs at the top of this README.
> licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| 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)

View File

@ -1,19 +1,23 @@
import { expect, tap } from 'tapbundle' import { expect, tap } from 'tapbundle';
import * as smartdebug from '../ts/index' import * as smartdebug from '../ts/index';
let testSmartDebug: smartdebug.SmartDebug let testSmartDebug: smartdebug.SmartDebug;
tap.test('should create a valid instance of SmartDebug', async () => { tap.test('should create a valid instance of SmartDebug', async () => {
testSmartDebug = new smartdebug.SmartDebug() testSmartDebug = new smartdebug.SmartDebug();
}) });
tap.test('should not log a message, if debugEnabled = false', async () => { tap.test('should not log a message, if debugEnabled = false', async () => {
testSmartDebug.log('should not log to console') testSmartDebug.log('should not log to console');
}) // tslint:disable-next-line:no-unused-expression
expect(testSmartDebug.debugEnabled).to.be.false;
});
tap.test('should log to console, if enabled', async () => { tap.test('should log to console, if enabled', async () => {
testSmartDebug.enableDebugging() testSmartDebug.enableDebugging();
testSmartDebug.log('should log to console') testSmartDebug.log('should log to console');
}) // tslint:disable-next-line:no-unused-expression
expect(testSmartDebug.debugEnabled).to.be.true;
});
tap.start() tap.start();

View File

@ -1,22 +1,39 @@
import * as plugins from './smartdebug.plugins' import * as plugins from './smartdebug.plugins';
export class SmartDebug { export class SmartDebug {
private debugEnabled: boolean = false private _debugEnabled: boolean = false;
get debugEnabled () {
return this._debugEnabled;
}
/** /**
* enables debugging output * enables debugging output
*/ */
enableDebugging () { public enableDebugging() {
this.debugEnabled = true this._debugEnabled = true;
}
/**
* disables debugging
*/
public disableDebugging() {
this._debugEnabled = false;
} }
/** /**
* logs a message based on the contraints of the SmartDebug instance * logs a message based on the contraints of the SmartDebug instance
*/ */
log (logObject: any) { public log(logObject: any) {
if (this.debugEnabled) { if (this._debugEnabled) {
console.log(logObject) // tslint:disable-next-line:no-console
console.log(logObject);
} }
} }
/**
* a function returning
*/
public isDebugMode() {
return this._debugEnabled;
}
} }

View File

@ -1 +1 @@
import 'typings-global' export {};

View File

@ -1,3 +1,13 @@
{ {
"extends": "tslint-config-standard" "extends": [
} "tslint:latest",
"tslint-config-prettier"
],
"rules": {
"semicolon": [
true,
"always"
]
}
}

View File

@ -2,16 +2,15 @@
# yarn lockfile v1 # yarn lockfile v1
"@types/chai-as-promised@0.0.29": "@types/chai-as-promised@^7.1.0":
version "0.0.29" version "7.1.0"
resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-0.0.29.tgz#43d52892aa998e185a3de3e2477edb8573be1d77" resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-7.1.0.tgz#010b04cde78eacfb6e72bfddb3e58fe23c2e78b9"
dependencies: dependencies:
"@types/chai" "*" "@types/chai" "*"
"@types/promises-a-plus" "*"
"@types/chai-string@^1.1.30": "@types/chai-string@^1.4.0":
version "1.1.31" version "1.4.0"
resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.1.31.tgz#a22f75d713f69da8c5cf34f8bc808a62cd249405" resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.4.0.tgz#c8b78deb9ae53e86c05a446c256138faeaff53c1"
dependencies: dependencies:
"@types/chai" "*" "@types/chai" "*"
@ -19,9 +18,9 @@
version "4.0.4" version "4.0.4"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.0.4.tgz#fe86315d9a66827feeb16f73bc954688ec950e18" resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.0.4.tgz#fe86315d9a66827feeb16f73bc954688ec950e18"
"@types/chai@^3.4.35": "@types/chai@^4.1.2":
version "3.5.2" version "4.1.2"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.5.2.tgz#c11cd2817d3a401b7ba0f5a420f35c56139b1c1e" resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.1.2.tgz#f1af664769cfb50af805431c407425ed619daa21"
"@types/glob@*": "@types/glob@*":
version "5.0.32" version "5.0.32"
@ -38,10 +37,6 @@
version "8.0.28" version "8.0.28"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.28.tgz#86206716f8d9251cf41692e384264cbd7058ad60" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.28.tgz#86206716f8d9251cf41692e384264cbd7058ad60"
"@types/promises-a-plus@*":
version "0.0.27"
resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780"
"@types/shelljs@^0.7.4": "@types/shelljs@^0.7.4":
version "0.7.4" version "0.7.4"
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.4.tgz#137b5f31306eaff4de120ffe5b9d74b297809cfc" resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.4.tgz#137b5f31306eaff4de120ffe5b9d74b297809cfc"
@ -83,25 +78,28 @@ brace-expansion@^1.1.7:
balanced-match "^1.0.0" balanced-match "^1.0.0"
concat-map "0.0.1" concat-map "0.0.1"
chai-as-promised@^6.0.0: chai-as-promised@^7.1.1:
version "6.0.0" version "7.1.1"
resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-6.0.0.tgz#1a02a433a6f24dafac63b9c96fa1684db1aa8da6" resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-7.1.1.tgz#08645d825deb8696ee61725dbf590c012eb00ca0"
dependencies: dependencies:
check-error "^1.0.2" check-error "^1.0.2"
chai-string@^1.3.0: chai-string@^1.4.0:
version "1.4.0" version "1.4.0"
resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.4.0.tgz#359140c051d36a4e4b1a5fc6b910152f438a8d49" resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.4.0.tgz#359140c051d36a4e4b1a5fc6b910152f438a8d49"
chai@^3.5.0: chai@^4.1.2:
version "3.5.0" version "4.1.2"
resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247" resolved "https://registry.yarnpkg.com/chai/-/chai-4.1.2.tgz#0f64584ba642f0f2ace2806279f4f06ca23ad73c"
dependencies: dependencies:
assertion-error "^1.0.1" assertion-error "^1.0.1"
deep-eql "^0.1.3" check-error "^1.0.1"
type-detect "^1.0.0" deep-eql "^3.0.0"
get-func-name "^2.0.0"
pathval "^1.0.0"
type-detect "^4.0.0"
check-error@^1.0.2: check-error@^1.0.1, check-error@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
@ -109,11 +107,11 @@ concat-map@0.0.1:
version "0.0.1" version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
deep-eql@^0.1.3: deep-eql@^3.0.0:
version "0.1.3" version "3.0.1"
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2" resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df"
dependencies: dependencies:
type-detect "0.1.1" type-detect "^4.0.0"
define-properties@^1.1.2: define-properties@^1.1.2:
version "1.1.2" version "1.1.2"
@ -164,6 +162,10 @@ function-bind@^1.0.2, function-bind@^1.1.1:
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
get-func-name@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41"
glob@^7.0.0: glob@^7.0.0:
version "7.1.2" version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
@ -278,6 +280,10 @@ path-parse@^1.0.5:
version "1.0.5" version "1.0.5"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"
pathval@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0"
pretty-bytes@^4.0.2: pretty-bytes@^4.0.2:
version "4.0.2" version "4.0.2"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
@ -306,16 +312,16 @@ shelljs@^0.7.8:
interpret "^1.0.0" interpret "^1.0.0"
rechoir "^0.6.2" rechoir "^0.6.2"
smartchai@^1.0.3: smartchai@^2.0.0:
version "1.0.3" version "2.0.1"
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.3.tgz#de6d010bb8b5aef24cb70b31a5f5334e8c41b72f" resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-2.0.1.tgz#d20f17221f0e3c6c3473600b78ddfba0ab0ea762"
dependencies: dependencies:
"@types/chai" "^3.4.35" "@types/chai" "^4.1.2"
"@types/chai-as-promised" "0.0.29" "@types/chai-as-promised" "^7.1.0"
"@types/chai-string" "^1.1.30" "@types/chai-string" "^1.4.0"
chai "^3.5.0" chai "^4.1.2"
chai-as-promised "^6.0.0" chai-as-promised "^7.1.1"
chai-string "^1.3.0" chai-string "^1.4.0"
smartdelay@^1.0.3: smartdelay@^1.0.3:
version "1.0.3" version "1.0.3"
@ -342,24 +348,19 @@ smartshell@^1.0.6:
typings-global "^1.0.20" typings-global "^1.0.20"
which "^1.3.0" which "^1.3.0"
tapbundle@^1.0.13: tapbundle@^2.0.0:
version "1.1.1" version "2.0.0"
resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-1.1.1.tgz#ec4172c0e82a77b1f6133fef2606311ede28a62d" resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-2.0.0.tgz#79fce68ff185c786fabaf6eb589a4afc7d2714b7"
dependencies: dependencies:
early "^2.1.1" early "^2.1.1"
leakage "^0.3.0" leakage "^0.3.0"
smartchai "^1.0.3" smartchai "^2.0.0"
smartdelay "^1.0.3" smartdelay "^1.0.3"
smartq "^1.1.1" smartq "^1.1.1"
typings-global "^1.0.19"
type-detect@0.1.1: type-detect@^4.0.0:
version "0.1.1" version "4.0.8"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
type-detect@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2"
typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.19, typings-global@^1.0.20: typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.19, typings-global@^1.0.20:
version "1.0.20" version "1.0.20"