fix(npm): Updated package description and added more keywords for better visibility

This commit is contained in:
Philipp Kunz 2025-01-14 17:42:37 +01:00
parent 947bd03223
commit 4442ef368c
6 changed files with 59 additions and 53 deletions

View File

@ -1,5 +1,9 @@
# Changelog
## 2025-01-14 - 1.0.9 - fix(npm)
Updated package description and added more keywords for better visibility
## 2025-01-14 - 1.0.8 - fix(documentation)
Update README to reflect recent changes

View File

@ -10,20 +10,22 @@
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "beautyfiglet",
"description": "A Node.js module that facilitates the creation of ASCII art using figlet with customizable fonts and layouts.",
"description": "A Node.js module for creating customizable ASCII art using figlet with options for different fonts and layouts.",
"npmPackagename": "@push.rocks/beautyfiglet",
"license": "MIT",
"keywords": [
"ASCII art",
"figlet",
"text rendering",
"font customization",
"Node.js module",
"typescript",
"font customization",
"command-line interface",
"error handling",
"web integration",
"npm package"
"npm package",
"testing",
"synchronous rendering"
]
}
},

View File

@ -1,7 +1,7 @@
{
"name": "@push.rocks/beautyfiglet",
"version": "1.0.8",
"description": "A Node.js module that facilitates the creation of ASCII art using figlet with customizable fonts and layouts.",
"description": "A Node.js module for creating customizable ASCII art using figlet with options for different fonts and layouts.",
"exports": {
".": "./dist_ts/index.js"
},
@ -25,13 +25,15 @@
"ASCII art",
"figlet",
"text rendering",
"font customization",
"Node.js module",
"typescript",
"font customization",
"command-line interface",
"error handling",
"web integration",
"npm package"
"npm package",
"testing",
"synchronous rendering"
],
"devDependencies": {
"@git.zone/tsbuild": "^2.2.0",
@ -40,4 +42,4 @@
"@git.zone/tstest": "^1.0.90",
"@push.rocks/tapbundle": "^5.5.4"
}
}
}

View File

@ -1 +0,0 @@

View File

@ -1,20 +1,20 @@
# @push.rocks/beautyfiglet
A Node.js module for creating figlet text displays.
A Node.js module that facilitates the creation of ASCII art using figlet with customizable fonts and layouts.
## Install
To install `@push.rocks/beautyfiglet`, you should have Node.js and npm installed on your machine. Once you have these prerequisites, you can install the package via npm by running the following command in your terminal:
To install `@push.rocks/beautyfiglet`, ensure you have Node.js along with npm set up on your machine. Executing the following command in your terminal will install this module via npm:
```sh
npm install @push.rocks/beautyfiglet
```
Alternatively, you can include it as a dependency in your `package.json` file:
Alternatively, you can add it as a dependency in your `package.json`:
```json
{
"dependencies": {
"@push.rocks/beautyfiglet": "^1.0.7"
"@push.rocks/beautyfiglet": "^1.0.8"
}
}
```
@ -27,56 +27,55 @@ npm install
## Usage
`@push.rocks/beautyfiglet` is a versatile Node.js module that lets you generate figlet-style ASCII art easily. Below, we will explore its functionalities with detailed examples, encompassing various scenarios to showcase how you can leverage this module in your projects.
`@push.rocks/beautyfiglet` is a comprehensive Node.js package that empowers developers to generate visually engaging figlet-style ASCII art. This section will delve into detailed use-case scenarios, ensuring you have a robust understanding of how to integrate and utilize this module effectively within your projects.
### Basic Initialization
### Getting Started
Begin by importing the `BeautyFiglet` class into your TypeScript file. You can access its methods to create ASCII art from text strings.
To begin using `@push.rocks/beautyfiglet`, import the `BeautyFiglet` class in your TypeScript file. This class serves as the gateway to generating your ASCII art.
```typescript
import { BeautyFiglet } from '@push.rocks/beautyfiglet';
// A simple demonstration of using the standard export
console.log('Welcome to BeautyFiglet!'); // Outputs: Welcome to BeautyFiglet!
```
### Rendering Text with Figlet
Figlet is immensely popular for turning strings into ASCII banners. The following code illustrates how to convert text into a figlet display using `BeautyFiglet`.
The quintessential feature of this module is its ability to convert plain text into ASCII art using popular figlet formats. Below is an example of how to achieve this with `renderDefault`.
```typescript
(async () => {
const figletText = await BeautyFiglet.renderDefault('Hello, World!');
console.log(figletText);
console.log(figletText); // Displays "Hello, World!" in ASCII format using the default font.
})();
```
### Customizing Font
### Custom Font Selection
`BeautyFiglet` not only supports different versions of text layouts, but it also allows you to specify fonts, making your output unique.
One of the striking features of `BeautyFiglet` is the ability to select from a variety of fonts. This allows for a unique representation of your text.
```typescript
(async () => {
const customFiglet = await BeautyFiglet.renderText('Beautiful Text', 'Ghost');
console.log(customFiglet);
console.log(customFiglet); // Renders the text "Beautiful Text" with the Ghost style.
})();
```
### Fetching Available Fonts
### Exploring Available Fonts
Understanding what fonts are available can help in making aesthetic decisions for your text.
Knowing which fonts you can work with enhances your creative freedom. By listing available fonts, you can make informed choices.
```typescript
(async () => {
const fontsList = await BeautyFiglet.listFonts();
console.log('Available Fonts:');
console.log(fontsList.join(', '));
console.log(fontsList.join(', ')); // Lists all fonts available for use in figlet.
})();
```
### Using Custom Layouts
### Custom Text Layouts
In addition to fonts, the layout of the text can be altered. You can specify both horizontal and vertical layouts.
Layouts, which refer to the arrangement of text, can be customized. Modify the horizontal and vertical layouts for dynamic artistry.
```typescript
import figlet from 'figlet';
@ -90,11 +89,11 @@ const renderCustomLayout = (text: string, font: string, hLayout: string, vLayout
});
};
// Example usage
// Application Example
(async () => {
try {
const customLayoutText = await renderCustomLayout('Creative Layout', 'Ghost', 'full', 'full');
console.log(customLayoutText);
console.log(customLayoutText); // Renders with specified layout adjustments.
} catch (error) {
console.error(error);
}
@ -103,7 +102,7 @@ const renderCustomLayout = (text: string, font: string, hLayout: string, vLayout
### Synchronous Text Rendering
For situations requiring synchronous execution such as small scripts and testing scenarios, `textSync` comes in handy.
For scenarios demanding immediate rendering results, such as testing or small scripts, `textSync` is a beneficial synchronous method.
```typescript
import { figlet } from '@push.rocks/beautyfiglet.plugins';
@ -114,12 +113,12 @@ const artwork = figlet.textSync('Synchronicity!', {
verticalLayout: 'default'
});
console.log(artwork);
console.log(artwork); // Output is rendered immediately without asynchronous behavior.
```
### Enhancing Output with Color
### Adding Color to the Output
To add more flair to your text displays, consider integrating popular color-coordinating libraries like `chalk`.
To create more vibrant and visually appealing text displays, utilize libraries such as `chalk` to incorporate colors.
```typescript
import figlet from 'figlet';
@ -127,13 +126,13 @@ import chalk from 'chalk';
(async () => {
const colorizedText = await BeautyFiglet.renderText('Color Me Beautiful', 'Standard');
console.log(chalk.magentaBright(colorizedText));
console.log(chalk.magentaBright(colorizedText)); // Renders ASCII art in bright magenta.
})();
```
### Robust Error Handling
Error handling is paramount in any application. This becomes even more pronounced when fonts or integrations might fail.
Effectively managing potential errors (e.g., when a specified font is unavailable) is essential to prevent application crashes.
```typescript
(async () => {
@ -141,14 +140,14 @@ Error handling is paramount in any application. This becomes even more pronounce
const result = await BeautyFiglet.renderText('Error Test', 'NonExistentFont');
console.log(result);
} catch (error) {
console.error(`Caught an error: ${error}`);
console.error(`Caught an error: ${error}`); // Captures and logs errors without halting the program.
}
})();
```
### Web Server Integration
The module can effectively serve dynamically generated ASCII text over HTTP. Here's a simple example using Express:
The functionality of this module can be extended to serve ASCII art over HTTP, allowing integration with web services. Heres a demonstration using Express.
```typescript
import express from 'express';
@ -161,9 +160,9 @@ app.get('/api/art/:text', async (req, res) => {
try {
const asciiArt = await BeautyFiglet.renderDefault(textToRender);
res.send(`<pre>${asciiArt}</pre>`);
res.send(`<pre>${asciiArt}</pre>`); // Sends the rendered ASCII art in a preformatted text block over HTTP.
} catch (error) {
res.status(500).send(`Error: ${error.message}`);
res.status(500).send(`Error: ${error.message}`); // Manages errors with a 500 Internal Server Error status code.
}
});
@ -174,7 +173,7 @@ app.listen(4000, () => {
### Command-Line Interface (CLI)
Expand the utility of `BeautyFiglet` by creating a CLI tool for generating ASCII art directly from the command line.
Creating a CLI tool enhances accessibility, allowing direct ASCII art generation from the terminal. Here's a demonstration:
```typescript
#!/usr/bin/env node
@ -182,7 +181,7 @@ import { BeautyFiglet } from '@push.rocks/beautyfiglet';
import { Command } from 'commander';
const program = new Command();
program.version('1.0.7');
program.version('1.0.8');
program
.option('-t, --text <text>', 'Text to render')
@ -190,45 +189,45 @@ program
.action(async (cmd) => {
try {
const asciiArt = await BeautyFiglet.renderText(cmd.text, cmd.font);
console.log(asciiArt);
console.log(asciiArt); // Renders text directly in CLI using specified options.
} catch (error) {
console.error(`Error: ${error}`);
console.error(`Error: ${error.message}`);
}
});
program.parse(process.argv);
```
Running this tool involves these steps:
**CLI Tool Usage:**
1. Save the script as `beautyfiglet-cli.ts`.
2. Ensure it is marked as executable:
2. Make it executable:
```sh
chmod +x ./beautyfiglet-cli.ts
```
3. Link via npm:
3. Establish a link via npm:
```sh
npm link
```
4. Execute with:
4. Run the command using:
```sh
beautyfiglet-cli --text "Hello World" --font "Ghost"
```
This command-line example showcases flexibility and enhanced usability for developers integrating the module seamlessly into their workflow.
This CLI approach demonstrates seamless integration into development workflows, adding simplicity and efficiency for users.
### Summary of Best Practices
### Comprehensive Summary
The extensive usage of `@push.rocks/beautyfiglet` demonstrates the importance of proper setup and thorough understanding of available options. From simple implementations to elaborate, colorful arrangements, this module empowers developers to unleash creativity with text in aesthetic and programmable ways.
Throughout this comprehensive guide, we have demonstrated the varied and extensive capabilities of the `@push.rocks/beautyfiglet` module. From initializing the module and employing basic rendering to exploring intricate font customization, layout configurations, and error handling, the guide has covered an exhaustive list of functionalities available within this versatile module.
Delve deeper into font choices and optional configurations to fully capitalize on this versatile tool for crafting meaningful ASCII text displays, all the while ensuring continuous learning of new patterns and module updates. With vigilant error management and the integration of expressive styles, your applications can achieve a blend of functionality and flair unmatched by basic textual representation.
Developers are encouraged to delve deeper into exploring font selections and engaging with additional configuration settings to thoroughly harness the potential of this tool. By integrating colorful text arrangements and utilizing robust error management, applications can balance both aesthetic appeal and operational reliability.
This concludes the elaborate coverage of the `@push.rocks/beautyfiglet` module and its extensive capabilities within Node.js projects.
This expansive exploration into the `@push.rocks/beautyfiglet` module underscores the creativity and potential this tool offers for implementing ASCII art in your Node.js projects.
## License and Legal Information

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/beautyfiglet',
version: '1.0.8',
description: 'A Node.js module that facilitates the creation of ASCII art using figlet with customizable fonts and layouts.'
version: '1.0.9',
description: 'A Node.js module for creating customizable ASCII art using figlet with options for different fonts and layouts.'
}