Skip to content

Commit 21fbbfd

Browse files
committed
docs: comprehensively update README with current API and features
- Update Quick Start example with FileTransport and ZonrOptions usage - Add complete File Transport documentation with all configuration options - Document automatic signal handling and graceful shutdown behavior - Add Conventional Commits section with development workflow - Update all GitHub URLs, contact information, and repository links - Enhance Key Features list with new file transport and signal handling capabilities
1 parent d10cdd7 commit 21fbbfd

File tree

1 file changed

+103
-17
lines changed

1 file changed

+103
-17
lines changed

README.md

Lines changed: 103 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Zonr transforms terminal output from chaotic text streams into organized, respon
2929
- **🌍 Wide Character Support**: Proper handling of emoji and Unicode characters
3030
- **🚀 High Performance**: Differential rendering updates only changed content
3131
- **🪟 Cross-Platform**: Full Windows support with resize detection workarounds
32+
- **📁 File Transport**: High-performance logging with sonic-boom and automatic cleanup
33+
- **🛡️ Signal Handling**: Automatic graceful shutdown with transport flushing on SIGINT/SIGTERM
3234

3335
---
3436

@@ -49,17 +51,23 @@ yarn add zonr
4951
## 🎮 Quick Start
5052

5153
```typescript
52-
import Zonr from 'zonr';
54+
import Zonr, { FileTransport } from 'zonr';
5355

54-
// Create a new terminal UI
55-
const zonr = new Zonr();
56+
// Create a new terminal UI with automatic signal handling
57+
const zonr = new Zonr({ autoCleanup: true });
5658

57-
// Add zones with different layouts
59+
// Add zones with different layouts and file logging
5860
const logs = zonr.addZone({
5961
name: "Application Logs",
6062
width: "70%",
6163
height: "auto",
62-
borderColor: "blue"
64+
borderColor: "blue",
65+
additionalTransports: [
66+
new FileTransport({
67+
filePath: "./app.log",
68+
highVolume: true // Optimized for high-throughput logging
69+
})
70+
]
6371
});
6472

6573
const status = zonr.addZone({
@@ -69,7 +77,7 @@ const status = zonr.addZone({
6977
borderColor: "green"
7078
});
7179

72-
// Start logging
80+
// Start logging - automatically flushes to file on exit
7381
logs.info('🚀 Application started');
7482
logs.warn('⚠️ High memory usage detected');
7583
logs.error('❌ Database connection failed');
@@ -271,20 +279,36 @@ borderColor: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan"
271279

272280
## 🔧 Advanced Usage
273281

274-
### Custom Transports
282+
### File Transport
275283

276284
```typescript
277285
import { FileTransport } from 'zonr';
278286

279-
// Log to file in addition to terminal
280-
const fileTransport = new FileTransport('./app.log');
287+
// High-performance file logging with automatic cleanup
288+
const fileTransport = new FileTransport({
289+
filePath: './logs/app.log', // Direct file path
290+
highVolume: true, // Optimize for high-throughput logging
291+
maxFiles: 5, // File rotation (placeholder)
292+
maxSize: '100MB' // Size rotation (placeholder)
293+
});
281294

282-
const zone = zonr.zones.add({
295+
// Alternative: path + filename pattern
296+
const altTransport = new FileTransport({
297+
path: './logs', // Directory path
298+
filename: 'application.log', // Filename
299+
sync: true, // Synchronous writes for reliability
300+
minLength: 8192 // Buffer size for performance
301+
});
302+
303+
const zone = zonr.addZone({
283304
name: "Persistent Logs",
284305
width: "100%",
285306
height: "auto",
286-
transports: [fileTransport]
307+
additionalTransports: [fileTransport] // Updated property name
287308
});
309+
310+
// Automatic transport cleanup on SIGINT/SIGTERM
311+
// Files are properly flushed and closed when process exits
288312
```
289313

290314
### Event-Driven Updates
@@ -299,6 +323,35 @@ setTimeout(() => {
299323
}, 2000);
300324
```
301325

326+
### Automatic Signal Handling
327+
328+
```typescript
329+
// Create Zonr instance with automatic cleanup (default: true)
330+
const zonr = new Zonr({ autoCleanup: true });
331+
332+
// Add zones with file transports
333+
const logger = zonr.addZone({
334+
name: "Application",
335+
additionalTransports: [
336+
new FileTransport({ filePath: './app.log' })
337+
]
338+
});
339+
340+
logger.info('Application started');
341+
342+
// When user presses Ctrl+C or process receives SIGTERM:
343+
// 1. All transports are automatically flushed
344+
// 2. All transports are properly closed
345+
// 3. Process exits gracefully
346+
// 4. No data is lost!
347+
348+
// Disable automatic cleanup if needed
349+
const manualZonr = new Zonr({ autoCleanup: false });
350+
// You would need to manually call:
351+
// await manualZonr.flushAllTransports();
352+
// await manualZonr.closeAllTransports();
353+
```
354+
302355
### Dynamic Layout Changes
303356

304357
```typescript
@@ -337,8 +390,8 @@ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) f
337390
### Development Setup
338391

339392
```bash
340-
# Clone the repository
341-
git clone <repository-url>
393+
# Clone the repository
394+
git clone https://github.com/itsJess1ca/Zonr.git
342395
cd zonr
343396

344397
# Install dependencies
@@ -355,6 +408,39 @@ pnpm run demo:minimal
355408
pnpm run demo:gaming
356409
```
357410

411+
### Conventional Commits
412+
413+
This project uses [Conventional Commits](https://www.conventionalcommits.org/) with automated semantic versioning:
414+
415+
```bash
416+
# Interactive commit prompts (recommended)
417+
pnpm run commit
418+
419+
# Manual conventional format
420+
git commit -m "feat: add new zone layout algorithm"
421+
git commit -m "fix: resolve border alignment issue"
422+
git commit -m "docs: update API documentation"
423+
424+
# Test what would be released
425+
pnpm run release:dry
426+
```
427+
428+
**Commit Types:**
429+
- `feat:` - New features (minor version bump)
430+
- `fix:` - Bug fixes (patch version bump)
431+
- `docs:` - Documentation changes
432+
- `style:` - Code style changes
433+
- `refactor:` - Code refactoring
434+
- `test:` - Adding or updating tests
435+
- `chore:` - Maintenance tasks
436+
- `ci:` - CI/CD changes
437+
- `perf:` - Performance improvements
438+
- `build:` - Build system changes
439+
440+
**Breaking Changes:** Add `BREAKING CHANGE:` in commit footer for major version bumps.
441+
442+
**Automated Releases:** Semantic releases are automatically created when conventional commits are pushed to the main branch.
443+
358444
### Running Tests
359445

360446
```bash
@@ -381,15 +467,15 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md
381467

382468
## 📞 Support
383469

384-
- 🐛 **Issues**: [GitHub Issues](https://github.com/yourusername/zonr/issues)
385-
- 💬 **Discussions**: [GitHub Discussions](https://github.com/yourusername/zonr/discussions)
386-
- 📧 **Email**: your.email@example.com
470+
- 🐛 **Issues**: [GitHub Issues](https://github.com/itsJess1ca/Zonr/issues)
471+
- 💬 **Discussions**: [GitHub Discussions](https://github.com/itsJess1ca/Zonr/discussions)
472+
- 📧 **Email**: jessica.ide247@gmail.com
387473

388474
---
389475

390476
<div align="center">
391477

392-
**[⭐ Give us a star on GitHub!](https://github.com/yourusername/zonr)**
478+
**[⭐ Give us a star on GitHub!](https://github.com/itsJess1ca/Zonr)**
393479

394480
Made with ❤️ for the terminal-loving community
395481

0 commit comments

Comments
 (0)