[Pkg-javascript-commits] [node-cliui] 01/01: New upstream version 4.0.0
Jérémy Lal
kapouer at moszumanska.debian.org
Fri Dec 29 22:11:04 UTC 2017
This is an automated email from the git hooks/post-receive script.
kapouer pushed a commit to branch upstream
in repository node-cliui.
commit fee4df906ac3e1a24de4670f130db0a93bdad6a9
Author: Jérémy Lal <kapouer at melix.org>
Date: Fri Dec 29 19:11:18 2017 +0100
New upstream version 4.0.0
---
.travis.yml | 5 ++---
CHANGELOG.md | 26 ++++++++++++++++++++++++++
README.md | 6 +++---
index.js | 6 +++++-
package.json | 23 +++++++++++++----------
test/cliui.js | 3 +++
6 files changed, 52 insertions(+), 17 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index ea02669..1716819 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,6 @@
language: node_js
node_js:
- - "0.10"
- - "0.12"
- "4"
- - "5"
+ - "6"
+ - "8"
after_script: npm run coverage
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ef6a35e..69c08f4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,32 @@
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.
+<a name="4.0.0"></a>
+# [4.0.0](https://github.com/yargs/cliui/compare/v3.2.0...v4.0.0) (2017-12-18)
+
+
+### Bug Fixes
+
+* downgrades strip-ansi to version 3.0.1 ([#54](https://github.com/yargs/cliui/issues/54)) ([5764c46](https://github.com/yargs/cliui/commit/5764c46))
+* set env variable FORCE_COLOR. ([#56](https://github.com/yargs/cliui/issues/56)) ([7350e36](https://github.com/yargs/cliui/commit/7350e36))
+
+
+### Chores
+
+* drop support for node < 4 ([#53](https://github.com/yargs/cliui/issues/53)) ([b105376](https://github.com/yargs/cliui/commit/b105376))
+
+
+### Features
+
+* add fallback for window width ([#45](https://github.com/yargs/cliui/issues/45)) ([d064922](https://github.com/yargs/cliui/commit/d064922))
+
+
+### BREAKING CHANGES
+
+* officially drop support for Node < 4
+
+
+
<a name="3.2.0"></a>
# [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11)
diff --git a/README.md b/README.md
index 028392c..3ad2119 100644
--- a/README.md
+++ b/README.md
@@ -10,9 +10,7 @@ easily create complex multi-column command-line-interfaces.
## Example
```js
-var ui = require('cliui')({
- width: 80
-})
+var ui = require('cliui')()
ui.div('Usage: $0 [command] [options]')
@@ -88,6 +86,7 @@ cliui = require('cliui')
### cliui({width: integer})
Specify the maximum width of the UI being generated.
+If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`.
### cliui({wrap: boolean})
@@ -99,6 +98,7 @@ Create a row with any number of columns, a column
can either be a string, or an object with the following
options:
+* **text:** some text to place in the column.
* **width:** the width of a column.
* **align:** alignment, `right` or `center`.
* **padding:** `[top, right, bottom, left]`.
diff --git a/index.js b/index.js
index e501e78..55abdee 100644
--- a/index.js
+++ b/index.js
@@ -282,6 +282,10 @@ function _minWidth (col) {
return minWidth
}
+function getWindowWidth () {
+ if (typeof process === 'object' && process.stdout && process.stdout.columns) return process.stdout.columns
+}
+
function alignRight (str, width) {
str = str.trim()
var padding = ''
@@ -310,7 +314,7 @@ module.exports = function (opts) {
opts = opts || {}
return new UI({
- width: (opts || {}).width || 80,
+ width: (opts || {}).width || getWindowWidth() || 80,
wrap: typeof opts.wrap === 'boolean' ? opts.wrap : true
})
}
diff --git a/package.json b/package.json
index 31c654c..e91f9f3 100644
--- a/package.json
+++ b/package.json
@@ -1,13 +1,13 @@
{
"name": "cliui",
- "version": "3.2.0",
+ "version": "4.0.0",
"description": "easily create complex multi-column command-line-interfaces",
"main": "index.js",
"scripts": {
"pretest": "standard",
"test": "nyc mocha",
"coverage": "nyc --reporter=text-lcov mocha | coveralls",
- "version": "standard-version"
+ "release": "standard-version"
},
"repository": {
"type": "git",
@@ -45,20 +45,23 @@
"author": "Ben Coe <ben at npmjs.com>",
"license": "ISC",
"dependencies": {
- "string-width": "^1.0.1",
- "strip-ansi": "^3.0.1",
+ "string-width": "^2.1.1",
+ "strip-ansi": "^4.0.0",
"wrap-ansi": "^2.0.0"
},
"devDependencies": {
"chai": "^3.5.0",
"chalk": "^1.1.2",
"coveralls": "^2.11.8",
- "mocha": "^2.4.5",
- "nyc": "^6.4.0",
- "standard": "^6.0.8",
- "standard-version": "^2.1.2"
+ "mocha": "^3.0.0",
+ "nyc": "^10.0.0",
+ "standard": "^8.0.0",
+ "standard-version": "^3.0.0"
},
"files": [
"index.js"
- ]
-}
\ No newline at end of file
+ ],
+ "engine": {
+ "node": ">=4"
+ }
+}
diff --git a/test/cliui.js b/test/cliui.js
index fd27f5a..76ae366 100644
--- a/test/cliui.js
+++ b/test/cliui.js
@@ -2,6 +2,9 @@
require('chai').should()
+// Force chalk to enable color, if it's disabled the test fails.
+process.env['FORCE_COLOR'] = 1
+
var chalk = require('chalk')
var cliui = require('../')
var stripAnsi = require('strip-ansi')
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-cliui.git
More information about the Pkg-javascript-commits
mailing list