ASCII art speech bubbles with Yeoman mascot character for command-line interfaces
npx @tessl/cli install tessl/npm-yosay@3.0.0Yosay creates ASCII art speech bubbles with the Yeoman mascot character for command-line interfaces. Like cowsay but less cow, it provides a JavaScript API and CLI tool for displaying messages in a distinctive, branded format that has become iconic in the JavaScript development ecosystem.
npm install yosayimport yosay from "yosay";For global CLI installation:
npm install --global yosayimport yosay from "yosay";
// Simple message
console.log(yosay('Hello, world!'));
// With custom line length
console.log(yosay('Hello, world!', { maxLength: 10 }));
// With ANSI styling (using chalk)
import chalk from 'chalk';
console.log(yosay(chalk.red('Error: ') + 'Something went wrong!'));# Basic usage
$ yosay "Hello, world!"
# With custom line length
$ yosay "Hello, world!" --maxLength 10
# From stdin
$ echo "Hello, world!" | yosayCreates ASCII art speech bubbles with the Yeoman mascot character.
/**
* Creates ASCII art speech bubbles with Yeoman mascot character
* @param message - Text to display in speech bubble (optional, defaults to welcome message)
* @param options - Configuration options (optional)
* @returns String containing ASCII art with Yeoman character and formatted speech bubble
*/
function yosay(message?: string, options?: YosayOptions): string;
interface YosayOptions {
/** Maximum line length for word wrapping */
maxLength?: number;
}Features:
Usage Examples:
import yosay from "yosay";
import chalk from "chalk";
// Default message
console.log(yosay());
// Displays: "Welcome to Yeoman, ladies and gentlemen!"
// Custom message
console.log(yosay('Sindre is a horse'));
// With line length customization
console.log(yosay('This is a long message that will wrap', { maxLength: 8 }));
// With ANSI styling
console.log(yosay(chalk.red('Error: ') + chalk.yellow('Build failed!')));
// Mixed styling across multiple lines
console.log(yosay(
chalk.red('Hi') + ' there, sir! ' +
chalk.bgBlue.white('you are looking') + ' swell today!'
));
// Handling newlines
console.log(yosay('first line\nsecond line\n\nfourth line'));
// Fullwidth characters
console.log(yosay('项目可以更新了'));Command-line interface for yosay functionality.
# Usage patterns
yosay <string>
yosay <string> --maxLength <number>
echo <string> | yosay
# Options
--maxLength Set maximum line length for word wrappingCLI Examples:
# Basic message
$ yosay 'Sindre is a horse'
# Custom line length
$ yosay 'Hello world' --maxLength 8
# From stdin
$ echo 'Hello from pipe' | yosay
# Help
$ yosay --helpYosay is built around several key components:
interface YosayOptions {
/**
* Maximum line length for word wrapping
* If provided but smaller than the longest word, automatically adjusts to fit
*/
maxLength?: number;
}The function handles various edge cases gracefully: