Compare commits

...

8 Commits

Author SHA1 Message Date
87155900e1 4.0.8 2019-11-15 20:59:04 +01:00
d24b11f737 fix(core): update 2019-11-15 20:59:02 +01:00
17ebd58951 4.0.7 2019-08-22 00:20:11 +02:00
32bd229f91 fix(core): update 2019-08-22 00:20:10 +02:00
4e5ddf8411 4.0.6 2019-06-17 08:54:47 +02:00
701c7c1b8b fix(core): update 2019-06-17 08:54:46 +02:00
9a272def16 4.0.5 2019-06-17 08:51:04 +02:00
0213950aae fix(core): update 2019-06-17 08:51:03 +02:00
7 changed files with 369 additions and 487 deletions

View File

@ -1,5 +1,7 @@
# gitzone ci_default # gitzone ci_default
image: hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
variables:
GIT_STRATEGY: clone
cache: cache:
paths: paths:
@ -48,15 +50,15 @@ testLTS:
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv - priv
testSTABLE: testBuild:
stage: test stage: test
script: script:
- npmci npm prepare - npmci npm prepare
- npmci node install stable - npmci node install lts
- npmci npm install - npmci npm install
- npmci npm test - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
@ -65,7 +67,7 @@ testSTABLE:
release: release:
stage: release stage: release
script: script:
- npmci node install stable - npmci node install lts
- npmci npm publish - npmci npm publish
only: only:
- tags - tags
@ -98,7 +100,9 @@ trigger:
- notpriv - notpriv
pages: pages:
image: hosttoday/ht-docker-node:npmci image: hosttoday/ht-docker-dbase:npmci
services:
- docker:18-dind
stage: metadata stage: metadata
script: script:
- npmci command npm install -g @gitzone/tsdoc - npmci command npm install -g @gitzone/tsdoc

View File

@ -23,6 +23,6 @@ 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) > 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)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com) [![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@ -1,11 +1,7 @@
{ {
"npmts": {
"coverageTreshold": 60
},
"npmci": { "npmci": {
"npmGlobalTools": [ "npmGlobalTools": [],
"npmts" "npmAccessLevel": "public"
]
}, },
"gitzone": { "gitzone": {
"module": { "module": {

758
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartenv", "name": "@pushrocks/smartenv",
"version": "4.0.4", "version": "4.0.8",
"description": "store things about your environment and let them travel across modules", "description": "store things about your environment and let them travel across modules",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
@ -24,24 +24,26 @@
"homepage": "https://gitlab.com/pushrocks/smartenv", "homepage": "https://gitlab.com/pushrocks/smartenv",
"dependencies": { "dependencies": {
"@pushrocks/smartparam": "^1.0.4", "@pushrocks/smartparam": "^1.0.4",
"@pushrocks/smartpromise": "^3.0.2", "@pushrocks/smartpromise": "^3.0.6",
"@types/node": "^12.0.8" "@types/node": "^12.12.7",
"is-wsl": "^2.1.1"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.11", "@gitzone/tsbuild": "^2.1.17",
"@gitzone/tsrun": "^1.2.6", "@gitzone/tsrun": "^1.2.8",
"@gitzone/tstest": "^1.0.24", "@gitzone/tstest": "^1.0.28",
"@pushrocks/tapbundle": "^3.0.9", "@pushrocks/tapbundle": "^3.0.13",
"@types/npm": "^2.0.29", "@types/npm": "^2.0.31",
"tslint": "^5.17.0", "tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"private": true, "private": false,
"files": [ "files": [
"ts/*", "ts/*",
"ts_web/*", "ts_web/*",
"dist/*", "dist/*",
"dist_web/*", "dist_web/*",
"dist_ts_web/*",
"assets/*", "assets/*",
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",

View File

@ -11,7 +11,7 @@ export interface IEnvObject {
* Smartenv class that makes it easy * Smartenv class that makes it easy
*/ */
export class Smartenv { export class Smartenv {
get runtimeEnv() { public get runtimeEnv() {
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
return 'browser'; return 'browser';
} else if (typeof process !== 'undefined') { } else if (typeof process !== 'undefined') {
@ -19,11 +19,11 @@ export class Smartenv {
} }
} }
get isBrowser(): boolean { public get isBrowser(): boolean {
return !this.isNode; return !this.isNode;
} }
get userAgent(): string { public get userAgent(): string {
if (this.isBrowser) { if (this.isBrowser) {
// make sure we are in Browser // make sure we are in Browser
return navigator.userAgent; return navigator.userAgent;
@ -32,15 +32,19 @@ export class Smartenv {
} }
} }
get isNode(): boolean { public get isNode(): boolean {
return this.runtimeEnv === 'node'; return this.runtimeEnv === 'node';
} }
get nodeVersion(): string { public get isWsl(): boolean {
return plugins.isWsl;
}
public get nodeVersion(): string {
return process.version; return process.version;
} }
get isCI(): boolean { public get isCI(): boolean {
if (this.isNode) { if (this.isNode) {
if (process.env.CI) { if (process.env.CI) {
return true; return true;
@ -52,27 +56,27 @@ export class Smartenv {
} }
} }
async isMacAsync(): Promise<boolean> { public async isMacAsync(): Promise<boolean> {
if (this.isNode) { if (this.isNode) {
let os = await import('os'); const os = await import('os');
return os.platform() === 'darwin'; return os.platform() === 'darwin';
} else { } else {
return false; return false;
} }
} }
async isWindowsAsync(): Promise<boolean> { public async isWindowsAsync(): Promise<boolean> {
if (this.isNode) { if (this.isNode) {
let os = await import('os'); const os = await import('os');
return os.platform() === 'win32'; return os.platform() === 'win32';
} else { } else {
return false; return false;
} }
} }
async isLinuxAsync(): Promise<boolean> { public async isLinuxAsync(): Promise<boolean> {
if (this.isNode) { if (this.isNode) {
let os = await import('os'); const os = await import('os');
return os.platform() === 'linux'; return os.platform() === 'linux';
} else { } else {
return false; return false;
@ -90,10 +94,10 @@ export class Smartenv {
/** /**
* prints the environment to console * prints the environment to console
*/ */
async printEnv() { public async printEnv() {
if (this.isNode) { if (this.isNode) {
console.log('running on NODE'); console.log('running on NODE');
let smartenvVersion = require('../package.json').version; const smartenvVersion = require('../package.json').version;
console.log( console.log(
'node version is ' + this.nodeVersion + ' and smartenv version is ' + smartenvVersion 'node version is ' + this.nodeVersion + ' and smartenv version is ' + smartenvVersion
); );

View File

@ -1,4 +1,12 @@
import * as smartparam from '@pushrocks/smartparam'; import * as smartparam from '@pushrocks/smartparam';
import * as smartq from '@pushrocks/smartpromise'; import * as smartpromise from '@pushrocks/smartpromise';
export { smartparam, smartq }; export { smartparam, smartpromise };
// third party scope
import isWsl from 'is-wsl';
export {
isWsl
};