Comparing version 2.0.2 to 2.1.0
@@ -126,32 +126,4 @@ 'use strict'; | ||
this.EMO = EMO; | ||
this.canEmoji = !this.isCmd() && process.env.CI === undefined; | ||
this.canEmoji = !this.isCmd() && !this.isCi(); | ||
} | ||
generateOutput(messages, defaultColorizer, defaultPrefixIcon, defaultPrefixText) { | ||
if (!Array.isArray(messages) || messages.length === 0) { | ||
return ''; | ||
} | ||
const outputChunks = []; | ||
outputChunks.push(this.canEmoji ? defaultPrefixIcon : defaultColorizer(defaultPrefixText)); | ||
outputChunks.push(...(this.canEmoji ? messages.map(message => defaultColorizer(`${message}`)) : messages)); | ||
const output = outputChunks.join(` `); | ||
return output; | ||
} | ||
isCmd() { | ||
if (typeof window !== undefined) { | ||
return false; | ||
} | ||
if (os.platform() !== 'win32') { | ||
return false; | ||
} | ||
try { | ||
const result = childProcess.spawnSync(`ls`, { | ||
env: process.env, | ||
stdio: 'pipe', | ||
}); | ||
return result.error !== undefined; | ||
} | ||
catch (err) { | ||
return true; | ||
} | ||
} | ||
debug(...messages) { | ||
@@ -192,2 +164,33 @@ const output = this.generateOutput(messages, chalk__default["default"].gray, this.EMO.pushpin, 'debug -'); | ||
} | ||
generateOutput(messages, defaultColorizer, defaultPrefixIcon, defaultPrefixText) { | ||
if (!Array.isArray(messages) || messages.length === 0) { | ||
return ''; | ||
} | ||
const outputChunks = []; | ||
outputChunks.push(this.canEmoji ? defaultPrefixIcon : defaultColorizer(defaultPrefixText)); | ||
outputChunks.push(...(this.canEmoji ? messages.map(message => defaultColorizer(`${message}`)) : messages)); | ||
const output = outputChunks.join(` `); | ||
return output; | ||
} | ||
isCmd() { | ||
if (typeof window !== undefined) { | ||
return false; | ||
} | ||
if (os.platform() !== 'win32') { | ||
return false; | ||
} | ||
try { | ||
const result = childProcess.spawnSync(`ls`, { | ||
env: process.env, | ||
stdio: 'pipe', | ||
}); | ||
return result.error !== undefined; | ||
} | ||
catch (err) { | ||
return true; | ||
} | ||
} | ||
isCi() { | ||
return typeof process !== undefined && typeof process.env !== undefined && process.env.CI !== undefined; | ||
} | ||
} | ||
@@ -194,0 +197,0 @@ const bhala = new Bhala(); |
@@ -0,0 +0,0 @@ import emoji from 'node-emoji'; |
{ | ||
"name": "bhala", | ||
"version": "2.0.2", | ||
"description": "A pretty (!), powerful and customizable logging library for Node.js.", | ||
"version": "2.1.0", | ||
"license": "MIT", | ||
"description": "A pretty (!), powerful and customizable logging library for Node.js.", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"/dist" | ||
], | ||
"engine": { | ||
"node": ">=14" | ||
}, | ||
"scripts": { | ||
"build": "rollup -c", | ||
"clean": "rm -Rf ./dist", | ||
"dev": "concurrently \"npm:dev:watch\" \"npm:dev:simulate\"", | ||
"dev:simulate": "nodemon --watch ./dist --watch ./examples/demo.js ./examples/demo.js", | ||
"dev:watch": "tsc -w", | ||
"test": "npm run test:lint", | ||
"test:lint": "eslint . --ext .js,.ts", | ||
"preversion": "npm test", | ||
"postversion": "node ./scripts/finalizeVersionBump.js" | ||
"build": "rm -Rf ./dist && rollup -c", | ||
"build:watch": "rollup -cw", | ||
"dev": "yarn build && concurrently \"yarn build:watch\" \"yarn dev:simulate\"", | ||
"dev:simulate": "nodemon --delay 2.5 --watch ./dist --watch ./examples/demo.js ./examples/demo.js", | ||
"prepare": "husky install", | ||
"test": "yarn test:lint && yarn test:e2e", | ||
"test:e2e": "yarn build && node ./examples/demo.js", | ||
"test:lint": "eslint . --ext .js,.ts" | ||
}, | ||
@@ -30,26 +21,23 @@ "dependencies": { | ||
"devDependencies": { | ||
"@ivangabriele/eslint-config-typescript-base": "1.5.0", | ||
"@ivangabriele/prettier-config": "1.1.0", | ||
"@rollup/plugin-node-resolve": "13.0.6", | ||
"@ivangabriele/commitlint-config": "1.0.2", | ||
"@ivangabriele/eslint-config-typescript-base": "2.1.4", | ||
"@ivangabriele/prettier-config": "2.0.2", | ||
"@ivangabriele/semantic-release-config-base": "1.2.0", | ||
"@rollup/plugin-node-resolve": "13.1.2", | ||
"@rollup/plugin-typescript": "8.3.0", | ||
"@types/node": "14.17.32", | ||
"@types/node": "16.11.17", | ||
"@types/node-emoji": "1.8.1", | ||
"@types/prettier": "2.4.1", | ||
"@types/shelljs": "0.8.9", | ||
"concurrently": "6.3.0", | ||
"jest": "27.3.1", | ||
"nodemon": "2.0.14", | ||
"@types/prettier": "2.4.2", | ||
"@types/shelljs": "0.8.10", | ||
"concurrently": "6.5.1", | ||
"husky": "7.0.4", | ||
"jest": "27.4.5", | ||
"nodemon": "2.0.15", | ||
"rimraf": "3.0.2", | ||
"rollup": "2.59.0", | ||
"rollup": "2.62.0", | ||
"rollup-plugin-node-polyfills": "0.2.1", | ||
"shelljs": "0.8.4", | ||
"typescript": "4.4.4", | ||
"typescript": "4.5.4", | ||
"wait-on": "6.0.0" | ||
}, | ||
"prettier": "@ivangabriele/prettier-config", | ||
"homepage": "https://github.com/ivangabriele/bhala#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "ssh://git@github.com/bhala.git" | ||
}, | ||
"author": { | ||
@@ -60,2 +48,12 @@ "name": "Ivan Gabriele", | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/ivangabriele/bhala/issues" | ||
}, | ||
"engine": { | ||
"node": ">=14" | ||
}, | ||
"files": [ | ||
"/dist" | ||
], | ||
"homepage": "https://github.com/ivangabriele/bhala#readme", | ||
"keywords": [ | ||
@@ -72,3 +70,16 @@ "cli", | ||
"terminal" | ||
] | ||
], | ||
"main": "./dist/index.js", | ||
"prettier": "@ivangabriele/prettier-config", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"release": { | ||
"extends": "@ivangabriele/semantic-release-config-base" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ivangabriele/bhala.git" | ||
}, | ||
"types": "./dist/index.d.ts" | ||
} |
@@ -29,3 +29,3 @@ <p align="center"> | ||
alt="GitHub Workflow Status" | ||
src="https://img.shields.io/github/workflow/status/ivangabriele/bhala/Test%20&%20Publish/main?style=flat-square" | ||
src="https://img.shields.io/github/workflow/status/ivangabriele/bhala/Check/main?style=flat-square" | ||
/> | ||
@@ -113,3 +113,3 @@ </a> | ||
```ts | ||
ß.warn(...messages: string[]) | ||
ß.info(...messages: string[]) | ||
``` | ||
@@ -116,0 +116,0 @@ |
Sorry, the diff of this file is too big to display
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
90465
2889
0
20
3