Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
87155900e1 | |||
d24b11f737 | |||
17ebd58951 | |||
32bd229f91 |
@ -1,5 +1,7 @@
|
||||
# gitzone ci_default
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
variables:
|
||||
GIT_STRATEGY: clone
|
||||
|
||||
cache:
|
||||
paths:
|
||||
@ -48,15 +50,15 @@ testLTS:
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- priv
|
||||
|
||||
testSTABLE:
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci node install lts
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
- npmci command npm run build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
@ -65,7 +67,7 @@ testSTABLE:
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci node install lts
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
@ -98,7 +100,9 @@ trigger:
|
||||
- notpriv
|
||||
|
||||
pages:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
image: hosttoday/ht-docker-dbase:npmci
|
||||
services:
|
||||
- docker:18-dind
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
|
@ -23,6 +23,6 @@ Use TypeScript for best in class instellisense.
|
||||
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)
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
||||
[](https://maintainedby.lossless.com)
|
||||
|
758
package-lock.json
generated
758
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
20
package.json
20
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartenv",
|
||||
"version": "4.0.6",
|
||||
"version": "4.0.8",
|
||||
"description": "store things about your environment and let them travel across modules",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
@ -24,16 +24,17 @@
|
||||
"homepage": "https://gitlab.com/pushrocks/smartenv",
|
||||
"dependencies": {
|
||||
"@pushrocks/smartparam": "^1.0.4",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@types/node": "^12.0.8"
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@types/node": "^12.12.7",
|
||||
"is-wsl": "^2.1.1"
|
||||
},
|
||||
"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",
|
||||
"tslint": "^5.17.0",
|
||||
"@gitzone/tsbuild": "^2.1.17",
|
||||
"@gitzone/tsrun": "^1.2.8",
|
||||
"@gitzone/tstest": "^1.0.28",
|
||||
"@pushrocks/tapbundle": "^3.0.13",
|
||||
"@types/npm": "^2.0.31",
|
||||
"tslint": "^5.20.1",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"private": false,
|
||||
@ -42,6 +43,7 @@
|
||||
"ts_web/*",
|
||||
"dist/*",
|
||||
"dist_web/*",
|
||||
"dist_ts_web/*",
|
||||
"assets/*",
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
|
@ -11,7 +11,7 @@ export interface IEnvObject {
|
||||
* Smartenv class that makes it easy
|
||||
*/
|
||||
export class Smartenv {
|
||||
get runtimeEnv() {
|
||||
public get runtimeEnv() {
|
||||
if (typeof window !== 'undefined') {
|
||||
return 'browser';
|
||||
} else if (typeof process !== 'undefined') {
|
||||
@ -19,11 +19,11 @@ export class Smartenv {
|
||||
}
|
||||
}
|
||||
|
||||
get isBrowser(): boolean {
|
||||
public get isBrowser(): boolean {
|
||||
return !this.isNode;
|
||||
}
|
||||
|
||||
get userAgent(): string {
|
||||
public get userAgent(): string {
|
||||
if (this.isBrowser) {
|
||||
// make sure we are in Browser
|
||||
return navigator.userAgent;
|
||||
@ -32,15 +32,19 @@ export class Smartenv {
|
||||
}
|
||||
}
|
||||
|
||||
get isNode(): boolean {
|
||||
public get isNode(): boolean {
|
||||
return this.runtimeEnv === 'node';
|
||||
}
|
||||
|
||||
get nodeVersion(): string {
|
||||
public get isWsl(): boolean {
|
||||
return plugins.isWsl;
|
||||
}
|
||||
|
||||
public get nodeVersion(): string {
|
||||
return process.version;
|
||||
}
|
||||
|
||||
get isCI(): boolean {
|
||||
public get isCI(): boolean {
|
||||
if (this.isNode) {
|
||||
if (process.env.CI) {
|
||||
return true;
|
||||
@ -52,27 +56,27 @@ export class Smartenv {
|
||||
}
|
||||
}
|
||||
|
||||
async isMacAsync(): Promise<boolean> {
|
||||
public async isMacAsync(): Promise<boolean> {
|
||||
if (this.isNode) {
|
||||
let os = await import('os');
|
||||
const os = await import('os');
|
||||
return os.platform() === 'darwin';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isWindowsAsync(): Promise<boolean> {
|
||||
public async isWindowsAsync(): Promise<boolean> {
|
||||
if (this.isNode) {
|
||||
let os = await import('os');
|
||||
const os = await import('os');
|
||||
return os.platform() === 'win32';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isLinuxAsync(): Promise<boolean> {
|
||||
public async isLinuxAsync(): Promise<boolean> {
|
||||
if (this.isNode) {
|
||||
let os = await import('os');
|
||||
const os = await import('os');
|
||||
return os.platform() === 'linux';
|
||||
} else {
|
||||
return false;
|
||||
@ -90,10 +94,10 @@ export class Smartenv {
|
||||
/**
|
||||
* prints the environment to console
|
||||
*/
|
||||
async printEnv() {
|
||||
public async printEnv() {
|
||||
if (this.isNode) {
|
||||
console.log('running on NODE');
|
||||
let smartenvVersion = require('../package.json').version;
|
||||
const smartenvVersion = require('../package.json').version;
|
||||
console.log(
|
||||
'node version is ' + this.nodeVersion + ' and smartenv version is ' + smartenvVersion
|
||||
);
|
||||
|
@ -1,4 +1,12 @@
|
||||
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
|
||||
};
|
||||
|
Reference in New Issue
Block a user