feat: introduce common console logger (#317)

* feat: introduce common console logger

* update README
This commit is contained in:
Tommy Nguyen 2021-06-23 19:34:29 +02:00 коммит произвёл GitHub
Родитель a557826de3
Коммит c630c871d6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 56 добавлений и 0 удалений

Просмотреть файл

@ -27,6 +27,7 @@ libraries.
| [@rnx-kit/bundle-diff](https://github.com/microsoft/rnx-kit/tree/main/packages/bundle-diff) | Simple tool for diffing the content of two bundles |
| [@rnx-kit/cli](https://github.com/microsoft/rnx-kit/tree/main/packages/cli) | Command-line interface for rnx-kit |
| [@rnx-kit/config](https://github.com/microsoft/rnx-kit/tree/main/packages/config) | Package for defining and querying information about rnx kits |
| [@rnx-kit/console](https://github.com/microsoft/rnx-kit/tree/main/packages/console) | Simple console logger |
| [@rnx-kit/dep-check](https://github.com/microsoft/rnx-kit/tree/main/packages/dep-check) | Dependency checker for React Native apps |
| [@rnx-kit/metro-config](https://github.com/microsoft/rnx-kit/tree/main/packages/metro-config) | Metro config for monorepos |
| [@rnx-kit/metro-plugin-cyclic-dependencies-detector](https://github.com/microsoft/rnx-kit/tree/main/packages/metro-plugin-cyclic-dependencies-detector) | Cyclic dependencies detector for Metro |

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Introduce a common console logger",
"packageName": "@rnx-kit/console",
"email": "4123478+tido64@users.noreply.github.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,2 @@
const { configureJust } = require("rnx-kit-scripts");
configureJust();

Просмотреть файл

@ -0,0 +1,30 @@
{
"name": "@rnx-kit/console",
"version": "1.0.0-alpha",
"description": "Simple console logger",
"homepage": "https://github.com/microsoft/rnx-kit/tree/main/packages/console#readme",
"license": "MIT",
"files": [
"lib/*"
],
"main": "lib/index.js",
"repository": {
"type": "git",
"url": "https://github.com/microsoft/rnx-kit",
"directory": "packages/console"
},
"scripts": {
"build": "rnx-kit-scripts build",
"format": "prettier --write src/*.ts test/*.ts"
},
"dependencies": {
"chalk": "^4.1.0"
},
"devDependencies": {
"@types/node": "^12.0.0",
"rnx-kit-scripts": "*"
},
"eslintConfig": {
"extends": "@rnx-kit/eslint-config"
}
}

Просмотреть файл

@ -0,0 +1,12 @@
import chalk from "chalk";
type Log = typeof console.log;
export const error: Log = (...args) =>
console.error(chalk.red.bold("error"), ...args);
export const info: Log = (...args) =>
console.log(chalk.cyan.bold("info"), ...args);
export const warn: Log = (...args) =>
console.warn(chalk.yellow.bold("warn"), ...args);

Просмотреть файл

@ -0,0 +1,4 @@
{
"extends": "rnx-kit-scripts/tsconfig-shared.json",
"include": ["src"]
}