Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: unjs/consola
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.4.1
Choose a base ref
...
head repository: unjs/consola
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.5.0
Choose a head ref
  • 5 commits
  • 5 files changed
  • 1 contributor

Commits on Feb 23, 2019

  1. feat(fancy): move right to the left if length is <= 80

    pooya parsa committed Feb 23, 2019

    Verified

    This commit was signed with the committer’s verified signature.
    kwasniew Mateusz Kwasniewski
    Copy the full SHA
    34738c7 View commit details
  2. feat(fancy): highlight keywords with grave accent char

    pooya parsa committed Feb 23, 2019

    Verified

    This commit was signed with the committer’s verified signature.
    kwasniew Mateusz Kwasniewski
    Copy the full SHA
    b3e09fd View commit details
  3. feat: upgrade dependencies

    pooya parsa committed Feb 23, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1b6ea4b View commit details
  4. perf(pkg): reduce install size

    pooya parsa committed Feb 23, 2019
    Copy the full SHA
    f4a1861 View commit details
  5. chore(release): 2.5.0

    pooya parsa committed Feb 23, 2019
    Copy the full SHA
    3944212 View commit details
Showing with 623 additions and 899 deletions.
  1. +16 −0 CHANGELOG.md
  2. +2 −0 examples/special.js
  3. +10 −13 package.json
  4. +10 −5 src/reporters/fancy.js
  5. +585 −881 yarn.lock
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,22 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

# [2.5.0](https://github.com/nuxt/consola/compare/v2.4.1...v2.5.0) (2019-02-23)


### Features

* upgrade dependencies ([1b6ea4b](https://github.com/nuxt/consola/commit/1b6ea4b))
* **fancy:** highlight keywords with grave accent char ([b3e09fd](https://github.com/nuxt/consola/commit/b3e09fd))
* **fancy:** move right to the left if length is <= 80 ([34738c7](https://github.com/nuxt/consola/commit/34738c7))


### Performance Improvements

* **pkg:** reduce install size ([f4a1861](https://github.com/nuxt/consola/commit/f4a1861))



<a name="2.4.1"></a>
## [2.4.1](https://github.com/nuxt/consola/compare/v2.4.0...v2.4.1) (2019-02-12)

2 changes: 2 additions & 0 deletions examples/special.js
Original file line number Diff line number Diff line change
@@ -18,6 +18,8 @@ consola.error({ type: 'CSSError', message: 'Use scss' })

consola.error(undefined, null, false, true, NaN)

consola.log('We can `monospace` keyword using grave accent charachter!')

// Nonstandard error
const { message, stack } = new Error('Custom Error!')
consola.error({ message, stack })
23 changes: 10 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{
"name": "consola",
"version": "2.4.1",
"version": "2.5.0",
"description": "Elegant Console Logger for Node.js and Browser",
"license": "MIT",
"repository": "nuxt/consola",
"main": "consola.js",
"browser": "dist/consola.browser.js",
"typings": "types/consola.d.ts",
"scripts": {
"build": "yarn build:cjs && yarn build:es && yarn build:browser",
"build:cjs": "bili --file-name consola.js --format cjs src/index.js",
"build:es": "bili --file-name consola.mjs --format es src/index.js",
"build:browser": "bili --file-name consola.browser.js --format umd --module-name consola src/browser.js",
"build": "yarn build:cjs && yarn build:browser",
"build:cjs": "bili --file-name consola.js --format cjs --bundle-node-modules --minify src/index.js",
"build:browser": "bili --file-name consola.browser.js --format umd --module-name consola --bundle-node-modules --minify src/browser.js",
"demo": "node demo",
"browser": "serve",
"test": "yarn lint && yarn test:types && yarn build && jest test",
@@ -40,13 +39,6 @@
"Clark Du (@clarkdo)",
"@pimlie <pimlie@hotmail.com>"
],
"dependencies": {
"chalk": "^2.4.2",
"dayjs": "^1.8.3",
"figures": "^2.0.0",
"std-env": "^2.2.1",
"string-width": "^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.1.6",
"@babel/preset-env": "^7.1.6",
@@ -55,6 +47,8 @@
"babel-jest": "^24.0.0",
"benchmark": "^2.1.4",
"bili": "^4.2.5",
"chalk": "^2.4.2",
"dayjs": "^1.8.6",
"eslint": "^5.7.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
@@ -63,11 +57,14 @@
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"esm": "^3.0.84",
"figures": "^2.0.0",
"jest": "^24.0.0",
"lodash": "^4.17.11",
"sentencer": "^0.1.5",
"serve": "^10.1.1",
"standard-version": "^4.4.0",
"standard-version": "^5.0.0",
"std-env": "^2.2.1",
"string-width": "^3.0.0",
"ts-node": "^8.0.2",
"typescript": "^3.3.1",
"winston": "^3.1.0"
15 changes: 10 additions & 5 deletions src/reporters/fancy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import stringWidth from 'string-width'
import figures from 'figures'
import chalk from 'chalk'
import BasicReporter from './basic'
import { parseStack } from '../utils/error'
import { chalkColor, chalkBgColor } from '../utils/chalk'
@@ -64,16 +65,20 @@ export default class FancyReporter extends BasicReporter {

const tag = logObj.tag ? secondaryColor(logObj.tag) : ''

let line
let left = this.filterAndJoin([type, message])
let right = this.filterAndJoin([tag, date])

const space = width - stringWidth(left) - stringWidth(right) - 2
if (width > 80) {
const space = width - stringWidth(left) - stringWidth(right) - 2
line = space > 0 ? (left + ' '.repeat(space) + right) : left
} else {
line = right + ' ' + left
}

let line = space > 0 ? (left + ' '.repeat(space) + right) : left
line += additional.length ? '\n' + additional.join('\n') : ''

line += additional.length
? '\n' + additional.join('\n')
: ''
line = line.replace(/`(.+)`/g, (_, m) => chalk.cyan(m))

return isBadge ? '\n' + line + '\n' : line
}
1,466 changes: 585 additions & 881 deletions yarn.lock

Large diffs are not rendered by default.