Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
7ea4324ff8 | |||
4442ef368c | |||
947bd03223 | |||
95e6295feb | |||
e294710a0f | |||
81228d1972 | |||
e40c6bb713 | |||
135a9bcf08 | |||
6b8d951024 | |||
75f8877356 | |||
fde3000555 | |||
f065ef0e94 | |||
656f5b7dfb | |||
557c7b2ac5 | |||
233e07040e | |||
edf0f69e99 | |||
007bb2029d |
18
.gitignore
vendored
18
.gitignore
vendored
@ -1,5 +1,19 @@
|
||||
.nogit/
|
||||
node_modules/
|
||||
|
||||
# artifacts
|
||||
coverage/
|
||||
public/
|
||||
pages/
|
||||
|
||||
# installs
|
||||
node_modules/
|
||||
|
||||
# caches
|
||||
.yarn/
|
||||
.cache/
|
||||
.rpt2_cache
|
||||
|
||||
# builds
|
||||
dist/
|
||||
dist_*/
|
||||
|
||||
#------# custom
|
@ -1,96 +0,0 @@
|
||||
# gitzone standard
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .yarn/
|
||||
key: "$CI_BUILD_STAGE"
|
||||
|
||||
stages:
|
||||
- mirror
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- trigger
|
||||
- pages
|
||||
|
||||
mirror:
|
||||
stage: mirror
|
||||
script:
|
||||
- npmci git mirror
|
||||
tags:
|
||||
- docker
|
||||
|
||||
security:
|
||||
stage: security
|
||||
script:
|
||||
- npmci command yarn global add snyk
|
||||
- npmci command yarn install --ignore-scripts
|
||||
- npmci command snyk test
|
||||
tags:
|
||||
- docker
|
||||
|
||||
testLEGACY:
|
||||
stage: test
|
||||
script:
|
||||
- npmci node install legacy
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
testLTS:
|
||||
stage: test
|
||||
script:
|
||||
- npmci node install lts
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
|
||||
testSTABLE:
|
||||
stage: test
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
|
||||
trigger:
|
||||
stage: trigger
|
||||
script:
|
||||
- npmci trigger
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
|
||||
pages:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: pages
|
||||
script:
|
||||
- npmci command yarn global add npmpage
|
||||
- npmci command npmpage
|
||||
tags:
|
||||
- docker
|
||||
only:
|
||||
- tags
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- public
|
54
changelog.md
Normal file
54
changelog.md
Normal file
@ -0,0 +1,54 @@
|
||||
# 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
|
||||
|
||||
- Updated package description for accuracy.
|
||||
- Adjusted installation instructions for clarity.
|
||||
- Added a new command-line interface example.
|
||||
- Enhanced section on error handling with illustrative examples.
|
||||
- Simplified integration guidelines with web servers using Express.
|
||||
|
||||
## 2025-01-14 - 1.0.7 - fix(core)
|
||||
Improve error messages in renderText and listFonts methods
|
||||
|
||||
- Improved error handling in renderText and listFonts methods
|
||||
- Ensure proper rejection messages during errors
|
||||
|
||||
## 2025-01-14 - 1.0.6 - fix(core)
|
||||
Update .gitignore to improve ignored paths
|
||||
|
||||
- Ignored various build and cache directories to reduce clutter in the repository.
|
||||
- Refactored .gitignore to categorize ignored paths for better readability and maintenance.
|
||||
|
||||
## 2025-01-14 - 1.0.5 - fix(package)
|
||||
Fix scripts section in package.json by adding missing comma
|
||||
|
||||
- Corrected the JSON format in the scripts section by adding a missing comma between format and build scripts.
|
||||
|
||||
## 2025-01-14 - 1.0.4 - fix(core)
|
||||
Removed unnecessary files and updated dependencies
|
||||
|
||||
- Removed .gitlab-ci.yml to streamline the CI/CD process
|
||||
- Updated and fixed TypeScript files to align with ES Module syntax
|
||||
- Removed obsolete dist files for a cleaner build
|
||||
- Updated package.json to reflect current project configurations, including dependencies and scripts
|
||||
|
||||
## 2024-05-29 - 1.0.3 - Enhancements
|
||||
Finalizing updates under version 1.0.3
|
||||
|
||||
- Updated project description
|
||||
|
||||
## 2023-07-10 to 2024-05-29 - 1.0.3 - Organizational Changes
|
||||
Implemented significant organizational changes
|
||||
|
||||
- Switched to a new organizational scheme
|
||||
|
||||
## 2018-03-05 - 1.0.2 to 1.0.3 - Maintenance and Format Updates
|
||||
Streamlined maintenance and formatting
|
||||
|
||||
- Updated code formatting for consistency
|
2
dist/beautyfiglet.plugins.d.ts
vendored
2
dist/beautyfiglet.plugins.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
declare const removeme: {};
|
||||
export { removeme };
|
5
dist/beautyfiglet.plugins.js
vendored
5
dist/beautyfiglet.plugins.js
vendored
@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const removeme = {};
|
||||
exports.removeme = removeme;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5ZmlnbGV0LnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9iZWF1dHlmaWdsZXQucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLE1BQU0sUUFBUSxHQUFHLEVBQUUsQ0FBQztBQUVsQiw0QkFBUSJ9
|
1
dist/index.d.ts
vendored
1
dist/index.d.ts
vendored
@ -1 +0,0 @@
|
||||
export declare let standardExport: string;
|
4
dist/index.js
vendored
4
dist/index.js
vendored
@ -1,4 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.standardExport = 'Hi there! :) This is an exported string';
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVXLFFBQUEsY0FBYyxHQUFHLHlDQUF5QyxDQUFDIn0=
|
19
license
Normal file
19
license
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2014 Task Venture Capital GmbH (hello@lossless.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -3,5 +3,33 @@
|
||||
"npmGlobalTools": [
|
||||
"npmts"
|
||||
]
|
||||
},
|
||||
"gitzone": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "code.foss.global",
|
||||
"gitscope": "push.rocks",
|
||||
"gitrepo": "beautyfiglet",
|
||||
"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",
|
||||
"command-line interface",
|
||||
"error handling",
|
||||
"web integration",
|
||||
"npm package",
|
||||
"testing",
|
||||
"synchronous rendering"
|
||||
]
|
||||
}
|
||||
},
|
||||
"tsdoc": {
|
||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||
}
|
||||
}
|
50
package.json
50
package.json
@ -1,17 +1,45 @@
|
||||
{
|
||||
"name": "beautyfiglet",
|
||||
"version": "1.0.2",
|
||||
"description": "figlet display in nodejs",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"name": "@push.rocks/beautyfiglet",
|
||||
"version": "1.0.9",
|
||||
"description": "A Node.js module for creating customizable ASCII art using figlet with options for different fonts and layouts.",
|
||||
"exports": {
|
||||
".": "./dist_ts/index.js"
|
||||
},
|
||||
"type": "module",
|
||||
"author": "Lossless GmbH",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "(npmts)",
|
||||
"format": "(gitzone format)"
|
||||
"test": "(tstest test/)",
|
||||
"format": "(gitzone format)",
|
||||
"build": "(tsbuild)"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/figlet": "^1.7.0",
|
||||
"figlet": "^1.8.0"
|
||||
},
|
||||
"homepage": "https://code.foss.global/push.rocks/beautyfiglet",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://code.foss.global/push.rocks/beautyfiglet.git"
|
||||
},
|
||||
"keywords": [
|
||||
"ASCII art",
|
||||
"figlet",
|
||||
"text rendering",
|
||||
"font customization",
|
||||
"Node.js module",
|
||||
"typescript",
|
||||
"command-line interface",
|
||||
"error handling",
|
||||
"web integration",
|
||||
"npm package",
|
||||
"testing",
|
||||
"synchronous rendering"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tapbundle": "^1.0.13"
|
||||
},
|
||||
"dependencies": {}
|
||||
"@git.zone/tsbuild": "^2.2.0",
|
||||
"@git.zone/tsbundle": "^2.1.0",
|
||||
"@git.zone/tsrun": "^1.3.3",
|
||||
"@git.zone/tstest": "^1.0.90",
|
||||
"@push.rocks/tapbundle": "^5.5.4"
|
||||
}
|
||||
}
|
||||
|
9737
pnpm-lock.yaml
generated
Normal file
9737
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
0
readme.hints.md
Normal file
0
readme.hints.md
Normal file
249
readme.md
Normal file
249
readme.md
Normal file
@ -0,0 +1,249 @@
|
||||
# @push.rocks/beautyfiglet
|
||||
A Node.js module that facilitates the creation of ASCII art using figlet with customizable fonts and layouts.
|
||||
|
||||
## Install
|
||||
|
||||
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 add it as a dependency in your `package.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"dependencies": {
|
||||
"@push.rocks/beautyfiglet": "^1.0.8"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then execute:
|
||||
|
||||
```sh
|
||||
npm install
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
`@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.
|
||||
|
||||
### Getting Started
|
||||
|
||||
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';
|
||||
|
||||
console.log('Welcome to BeautyFiglet!'); // Outputs: Welcome to BeautyFiglet!
|
||||
```
|
||||
|
||||
### Rendering Text with Figlet
|
||||
|
||||
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); // Displays "Hello, World!" in ASCII format using the default font.
|
||||
})();
|
||||
```
|
||||
|
||||
### Custom Font Selection
|
||||
|
||||
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); // Renders the text "Beautiful Text" with the Ghost style.
|
||||
})();
|
||||
```
|
||||
|
||||
### Exploring Available Fonts
|
||||
|
||||
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(', ')); // Lists all fonts available for use in figlet.
|
||||
})();
|
||||
```
|
||||
|
||||
### Custom Text 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';
|
||||
|
||||
const renderCustomLayout = (text: string, font: string, hLayout: string, vLayout: string): Promise<string> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
figlet.text(text, { font, horizontalLayout: hLayout, verticalLayout: vLayout }, (err, data) => {
|
||||
if (err) reject(`Error: ${err.message}`);
|
||||
else resolve(data);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Application Example
|
||||
(async () => {
|
||||
try {
|
||||
const customLayoutText = await renderCustomLayout('Creative Layout', 'Ghost', 'full', 'full');
|
||||
console.log(customLayoutText); // Renders with specified layout adjustments.
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
})();
|
||||
```
|
||||
|
||||
### Synchronous Text Rendering
|
||||
|
||||
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';
|
||||
|
||||
const artwork = figlet.textSync('Synchronicity!', {
|
||||
font: 'Standard',
|
||||
horizontalLayout: 'default',
|
||||
verticalLayout: 'default'
|
||||
});
|
||||
|
||||
console.log(artwork); // Output is rendered immediately without asynchronous behavior.
|
||||
```
|
||||
|
||||
### Adding Color to the Output
|
||||
|
||||
To create more vibrant and visually appealing text displays, utilize libraries such as `chalk` to incorporate colors.
|
||||
|
||||
```typescript
|
||||
import figlet from 'figlet';
|
||||
import chalk from 'chalk';
|
||||
|
||||
(async () => {
|
||||
const colorizedText = await BeautyFiglet.renderText('Color Me Beautiful', 'Standard');
|
||||
console.log(chalk.magentaBright(colorizedText)); // Renders ASCII art in bright magenta.
|
||||
})();
|
||||
```
|
||||
|
||||
### Robust Error Handling
|
||||
|
||||
Effectively managing potential errors (e.g., when a specified font is unavailable) is essential to prevent application crashes.
|
||||
|
||||
```typescript
|
||||
(async () => {
|
||||
try {
|
||||
const result = await BeautyFiglet.renderText('Error Test', 'NonExistentFont');
|
||||
console.log(result);
|
||||
} catch (error) {
|
||||
console.error(`Caught an error: ${error}`); // Captures and logs errors without halting the program.
|
||||
}
|
||||
})();
|
||||
```
|
||||
|
||||
### Web Server Integration
|
||||
|
||||
The functionality of this module can be extended to serve ASCII art over HTTP, allowing integration with web services. Here’s a demonstration using Express.
|
||||
|
||||
```typescript
|
||||
import express from 'express';
|
||||
import { BeautyFiglet } from '@push.rocks/beautyfiglet';
|
||||
|
||||
const app = express();
|
||||
|
||||
app.get('/api/art/:text', async (req, res) => {
|
||||
const textToRender = req.params.text;
|
||||
|
||||
try {
|
||||
const asciiArt = await BeautyFiglet.renderDefault(textToRender);
|
||||
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}`); // Manages errors with a 500 Internal Server Error status code.
|
||||
}
|
||||
});
|
||||
|
||||
app.listen(4000, () => {
|
||||
console.log('Server running at http://localhost:4000/');
|
||||
});
|
||||
```
|
||||
|
||||
### Command-Line Interface (CLI)
|
||||
|
||||
Creating a CLI tool enhances accessibility, allowing direct ASCII art generation from the terminal. Here's a demonstration:
|
||||
|
||||
```typescript
|
||||
#!/usr/bin/env node
|
||||
import { BeautyFiglet } from '@push.rocks/beautyfiglet';
|
||||
import { Command } from 'commander';
|
||||
|
||||
const program = new Command();
|
||||
program.version('1.0.8');
|
||||
|
||||
program
|
||||
.option('-t, --text <text>', 'Text to render')
|
||||
.option('-f, --font <font>', 'Font for rendering', 'Standard')
|
||||
.action(async (cmd) => {
|
||||
try {
|
||||
const asciiArt = await BeautyFiglet.renderText(cmd.text, cmd.font);
|
||||
console.log(asciiArt); // Renders text directly in CLI using specified options.
|
||||
} catch (error) {
|
||||
console.error(`Error: ${error.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
```
|
||||
|
||||
**CLI Tool Usage:**
|
||||
|
||||
1. Save the script as `beautyfiglet-cli.ts`.
|
||||
2. Make it executable:
|
||||
|
||||
```sh
|
||||
chmod +x ./beautyfiglet-cli.ts
|
||||
```
|
||||
|
||||
3. Establish a link via npm:
|
||||
|
||||
```sh
|
||||
npm link
|
||||
```
|
||||
|
||||
4. Run the command using:
|
||||
|
||||
```sh
|
||||
beautyfiglet-cli --text "Hello World" --font "Ghost"
|
||||
```
|
||||
|
||||
This CLI approach demonstrates seamless integration into development workflows, adding simplicity and efficiency for users.
|
||||
|
||||
### Comprehensive Summary
|
||||
|
||||
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.
|
||||
|
||||
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 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
|
||||
|
||||
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||
|
||||
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||
|
||||
### Trademarks
|
||||
|
||||
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
||||
|
||||
### Company Information
|
||||
|
||||
Task Venture Capital GmbH
|
||||
Registered at District court Bremen HRB 35230 HB, Germany
|
||||
|
||||
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||
|
||||
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
35
test/test.ts
35
test/test.ts
@ -1,8 +1,31 @@
|
||||
import { expect, tap } from 'tapbundle'
|
||||
import * as beautyfiglet from '../ts/index'
|
||||
import { expect, tap } from '@push.rocks/tapbundle';
|
||||
import * as beautyfiglet from '../ts/index.js';
|
||||
|
||||
tap.test('first test', async () => {
|
||||
console.log(beautyfiglet.standardExport)
|
||||
})
|
||||
let testFiglet: typeof beautyfiglet.BeautyFiglet;
|
||||
|
||||
tap.start()
|
||||
tap.test('setup', async () => {
|
||||
testFiglet = beautyfiglet.BeautyFiglet;
|
||||
expect(testFiglet).toBeTruthy();
|
||||
});
|
||||
|
||||
tap.test('should render text with the default font', async () => {
|
||||
const text = "Hello, World!";
|
||||
const result = await testFiglet.renderDefault(text);
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
tap.test('should render text with a specific font', async () => {
|
||||
const text = "Fancy Text";
|
||||
const font = "Ghost";
|
||||
const result = await testFiglet.renderText(text, font);
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
tap.test('should list available fonts', async () => {
|
||||
const fonts = await testFiglet.listFonts();
|
||||
expect(Array.isArray(fonts)).toBeTrue();
|
||||
expect(fonts.length).toBeGreaterThan(0);
|
||||
expect(fonts).toContain("Standard"); // Ensure "Standard" is in the font list
|
||||
});
|
||||
|
||||
tap.start();
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @push.rocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/beautyfiglet',
|
||||
version: '1.0.9',
|
||||
description: 'A Node.js module for creating customizable ASCII art using figlet with options for different fonts and layouts.'
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
const removeme = {};
|
||||
import figlet, { type Fonts } from 'figlet';
|
||||
|
||||
export {
|
||||
removeme
|
||||
figlet,
|
||||
type Fonts,
|
||||
}
|
47
ts/index.ts
47
ts/index.ts
@ -1,3 +1,46 @@
|
||||
import * as plugins from './beautyfiglet.plugins';
|
||||
import * as plugins from './beautyfiglet.plugins.js';
|
||||
|
||||
export let standardExport = 'Hi there! :) This is an exported string';
|
||||
export class BeautyFiglet {
|
||||
/**
|
||||
* Render text with a specific figlet font.
|
||||
* @param text - The text to render.
|
||||
* @param font - The font to use (optional).
|
||||
* @returns A promise that resolves to the rendered ASCII art.
|
||||
*/
|
||||
static async renderText(text: string, font: plugins.figlet.Fonts = "Standard"): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
plugins.figlet.text(text, { font }, (err, result) => {
|
||||
if (err) {
|
||||
reject(`Error rendering text: ${err.message}`);
|
||||
} else {
|
||||
resolve(result || "");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all available fonts in figlet.
|
||||
* @returns A promise that resolves to an array of font names.
|
||||
*/
|
||||
static async listFonts(): Promise<string[]> {
|
||||
return new Promise((resolve, reject) => {
|
||||
plugins.figlet.fonts((err, fonts) => {
|
||||
if (err) {
|
||||
reject(`Error fetching fonts: ${err.message}`);
|
||||
} else {
|
||||
resolve(fonts || []);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Render text with a default font (Standard).
|
||||
* @param text - The text to render.
|
||||
* @returns A promise that resolves to the rendered ASCII art.
|
||||
*/
|
||||
static async renderDefault(text: string): Promise<string> {
|
||||
return this.renderText(text, "Standard");
|
||||
}
|
||||
}
|
14
tsconfig.json
Normal file
14
tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false,
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true
|
||||
},
|
||||
"exclude": [
|
||||
"dist_*/**/*.d.ts"
|
||||
]
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "tslint-config-standard"
|
||||
}
|
194
yarn.lock
194
yarn.lock
@ -1,194 +0,0 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@types/code@^4.0.3":
|
||||
version "4.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/code/-/code-4.0.4.tgz#527fbdbb487dabc4346b8a2ccca3496d8198bae7"
|
||||
|
||||
"@types/node@^8.0.33":
|
||||
version "8.9.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.9.4.tgz#dfd327582a06c114eb6e0441fa3d6fab35edad48"
|
||||
|
||||
ansi-256-colors@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a"
|
||||
|
||||
beautycolor@^1.0.7:
|
||||
version "1.0.11"
|
||||
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.11.tgz#71c5568d5a7ed5c144d3a54f753ad1b08862aea5"
|
||||
dependencies:
|
||||
ansi-256-colors "^1.1.0"
|
||||
typings-global "^1.0.14"
|
||||
|
||||
bindings@^1.2.1:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7"
|
||||
|
||||
code@^5.1.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/code/-/code-5.2.0.tgz#fb3a5e247afc17e3d65c49e7ce0f69ebe51a75b5"
|
||||
dependencies:
|
||||
hoek "5.x.x"
|
||||
|
||||
define-properties@^1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
|
||||
dependencies:
|
||||
foreach "^2.0.5"
|
||||
object-keys "^1.0.8"
|
||||
|
||||
early@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/early/-/early-2.1.1.tgz#841e23254ea5dc54d8afaeee82f5ab65c00ee23c"
|
||||
dependencies:
|
||||
beautycolor "^1.0.7"
|
||||
smartq "^1.1.1"
|
||||
typings-global "^1.0.16"
|
||||
|
||||
es-abstract@^1.5.1:
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.10.0.tgz#1ecb36c197842a00d8ee4c2dfd8646bb97d60864"
|
||||
dependencies:
|
||||
es-to-primitive "^1.1.1"
|
||||
function-bind "^1.1.1"
|
||||
has "^1.0.1"
|
||||
is-callable "^1.1.3"
|
||||
is-regex "^1.0.4"
|
||||
|
||||
es-to-primitive@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
|
||||
dependencies:
|
||||
is-callable "^1.1.1"
|
||||
is-date-object "^1.0.1"
|
||||
is-symbol "^1.0.1"
|
||||
|
||||
es6-error@^4.0.2:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d"
|
||||
|
||||
foreach@^2.0.5:
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
|
||||
|
||||
function-bind@^1.0.2, function-bind@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
|
||||
|
||||
has@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
|
||||
dependencies:
|
||||
function-bind "^1.0.2"
|
||||
|
||||
hoek@5.x.x:
|
||||
version "5.0.3"
|
||||
resolved "https://registry.yarnpkg.com/hoek/-/hoek-5.0.3.tgz#b71d40d943d0a95da01956b547f83c4a5b4a34ac"
|
||||
|
||||
is-callable@^1.1.1, is-callable@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
|
||||
|
||||
is-date-object@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
|
||||
|
||||
is-regex@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
|
||||
dependencies:
|
||||
has "^1.0.1"
|
||||
|
||||
is-symbol@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
|
||||
|
||||
leakage@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.3.0.tgz#15d698abdc76bbc6439601f4f3020e77e2d50c39"
|
||||
dependencies:
|
||||
es6-error "^4.0.2"
|
||||
left-pad "^1.1.3"
|
||||
memwatch-next "^0.3.0"
|
||||
minimist "^1.2.0"
|
||||
pretty-bytes "^4.0.2"
|
||||
|
||||
left-pad@^1.1.3:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.2.0.tgz#d30a73c6b8201d8f7d8e7956ba9616087a68e0ee"
|
||||
|
||||
memwatch-next@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f"
|
||||
dependencies:
|
||||
bindings "^1.2.1"
|
||||
nan "^2.3.2"
|
||||
|
||||
minimist@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
|
||||
|
||||
nan@^2.3.2:
|
||||
version "2.9.2"
|
||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.9.2.tgz#f564d75f5f8f36a6d9456cca7a6c4fe488ab7866"
|
||||
|
||||
object-keys@^1.0.8:
|
||||
version "1.0.11"
|
||||
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
|
||||
|
||||
object.getownpropertydescriptors@^2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16"
|
||||
dependencies:
|
||||
define-properties "^1.1.2"
|
||||
es-abstract "^1.5.1"
|
||||
|
||||
pretty-bytes@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
|
||||
|
||||
smartchai@^1.0.3:
|
||||
version "1.0.8"
|
||||
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.8.tgz#a074836f4ddd4b98c50f1e7ae9e8e8ad9f6f1902"
|
||||
dependencies:
|
||||
"@types/code" "^4.0.3"
|
||||
code "^5.1.0"
|
||||
typings-global "^1.0.20"
|
||||
|
||||
smartdelay@^1.0.3:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.4.tgz#791c1a4ee6770494064c10b1d2d2b8e6f3105b82"
|
||||
dependencies:
|
||||
smartq "^1.1.1"
|
||||
typings-global "^1.0.16"
|
||||
|
||||
smartq@^1.1.1:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.6.tgz#0c1ff4336d95e95b4f1fdd8ccd7e2c5a323b8412"
|
||||
dependencies:
|
||||
typings-global "^1.0.19"
|
||||
util.promisify "^1.0.0"
|
||||
|
||||
tapbundle@^1.0.13:
|
||||
version "1.1.8"
|
||||
resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-1.1.8.tgz#e08aee0e100a830d8a26a583a85d37ce53312e02"
|
||||
dependencies:
|
||||
"@types/node" "^8.0.33"
|
||||
early "^2.1.1"
|
||||
leakage "^0.3.0"
|
||||
smartchai "^1.0.3"
|
||||
smartdelay "^1.0.3"
|
||||
smartq "^1.1.1"
|
||||
typings-global "^1.0.19"
|
||||
|
||||
typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.19, typings-global@^1.0.20:
|
||||
version "1.0.28"
|
||||
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.28.tgz#e28cc965476564cbc00e438739e0aa0735d323d4"
|
||||
|
||||
util.promisify@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030"
|
||||
dependencies:
|
||||
define-properties "^1.1.2"
|
||||
object.getownpropertydescriptors "^2.0.3"
|
Reference in New Issue
Block a user