fix(core): update

This commit is contained in:
Philipp Kunz 2019-06-17 08:46:28 +02:00
parent ffc781011d
commit 677c8d33b9
19 changed files with 1987 additions and 646 deletions

28
.gitignore vendored
View File

@ -1,14 +1,22 @@
node_modules/
.settings/
.idea/
.nogit/
# artifacts
coverage/
docs/
public/
pages/
#npm devug
npm-debug.log
# installs
node_modules/
ts/*.js
ts/*.js.map
ts/typings/
# caches
.yarn/
.cache/
.rpt2_cache
test/browser/browserified/
# builds
dist/
dist_web/
dist_serve/
dist_ts_web/
# custom

View File

@ -1,96 +1,117 @@
# gitzone standard
# gitzone ci_default
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .yarn/
- .npmci_cache/
key: "$CI_BUILD_STAGE"
stages:
- mirror
- security
- test
- release
- trigger
- pages
- metadata
# ====================
# security stage
# ====================
mirror:
stage: mirror
stage: security
script:
- npmci git mirror
tags:
- docker
- notpriv
security:
snyk:
stage: security
script:
- npmci command yarn global add snyk
- npmci command yarn install --ignore-scripts
- npmci npm prepare
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
tags:
- docker
- notpriv
testLEGACY:
stage: test
script:
- npmci node install legacy
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
allow_failure: true
# ====================
# test stage
# ====================
testLTS:
stage: test
script:
- npmci npm prepare
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
testSTABLE:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
release:
stage: release
script:
- npmci npm prepare
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
allow_failure: true
script:
- npmci command npm install -g tslint typescript
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- docker
- priv
trigger:
stage: trigger
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmci
stage: pages
stage: metadata
script:
- npmci command yarn global add npmpage
- npmci command npmpage
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

View File

@ -1,29 +1,28 @@
# smartenv
# @pushrocks/smartenv
store things about your environment and let them travel across modules
## Availabililty
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartenv)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartenv)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartenv)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartenv/)
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartenv)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartenv)
* [github.com (source mirror)](https://github.com/pushrocks/smartenv)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartenv/)
## Status for master
[![build status](https://GitLab.com/pushrocks/smartenv/badges/master/build.svg)](https://GitLab.com/pushrocks/smartenv/commits/master)
[![coverage report](https://GitLab.com/pushrocks/smartenv/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartenv/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/smartenv.svg)](https://www.npmjs.com/package/smartenv)
[![Dependency Status](https://david-dm.org/pushrocks/smartenv.svg)](https://david-dm.org/pushrocks/smartenv)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartenv/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartenv/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartenv/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartenv)
[![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/)
[![build status](https://gitlab.com/pushrocks/smartenv/badges/master/build.svg)](https://gitlab.com/pushrocks/smartenv/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartenv/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartenv/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartenv.svg)](https://www.npmjs.com/package/@pushrocks/smartenv)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartenv/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartenv)
[![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/)
## Usage
Use TypeScript for best in class instellisense.
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)
[![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)

1
dist/index.d.ts vendored
View File

@ -1 +0,0 @@
export * from './smartenv.classes.smartenv';

7
dist/index.js vendored
View File

@ -1,7 +0,0 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./smartenv.classes.smartenv"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLGlEQUEyQyJ9

View File

@ -1,22 +0,0 @@
export interface IEnvObject {
name: string;
value: string;
}
export declare class Smartenv {
readonly runtimeEnv: string;
readonly isBrowser: boolean;
readonly userAgent: string;
readonly isNode: boolean;
readonly nodeVersion: string;
readonly isCI: boolean;
isMacAsync(): Promise<boolean>;
isWindowsAsync(): Promise<boolean>;
isLinuxAsync(): Promise<boolean>;
/**
* get environment variables that fit the description
*/
/**
* prints the environment to console
*/
printEnv(): Promise<void>;
}

View File

@ -1,109 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
class Smartenv {
get runtimeEnv() {
if (typeof window !== 'undefined') {
return 'browser';
}
else if (typeof process !== 'undefined') {
return 'node';
}
}
get isBrowser() {
return !this.isNode;
}
get userAgent() {
if (this.isBrowser) {
return navigator.userAgent;
}
else {
return 'undefined';
}
}
get isNode() {
return this.runtimeEnv === 'node';
}
get nodeVersion() {
return process.version;
}
get isCI() {
if (this.isNode) {
if (process.env.CI) {
return true;
}
else {
return false;
}
;
}
else {
return false;
}
}
isMacAsync() {
return __awaiter(this, void 0, void 0, function* () {
if (this.isNode) {
let os = yield Promise.resolve().then(() => require('os'));
return os.platform() === 'darwin';
}
else {
return false;
}
});
}
isWindowsAsync() {
return __awaiter(this, void 0, void 0, function* () {
if (this.isNode) {
let os = yield Promise.resolve().then(() => require('os'));
return os.platform() === 'win32';
}
else {
return false;
}
});
}
isLinuxAsync() {
return __awaiter(this, void 0, void 0, function* () {
if (this.isNode) {
let os = yield Promise.resolve().then(() => require('os'));
return os.platform() === 'linux';
}
else {
return false;
}
});
}
/**
* get environment variables that fit the description
*/
// get envVars (regexArg: RegExp) {
// let EnvironmentArray = []
// // TODO: plugins.smartparam.forEachMinimatch()
// }
/**
* prints the environment to console
*/
printEnv() {
return __awaiter(this, void 0, void 0, function* () {
if (this.isNode) {
console.log('running on NODE');
let smartenvVersion = require('../package.json').version;
console.log('node version is ' + this.nodeVersion + ' and smartenv version is ' + smartenvVersion);
}
else {
console.log('running on BROWSER');
console.log('browser is ' + this.userAgent);
}
});
}
}
exports.Smartenv = Smartenv;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRlbnYuY2xhc3Nlcy5zbWFydGVudi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0ZW52LmNsYXNzZXMuc21hcnRlbnYudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQVFBO0lBRUUsSUFBSSxVQUFVO1FBQ1osRUFBRSxDQUFDLENBQUMsT0FBTyxNQUFNLEtBQUssV0FBVyxDQUFDLENBQUMsQ0FBQztZQUNsQyxNQUFNLENBQUMsU0FBUyxDQUFBO1FBQ2xCLENBQUM7UUFBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUMsT0FBTyxPQUFPLEtBQUssV0FBVyxDQUFDLENBQUMsQ0FBQztZQUMxQyxNQUFNLENBQUMsTUFBTSxDQUFBO1FBQ2YsQ0FBQztJQUNILENBQUM7SUFFRCxJQUFJLFNBQVM7UUFDWCxNQUFNLENBQUMsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFBO0lBQ3JCLENBQUM7SUFFRCxJQUFJL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FBTyxDQUFDLEdBQUcsQ0FBQyxrQkFBa0IsR0FBRyxJQUFJLENBQUMsV0FBVyxHQUFHLDJCQUEyQixHQUFHLGVBQWUsQ0FBQyxDQUFBO1lBQ3BHLENBQUM7WUFBQyxJQUFJLENBQUMsQ0FBQztnQkFDTixPQUFPLENBQUMsR0FBRyxDQUFDLG9CQUFvQixDQUFDLENBQUE7Z0JBQ2pDLE9BQU8sQ0FBQyxHQUFHLENBQUMsYUFBYSxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQTtZQUM3QyxDQUFDO1FBQ0gsQ0FBQztLQUFBO0NBQ0Y7QUExRkQsNEJBMEZDIn0=

View File

@ -1,4 +0,0 @@
import * as smartparam from 'smartparam';
import * as smartq from 'smartq';
import * as lodash from 'lodash';
export { lodash, smartparam, smartq };

View File

@ -1,9 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const smartparam = require("smartparam");
exports.smartparam = smartparam;
const smartq = require("smartq");
exports.smartq = smartq;
const lodash = require("lodash");
exports.lodash = lodash;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRlbnYucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0ZW52LnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5Q0FBd0M7QUFNcEMsZ0NBQVU7QUFMZCxpQ0FBZ0M7QUFNNUIsd0JBQU07QUFMVixpQ0FBZ0M7QUFHNUIsd0JBQU0ifQ==

View File

@ -1,10 +1,20 @@
{
"npmts": {
"coverageTreshold": 60
"coverageTreshold": 60
},
"npmci": {
"npmGlobalTools": [
"npmts"
]
},
"gitzone": {
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "smartenv",
"shortDescription": "store things about your environment and let them travel across modules",
"npmPackagename": "@pushrocks/smartenv",
"license": "MIT"
}
}
}

1772
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,12 @@
{
"name": "smartenv",
"name": "@pushrocks/smartenv",
"version": "4.0.3",
"description": "store things about your environment and let them travel across modules",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"test": "(npmts)",
"test": "(tstest test/ --web)",
"build": "(tsbuild --web)",
"testbrowser": "(npm test) && (node testbrowser.js)"
},
"repository": {
@ -22,13 +23,28 @@
},
"homepage": "https://gitlab.com/pushrocks/smartenv",
"dependencies": {
"@types/node": "^9.4.4",
"lodash": "^4.17.5",
"smartparam": "^1.0.2",
"smartq": "^1.1.6"
"@pushrocks/smartparam": "^1.0.4",
"@pushrocks/smartpromise": "^3.0.2",
"@types/node": "^12.0.8"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.11",
"@gitzone/tsrun": "^1.2.6",
"@gitzone/tstest": "^1.0.24",
"@pushrocks/tapbundle": "^3.0.9",
"@types/npm": "^2.0.29",
"tapbundle": "^1.1.8"
}
"tslint": "^5.17.0",
"tslint-config-prettier": "^1.18.0"
},
"private": true,
"files": [
"ts/*",
"ts_web/*",
"dist/*",
"dist_web/*",
"assets/*",
"cli.js",
"npmextra.json",
"readme.md"
]
}

View File

@ -1,38 +1,37 @@
import { tap, expect } from 'tapbundle'
import * as smartenv from '../ts/index'
import { tap, expect } from '@pushrocks/tapbundle';
import * as smartenv from '../ts/index';
let testEnv: smartenv.Smartenv
let testEnv: smartenv.Smartenv;
tap.test('should print env', async () => {
testEnv = new smartenv.Smartenv()
})
testEnv = new smartenv.Smartenv();
});
tap.test('should print a overview to console', async () => {
testEnv.printEnv()
})
testEnv.printEnv();
});
tap.test('should get os', async () => {
let resultMac = await testEnv.isMacAsync()
let resultLinux = await testEnv.isLinuxAsync()
let resultWindows = await testEnv.isWindowsAsync()
const osModule = await import('os')
const resultMac = await testEnv.isMacAsync();
const resultLinux = await testEnv.isLinuxAsync();
const resultWindows = await testEnv.isWindowsAsync();
const osModule = await import('os');
if (resultMac) {
expect(osModule.platform()).to.equal('darwin');
console.log('platform is Mac!')
console.log('platform is Mac!');
} else if (resultLinux) {
expect(osModule.platform()).to.equal('linux');
console.log('platform is Linux!')
console.log('platform is Linux!');
} else {
expect(osModule.platform()).to.equal('win32');
console.log('platform is Windows!')
console.log('platform is Windows!');
}
})
});
tap.test('should state wether we are in CI', async () => {
if(process.env.CI) {
expect(testEnv.isCI).to.be.true()
if (process.env.CI) {
expect(testEnv.isCI).to.be.true;
}
})
});
tap.start()
tap.start();

View File

@ -1 +1 @@
export * from './smartenv.classes.smartenv'
export * from './smartenv.classes.smartenv';

9
ts/interfaces/index.ts Normal file
View File

@ -0,0 +1,9 @@
export let defaultme = null;
declare global {
namespace NodeJS {
interface Global {
window: any;
navigator: any;
}
}
}

View File

@ -1,77 +1,81 @@
import * as plugins from './smartenv.plugins'
import * as plugins from './smartenv.plugins';
import * as interfaces from './interfaces';
// interfaces
export interface IEnvObject {
name: string
value: string
name: string;
value: string;
}
/**
* Smartenv class that makes it easy
*/
export class Smartenv {
get runtimeEnv () {
get runtimeEnv() {
if (typeof window !== 'undefined') {
return 'browser'
return 'browser';
} else if (typeof process !== 'undefined') {
return 'node'
return 'node';
}
}
get isBrowser (): boolean {
return !this.isNode
get isBrowser(): boolean {
return !this.isNode;
}
get userAgent (): string {
if (this.isBrowser) { // make sure we are in Browser
return navigator.userAgent
get userAgent(): string {
if (this.isBrowser) {
// make sure we are in Browser
return navigator.userAgent;
} else {
return 'undefined'
return 'undefined';
}
}
get isNode ():boolean {
return this.runtimeEnv === 'node'
get isNode(): boolean {
return this.runtimeEnv === 'node';
}
get nodeVersion ():string {
return process.version
get nodeVersion(): string {
return process.version;
}
get isCI (): boolean {
get isCI(): boolean {
if (this.isNode) {
if (process.env.CI) {
return true
return true;
} else {
return false
};
return false;
}
} else {
return false
return false;
}
}
async isMacAsync (): Promise<boolean> {
if(this.isNode) {
let os = await import('os')
return os.platform() === 'darwin'
async isMacAsync(): Promise<boolean> {
if (this.isNode) {
let os = await import('os');
return os.platform() === 'darwin';
} else {
return false
}
}
async isWindowsAsync (): Promise<boolean> {
if(this.isNode) {
let os = await import('os')
return os.platform() === 'win32'
} else {
return false
return false;
}
}
async isLinuxAsync (): Promise<boolean> {
if(this.isNode) {
let os = await import('os')
return os.platform() === 'linux'
async isWindowsAsync(): Promise<boolean> {
if (this.isNode) {
let os = await import('os');
return os.platform() === 'win32';
} else {
return false
return false;
}
}
async isLinuxAsync(): Promise<boolean> {
if (this.isNode) {
let os = await import('os');
return os.platform() === 'linux';
} else {
return false;
}
}
@ -86,14 +90,16 @@ export class Smartenv {
/**
* prints the environment to console
*/
async printEnv () {
async printEnv() {
if (this.isNode) {
console.log('running on NODE')
let smartenvVersion = require('../package.json').version
console.log('node version is ' + this.nodeVersion + ' and smartenv version is ' + smartenvVersion)
console.log('running on NODE');
let smartenvVersion = require('../package.json').version;
console.log(
'node version is ' + this.nodeVersion + ' and smartenv version is ' + smartenvVersion
);
} else {
console.log('running on BROWSER')
console.log('browser is ' + this.userAgent)
console.log('running on BROWSER');
console.log('browser is ' + this.userAgent);
}
}
}

View File

@ -1,9 +1,4 @@
import * as smartparam from 'smartparam'
import * as smartq from 'smartq'
import * as lodash from 'lodash'
import * as smartparam from '@pushrocks/smartparam';
import * as smartq from '@pushrocks/smartpromise';
export {
lodash,
smartparam,
smartq
}
export { smartparam, smartq };

View File

@ -1,3 +1,17 @@
{
"extends": "tslint-config-standard"
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}

356
yarn.lock
View File

@ -1,356 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@types/code@^4.0.3":
version "4.0.3"
resolved "https://registry.yarnpkg.com/@types/code/-/code-4.0.3.tgz#9c4de39f86eb3eba070146d2dab7dbc3f8eac35f"
"@types/lodash@^4.14.55":
version "4.14.102"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.102.tgz#586a3e22385fc79b07cef9c5a1c8a5387986fbc8"
"@types/node@*", "@types/node@^9.4.4":
version "9.4.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-9.4.4.tgz#4cad4305d1ec84eab2dc2bda97dfb6a5f652cccb"
"@types/node@^8.0.33":
version "8.9.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.9.2.tgz#94bb08914ea1aebbb18ecff4c27dc0930e512934"
"@types/npm@^2.0.29":
version "2.0.29"
resolved "https://registry.yarnpkg.com/@types/npm/-/npm-2.0.29.tgz#013a2789d6b11039ebf8ee7a4b5dafed4350461c"
dependencies:
"@types/node" "*"
ansi-256-colors@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a"
ansi-styles@^3.1.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88"
dependencies:
color-convert "^1.9.0"
balanced-match@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
beautycolor@^1.0.7:
version "1.0.11"
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.11.tgz#71c5568d5a7ed5c144d3a54f753ad1b08862aea5"
dependencies:
ansi-256-colors "^1.1.0"
typings-global "^1.0.14"
beautylog@6.1.10:
version "6.1.10"
resolved "https://registry.yarnpkg.com/beautylog/-/beautylog-6.1.10.tgz#9c27e566937684cb689f9372d98cfa5415d50b72"
dependencies:
"@types/lodash" "^4.14.55"
beautycolor "^1.0.7"
figlet "^1.2.0"
lodash "^4.17.4"
ora "^1.1.0"
smartenv "^2.0.0"
smartq "^1.1.1"
typings-global "^1.0.14"
bindings@^1.2.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7"
brace-expansion@^1.1.7:
version "1.1.10"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.10.tgz#5205cdf64c9798c180dc74b7bfc670c3974e6300"
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
chalk@^2.0.1, chalk@^2.1.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba"
dependencies:
ansi-styles "^3.1.0"
escape-string-regexp "^1.0.5"
supports-color "^4.0.0"
cli-cursor@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5"
dependencies:
restore-cursor "^2.0.0"
cli-spinners@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-1.1.0.tgz#f1847b168844d917a671eb9d147e3df497c90d06"
code@^5.1.0:
version "5.1.2"
resolved "https://registry.yarnpkg.com/code/-/code-5.1.2.tgz#e3310c2078ca7dc0b49b9c39a8b0a7b06bd75efe"
dependencies:
hoek "5.x.x"
color-convert@^1.9.0:
version "1.9.1"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed"
dependencies:
color-name "^1.1.1"
color-name@^1.1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
define-properties@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
dependencies:
foreach "^2.0.5"
object-keys "^1.0.8"
early@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/early/-/early-2.1.1.tgz#841e23254ea5dc54d8afaeee82f5ab65c00ee23c"
dependencies:
beautycolor "^1.0.7"
smartq "^1.1.1"
typings-global "^1.0.16"
es-abstract@^1.5.1:
version "1.10.0"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.10.0.tgz#1ecb36c197842a00d8ee4c2dfd8646bb97d60864"
dependencies:
es-to-primitive "^1.1.1"
function-bind "^1.1.1"
has "^1.0.1"
is-callable "^1.1.3"
is-regex "^1.0.4"
es-to-primitive@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
dependencies:
is-callable "^1.1.1"
is-date-object "^1.0.1"
is-symbol "^1.0.1"
es6-error@^4.0.2:
version "4.1.1"
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d"
escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
figlet@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/figlet/-/figlet-1.2.0.tgz#6c46537378fab649146b5a6143dda019b430b410"
foreach@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
function-bind@^1.0.2, function-bind@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
has-flag@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51"
has@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
dependencies:
function-bind "^1.0.2"
hoek@5.x.x:
version "5.0.3"
resolved "https://registry.yarnpkg.com/hoek/-/hoek-5.0.3.tgz#b71d40d943d0a95da01956b547f83c4a5b4a34ac"
is-callable@^1.1.1, is-callable@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
is-date-object@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
is-promise@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa"
is-regex@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
dependencies:
has "^1.0.1"
is-symbol@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
leakage@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.3.0.tgz#15d698abdc76bbc6439601f4f3020e77e2d50c39"
dependencies:
es6-error "^4.0.2"
left-pad "^1.1.3"
memwatch-next "^0.3.0"
minimist "^1.2.0"
pretty-bytes "^4.0.2"
left-pad@^1.1.3:
version "1.2.0"
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.2.0.tgz#d30a73c6b8201d8f7d8e7956ba9616087a68e0ee"
lodash@^4.17.4, lodash@^4.17.5:
version "4.17.5"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"
log-symbols@^2.1.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a"
dependencies:
chalk "^2.0.1"
memwatch-next@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f"
dependencies:
bindings "^1.2.1"
nan "^2.3.2"
mimic-fn@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022"
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
dependencies:
brace-expansion "^1.1.7"
minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
nan@^2.3.2:
version "2.8.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.8.0.tgz#ed715f3fe9de02b57a5e6252d90a96675e1f085a"
object-keys@^1.0.8:
version "1.0.11"
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
object.getownpropertydescriptors@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16"
dependencies:
define-properties "^1.1.2"
es-abstract "^1.5.1"
onetime@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4"
dependencies:
mimic-fn "^1.0.0"
ora@^1.1.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/ora/-/ora-1.4.0.tgz#884458215b3a5d4097592285f93321bb7a79e2e5"
dependencies:
chalk "^2.1.0"
cli-cursor "^2.1.0"
cli-spinners "^1.0.1"
log-symbols "^2.1.0"
pretty-bytes@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
restore-cursor@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf"
dependencies:
onetime "^2.0.0"
signal-exit "^3.0.2"
signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
smartchai@^1.0.3:
version "1.0.8"
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.8.tgz#a074836f4ddd4b98c50f1e7ae9e8e8ad9f6f1902"
dependencies:
"@types/code" "^4.0.3"
code "^5.1.0"
typings-global "^1.0.20"
smartdelay@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.4.tgz#791c1a4ee6770494064c10b1d2d2b8e6f3105b82"
dependencies:
smartq "^1.1.1"
typings-global "^1.0.16"
smartenv@^2.0.0:
version "2.0.6"
resolved "https://registry.yarnpkg.com/smartenv/-/smartenv-2.0.6.tgz#b38c679b0c151b9af548f68c3a072c29d1417e8d"
dependencies:
lodash "^4.17.4"
smartq "^1.1.1"
typings-global "^1.0.14"
smartparam@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/smartparam/-/smartparam-1.0.2.tgz#6b6a50353b81dbe3353c0d353fbccd02e8963f2c"
dependencies:
beautylog "6.1.10"
is-promise "^2.1.0"
minimatch "^3.0.4"
smartq "^1.1.6"
typings-global "^1.0.20"
smartq@^1.1.1, smartq@^1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.6.tgz#0c1ff4336d95e95b4f1fdd8ccd7e2c5a323b8412"
dependencies:
typings-global "^1.0.19"
util.promisify "^1.0.0"
supports-color@^4.0.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b"
dependencies:
has-flag "^2.0.0"
tapbundle@^1.1.8:
version "1.1.8"
resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-1.1.8.tgz#e08aee0e100a830d8a26a583a85d37ce53312e02"
dependencies:
"@types/node" "^8.0.33"
early "^2.1.1"
leakage "^0.3.0"
smartchai "^1.0.3"
smartdelay "^1.0.3"
smartq "^1.1.1"
typings-global "^1.0.19"
typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.19, typings-global@^1.0.20:
version "1.0.28"
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.28.tgz#e28cc965476564cbc00e438739e0aa0735d323d4"
util.promisify@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030"
dependencies:
define-properties "^1.1.2"
object.getownpropertydescriptors "^2.0.3"