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: sindresorhus/boxen
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 52c8544cf284e254d9e4362f8b910c5b6f8cfcb8
Choose a base ref
...
head repository: sindresorhus/boxen
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d839e71db74f471d61b888cff8c487d9aff07622
Choose a head ref

Commits on Jun 7, 2016

  1. add align option (#11)

    nexdrew authored and sindresorhus committed Jun 7, 2016
    Copy the full SHA
    728e182 View commit details
  2. 0.6.0

    sindresorhus committed Jun 7, 2016
    Copy the full SHA
    b40d45a View commit details

Commits on Jun 16, 2016

  1. fix XO lint issue

    sindresorhus committed Jun 16, 2016
    Copy the full SHA
    1b6f02f View commit details

Commits on Sep 6, 2016

  1. Add float option (#12)

    aichholzer authored and sindresorhus committed Sep 6, 2016
    Copy the full SHA
    cb0daf4 View commit details
  2. 0.7.0

    sindresorhus committed Sep 6, 2016
    Copy the full SHA
    87367b0 View commit details
  3. 3
    Copy the full SHA
    d7a92e3 View commit details
  4. 0.8.0

    sindresorhus committed Sep 6, 2016
    Copy the full SHA
    ca284b3 View commit details

Commits on Sep 9, 2016

  1. Copy the full SHA
    010f02e View commit details

Commits on Sep 10, 2016

  1. Copy the full SHA
    ccac328 View commit details
  2. Copy the full SHA
    9edae05 View commit details
  3. 0.8.1

    sindresorhus committed Sep 10, 2016
    Copy the full SHA
    b2378fa View commit details

Commits on Jan 13, 2017

  1. Bump dependencies

    sindresorhus committed Jan 13, 2017
    Copy the full SHA
    fc205a4 View commit details
  2. 1.0.0

    sindresorhus committed Jan 13, 2017
    Copy the full SHA
    e73c06d View commit details

Commits on May 2, 2017

  1. Copy the full SHA
    fb47a16 View commit details
  2. Copy the full SHA
    422d4b1 View commit details

Commits on May 5, 2017

  1. 1.1.0

    sindresorhus committed May 5, 2017
    Copy the full SHA
    61a6375 View commit details

Commits on Jul 12, 2017

  1. Update chalk to 2.0.1 (#26)

    develar authored and sindresorhus committed Jul 12, 2017
    Copy the full SHA
    44d8487 View commit details
  2. Update termsize to 1.2.0 (#25)

    To avoid obsolete execa dependency.
    develar authored and sindresorhus committed Jul 12, 2017
    Copy the full SHA
    16958bb View commit details
  3. Meta tweaks

    sindresorhus committed Jul 12, 2017
    Copy the full SHA
    0b23e34 View commit details
  4. 1.2.0

    sindresorhus committed Jul 12, 2017
    Copy the full SHA
    6b55cd2 View commit details

Commits on Jul 23, 2017

  1. Copy the full SHA
    4f1bf89 View commit details
  2. 1.2.1

    sindresorhus committed Jul 23, 2017
    Copy the full SHA
    f8bcc51 View commit details

Commits on Oct 17, 2017

  1. Prevent padding error for center alignment (#28)

    * Prevent padding error for center alignment
    
    * Fix indentation & failing tests
    
    * Add padWidth check for right alignment as well.
    
    * Change fix for center align to match existing code for right align
    
    * Add tests for float:center and content > columns
    simonua authored and marcjansen committed Oct 17, 2017
    Copy the full SHA
    34ce0ce View commit details
  2. 1.2.2

    sindresorhus committed Oct 17, 2017
    Copy the full SHA
    b874bbb View commit details

Commits on Dec 1, 2017

  1. Copy the full SHA
    84b1d59 View commit details
  2. 1.3.0

    sindresorhus committed Dec 1, 2017
    Copy the full SHA
    f968a18 View commit details

Commits on Apr 2, 2018

  1. Meta tweaks

    sindresorhus committed Apr 2, 2018
    Copy the full SHA
    9026b1e View commit details

Commits on Sep 10, 2018

  1. Copy the full SHA
    dbaf2a9 View commit details
  2. Require Node.js 6

    sindresorhus committed Sep 10, 2018
    Copy the full SHA
    7b20756 View commit details
  3. 2.0.0

    sindresorhus committed Sep 10, 2018
    Copy the full SHA
    7e31c3c View commit details

Commits on Dec 18, 2018

  1. Update dependencies (#37)

    nexdrew authored and sindresorhus committed Dec 18, 2018
    Copy the full SHA
    d7e0350 View commit details
  2. 2.1.0

    sindresorhus committed Dec 18, 2018
    Copy the full SHA
    ae48864 View commit details

Commits on Feb 19, 2019

  1. Add TypeScript definition (#39)

    Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
    MrTarantula and sindresorhus committed Feb 19, 2019
    Copy the full SHA
    dd85217 View commit details
  2. Meta tweaks

    sindresorhus committed Feb 19, 2019
    Copy the full SHA
    60d37a8 View commit details
  3. 3.0.0

    sindresorhus committed Feb 19, 2019
    Copy the full SHA
    7fd83f0 View commit details

Commits on Apr 6, 2019

  1. Copy the full SHA
    cb77ed1 View commit details
  2. 3.1.0

    sindresorhus committed Apr 6, 2019
    Copy the full SHA
    d566dd4 View commit details

Commits on Apr 26, 2019

  1. Add Node.js 12 to testing (#41)

    coreyfarrell authored and sindresorhus committed Apr 26, 2019
    Copy the full SHA
    fad8517 View commit details

Commits on Apr 30, 2019

  1. Add bold border style

    sindresorhus committed Apr 30, 2019
    Copy the full SHA
    c009431 View commit details
  2. 3.2.0

    sindresorhus committed Apr 30, 2019
    Copy the full SHA
    d58a3f0 View commit details

Commits on May 23, 2019

  1. Copy the full SHA
    3dc6e48 View commit details

Commits on May 29, 2019

  1. Copy the full SHA
    2e99867 View commit details
  2. 4.0.0

    sindresorhus committed May 29, 2019
    Copy the full SHA
    4c4d452 View commit details

Commits on May 31, 2019

  1. Tidelift tasks

    sindresorhus committed May 31, 2019
    Copy the full SHA
    5fc95ec View commit details

Commits on Jun 11, 2019

  1. Update dependencies

    sindresorhus committed Jun 11, 2019
    Copy the full SHA
    53ebdc1 View commit details
  2. 4.1.0

    sindresorhus committed Jun 11, 2019
    Copy the full SHA
    d839e71 View commit details
Showing with 638 additions and 188 deletions.
  1. +1 −1 .editorconfig
  2. +1 −1 .gitattributes
  3. +4 −0 .github/funding.yml
  4. +3 −0 .github/security.md
  5. +2 −0 .gitignore
  6. +1 −0 .npmrc
  7. +3 −4 .travis.yml
  8. +17 −2 example.js
  9. +175 −0 index.d.ts
  10. +76 −67 index.js
  11. +34 −0 index.test-d.ts
  12. +4 −16 license
  13. +48 −45 package.json
  14. +53 −20 readme.md
  15. BIN screenshot.png
  16. +216 −32 test.js
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -7,6 +7,6 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{package.json,*.yml}]
[*.yml]
indent_style = space
indent_size = 2
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* text=auto
* text=auto eol=lf
4 changes: 4 additions & 0 deletions .github/funding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
github: sindresorhus
open_collective: sindresorhus
tidelift: npm/boxen
custom: https://sindresorhus.com/donate
3 changes: 3 additions & 0 deletions .github/security.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Security Policy

To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
yarn.lock
.nyc_output
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: node_js
node_js:
- '5'
- '4'
- '0.12'
- '0.10'
- '12'
- '10'
- '8'
19 changes: 17 additions & 2 deletions example.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
var chalk = require('chalk');
var boxen = require('./');
const chalk = require('chalk');
const boxen = require('.');

console.log('\n\n' + boxen(chalk.blue.bold('unicorn'), {
padding: 1,
@@ -15,6 +15,21 @@ console.log('\n\n' + boxen(chalk.blue.bold('unicorn'), {
borderStyle: 'double'
}) + '\n');

console.log('\n\n' + boxen(chalk.blue.bold('unicorn'), {
padding: 1,
margin: 1,
borderColor: '#eebbaa',
borderStyle: 'double'
}) + '\n');

console.log('\n\n' + boxen(chalk.blue.bold('unicorn'), {
padding: 1,
margin: 1,
borderColor: '#ffc0cb',
backgroundColor: '#00ffff',
borderStyle: 'double'
}) + '\n');

console.log('\n\n' + boxen(chalk.blue.bold('unicorn'), {
padding: 1,
margin: 1,
175 changes: 175 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
import {LiteralUnion} from 'type-fest';
import cliBoxes, {BoxStyle} from 'cli-boxes';

declare namespace boxen {
/**
Characters used for custom border.
@example
```
// affffb
// e e
// dffffc
const border: CustomBorderStyle = {
topLeft: 'a',
topRight: 'b',
bottomRight: 'c',
bottomLeft: 'd',
vertical: 'e',
horizontal: 'f'
};
```
*/
interface CustomBorderStyle extends BoxStyle {}

/**
Spacing used for `padding` and `margin`.
*/
interface Spacing {
readonly top: number;
readonly right: number;
readonly bottom: number;
readonly left: number;
}

interface Options {
/**
Color of the box border.
*/
readonly borderColor?: LiteralUnion<
| 'black'
| 'red'
| 'green'
| 'yellow'
| 'blue'
| 'magenta'
| 'cyan'
| 'white'
| 'gray'
| 'grey'
| 'blackBright'
| 'redBright'
| 'greenBright'
| 'yellowBright'
| 'blueBright'
| 'magentaBright'
| 'cyanBright'
| 'whiteBright',
string
>;

/**
Style of the box border.
@default BorderStyle.Single
*/
readonly borderStyle?: BorderStyle | CustomBorderStyle;

/**
Reduce opacity of the border.
@default false
*/
readonly dimBorder?: boolean;

/**
Space between the text and box border.
@default 0
*/
readonly padding?: number | Spacing;

/**
Space around the box.
@default 0
*/
readonly margin?: number | Spacing;

/**
Float the box on the available terminal screen space.
@default 'left'
*/
readonly float?: 'left' | 'right' | 'center';

/**
Color of the background.
*/
readonly backgroundColor?: LiteralUnion<
| 'black'
| 'red'
| 'green'
| 'yellow'
| 'blue'
| 'magenta'
| 'cyan'
| 'white'
| 'blackBright'
| 'redBright'
| 'greenBright'
| 'yellowBright'
| 'blueBright'
| 'magentaBright'
| 'cyanBright'
| 'whiteBright',
string
>;

/**
Align the text in the box based on the widest line.
@default 'left'
*/
readonly align?: 'left' | 'right' | 'center';
}
}

declare const enum BorderStyle {
Single = 'single',
Double = 'double',
Round = 'round',
Bold = 'bold',
SingleDouble = 'singleDouble',
DoubleSingle = 'doubleSingle',
Classic = 'classic'
}

declare const boxen: {
/**
Creates a box in the terminal.
@param text - The text inside the box.
@returns The box.
@example
```
import boxen = require('boxen');
console.log(boxen('unicorn', {padding: 1}));
// ┌─────────────┐
// │ │
// │ unicorn │
// │ │
// └─────────────┘
console.log(boxen('unicorn', {padding: 1, margin: 1, borderStyle: 'double'}));
//
// ╔═════════════╗
// ║ ║
// ║ unicorn ║
// ║ ║
// ╚═════════════╝
//
```
*/
(text: string, options?: boxen.Options): string;

/**
Border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-boxes).
*/
BorderStyle: typeof BorderStyle;
};

export = boxen;
Loading