initial commit
This commit is contained in:
3
node_modules/cli-width/.github/FUNDING.yml
generated
vendored
Normal file
3
node_modules/cli-width/.github/FUNDING.yml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: knownasilya
|
||||
31
node_modules/cli-width/.github/workflows/node.js.yml
generated
vendored
Normal file
31
node_modules/cli-width/.github/workflows/node.js.yml
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Node.js CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x, 14.x, 16.x]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
- run: npm ci
|
||||
- run: npm run build --if-present
|
||||
- run: npm test
|
||||
3
node_modules/cli-width/.prettierrc
generated
vendored
Normal file
3
node_modules/cli-width/.prettierrc
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"singleQuote": true
|
||||
}
|
||||
13
node_modules/cli-width/LICENSE
generated
vendored
Normal file
13
node_modules/cli-width/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
Copyright (c) 2015, Ilya Radchenko <knownasilya@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
70
node_modules/cli-width/README.md
generated
vendored
Normal file
70
node_modules/cli-width/README.md
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
# cli-width
|
||||
|
||||
Get stdout window width, with four fallbacks, `tty`, `output.columns`, a custom environment variable and then a default.
|
||||
|
||||
[](http://badge.fury.io/js/cli-width)
|
||||
[](https://travis-ci.org/knownasilya/cli-width)
|
||||
[](https://coveralls.io/github/knownasilya/cli-width?branch=master)
|
||||
|
||||
Tested against NodeJS v10+
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
npm install --save cli-width
|
||||
```
|
||||
|
||||
```js
|
||||
const cliWidth = require('cli-width');
|
||||
|
||||
cliWidth(); // maybe 204 :)
|
||||
```
|
||||
|
||||
You can also set the `CLI_WIDTH` environment variable.
|
||||
|
||||
If none of the methods are supported, and the environment variable isn't set,
|
||||
the default width value is going to be `0`, that can be changed using the configurable `options`.
|
||||
|
||||
## API
|
||||
|
||||
### cliWidth([options])
|
||||
|
||||
`cliWidth` can be configured using an `options` parameter, the possible properties are:
|
||||
|
||||
- **defaultWidth**\<number\> Defines a default value to be used if none of the methods are available, defaults to `0`
|
||||
- **output**\<object\> A stream to be used to read width values from, defaults to `process.stdout`
|
||||
- **tty**\<object\> TTY module to try to read width from as a fallback, defaults to `require('tty')`
|
||||
|
||||
### Examples
|
||||
|
||||
Defining both a default width value and a stream output to try to read from:
|
||||
|
||||
```js
|
||||
const cliWidth = require('cli-width');
|
||||
const ttys = require('ttys');
|
||||
|
||||
cliWidth({
|
||||
defaultWidth: 80,
|
||||
output: ttys.output,
|
||||
});
|
||||
```
|
||||
|
||||
Defines a different tty module to read width from:
|
||||
|
||||
```js
|
||||
const cliWidth = require('cli-width');
|
||||
const ttys = require('ttys');
|
||||
|
||||
cliWidth({
|
||||
tty: ttys,
|
||||
});
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm test
|
||||
```
|
||||
|
||||
Coverage can be generated with `npm run coverage`.
|
||||
49
node_modules/cli-width/index.js
generated
vendored
Normal file
49
node_modules/cli-width/index.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = cliWidth;
|
||||
|
||||
function normalizeOpts(options) {
|
||||
const defaultOpts = {
|
||||
defaultWidth: 0,
|
||||
output: process.stdout,
|
||||
tty: require('tty'),
|
||||
};
|
||||
|
||||
if (!options) {
|
||||
return defaultOpts;
|
||||
}
|
||||
|
||||
Object.keys(defaultOpts).forEach(function (key) {
|
||||
if (!options[key]) {
|
||||
options[key] = defaultOpts[key];
|
||||
}
|
||||
});
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
function cliWidth(options) {
|
||||
const opts = normalizeOpts(options);
|
||||
|
||||
if (opts.output.getWindowSize) {
|
||||
return opts.output.getWindowSize()[0] || opts.defaultWidth;
|
||||
}
|
||||
|
||||
if (opts.tty.getWindowSize) {
|
||||
return opts.tty.getWindowSize()[1] || opts.defaultWidth;
|
||||
}
|
||||
|
||||
if (opts.output.columns) {
|
||||
return opts.output.columns;
|
||||
}
|
||||
|
||||
if (process.env.CLI_WIDTH) {
|
||||
const width = parseInt(process.env.CLI_WIDTH, 10);
|
||||
|
||||
if (!isNaN(width) && width !== 0) {
|
||||
return width;
|
||||
}
|
||||
}
|
||||
|
||||
return opts.defaultWidth;
|
||||
}
|
||||
36
node_modules/cli-width/package.json
generated
vendored
Normal file
36
node_modules/cli-width/package.json
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "cli-width",
|
||||
"version": "4.0.0",
|
||||
"description": "Get stdout window width, with two fallbacks, tty and then a default.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node test | tspec",
|
||||
"coverage": "nyc node test | tspec",
|
||||
"coveralls": "npm run coverage -s && coveralls < coverage/lcov.info",
|
||||
"release": "standard-version"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:knownasilya/cli-width.git"
|
||||
},
|
||||
"author": "Ilya Radchenko <knownasilya@gmail.com>",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/knownasilya/cli-width/issues"
|
||||
},
|
||||
"homepage": "https://github.com/knownasilya/cli-width",
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^3.1.1",
|
||||
"nyc": "^15.1.0",
|
||||
"standard-version": "^9.3.2",
|
||||
"tap-spec": "^5.0.0",
|
||||
"tape": "^5.5.2"
|
||||
},
|
||||
"volta": {
|
||||
"node": "12.22.11",
|
||||
"npm": "8.5.5"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user