How to use boxen - 10 common examples

To help you get started, we’ve selected a few boxen examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sindresorhus / boxen-cli / cli.js View on Github external
function cleanupBorderStyle(borderStyle) {
	if (!borderStyle) {
		return 'single';
	}

	if (borderStyle in boxen._borderStyles) {
		return borderStyle;
	}

	if (borderStyle.length !== 6) {
		console.error('Specified custom border style is invalid');
		process.exit(1);
	}

	// a string of 6 characters was given, make it a borderStyle object
	return {
		topLeft: borderStyle[0],
		topRight: borderStyle[1],
		bottomLeft: borderStyle[2],
		bottomRight: borderStyle[3],
		horizontal: borderStyle[4],
		vertical: borderStyle[5]
github ayakashi-io / ayakashi / src / opLog / opLog.ts View on Github external
messageBox: function(logs: string[], opts?: {color?: string, margin?: number}) {
            if (env === "test") return;
            process.stdout.write(boxen(
                logs.reduce((msg, log) => msg + log + "\n", ""),
                {
                    borderColor: (opts && opts.color) || "cyan",
                    align: "center",
                    padding: 1,
                    borderStyle: boxen.BorderStyle.Double,
                    margin: (opts && opts.margin) || 0
                    // float: "center"
                }
            ) + "\n");
        },
        incrementalMessageBox: function(
github kreuzerk / node-command-line-starter / src / waiter.ts View on Github external
export function placeOrder(food, drink) {
    const foodOrder = `${(chalk as any).green(
        'You ordered the following food: '
    )} ${(chalk as any).blue.bold(food)} \n`;
    const drinkOrder = `${(chalk as any).green(
        'You ordered the following drink: '
    )} ${(chalk as any).blue.bold(drink)}`;

    const order = `${orderTitle} ${boxen(foodOrder + drinkOrder, {
        padding: 1,
        margin: 1,
        borderStyle: 'round'
    })}`;

    console.log(order);
}
github patternplate / patternplate / packages / server / source / application / tasks / build-bundles / index.js View on Github external
messages.forEach(message => {
    console.log(boxen(message, { borderColor: "yellow", padding: 1 }));
  });
};
github zodern / meteor-up / src / updates.js View on Github external
remote[2] === local[2];
      }

      if (beta && !available) {
        available = next[3] > local[3];
        showStable = false;
      }

      if (available) {
        const version = showStable ? npmVersion : nextVersion;
        const command = showStable ? 'npm i -g mup' : 'npm i -g mup@next';

        let text = `update available ${pkg.version} => ${version}`;
        text += `\nTo update, run ${chalk.green(command)}`;
        console.log(
          boxen(text, {
            padding: 1,
            margin: 1,
            align: 'center',
            borderColor: 'yellow'
          })
        );
      }

      resolve();
    });
  });
github FujitsuLaboratories / escapin / src / cli.ts View on Github external
function main() {
  const latestVersion = getLatestVersion('escapin');
  if (pkg.version !== latestVersion) {
    const message = boxen(
      `Update available
Current: ${chalk.dim(pkg.version)}
Latest:  ${chalk.green(latestVersion)}`,
      {
        padding: 1,
        margin: 1,
        align: 'center',
      },
    );
    console.error(message);
  }

  program.version(pkg.version);

  program
    .description('Transpile source code')
github kefranabg / readme-md-generator / src / utils.spec.js View on Github external
describe('showEndMessage', () => {
    boxen.mockReturnValue(END_MSG)

    it('should call boxen with correct parameters', () => {
      showEndMessage()

      expect(boxen).toHaveBeenCalledTimes(1)
      expect(boxen).toHaveBeenCalledWith(END_MSG, BOXEN_CONFIG)
    })

    it('should call process.stdout.write with correct parameters', () => {
      process.stdout.write = jest.fn()

      showEndMessage()

      expect(process.stdout.write).toHaveBeenCalledTimes(1)
      expect(process.stdout.write).toHaveBeenCalledWith(END_MSG)
    })
github nuxt / nuxt.js / packages / cli / src / utils / formatting.js View on Github external
export function box (message, title, options) {
  return boxen([
    title || chalk.white('Nuxt Message'),
    '',
    chalk.white(foldLines(message, 0, 0, maxCharsPerLine()))
  ].join('\n'), Object.assign({
    borderColor: 'white',
    borderStyle: 'round',
    padding: 1,
    margin: 1
  }, options)) + '\n'
}
github expo / expo-cli / packages / xdl / src / createWebpackCompiler.ts View on Github external
export function printPreviewNotice(projectRoot: string, showInDevtools: boolean) {
  log(
    projectRoot,
    boxen(
      chalk.yellow(
        'Web support in Expo is experimental and subject to breaking changes.\n' +
          'Do not use this in production yet.'
      ),
      { borderColor: 'yellow', padding: 1 }
    ),
    showInDevtools
  );
}
github Oluwasegun-AA / md-generator / src / common / alerts.ts View on Github external
const useBox: any = (text: string): void  => {
  log(boxen(text, BOX_CONFIG));
};

boxen

Create boxes in the terminal

MIT
Latest version published 3 months ago

Package Health Score

82 / 100
Full package analysis