turbotask
v0.2.15
Published
A command-line tool that Makes Handling files quick and easy.
Downloads
296
Maintainers
Readme
TurboTask File Processing Toolkit
A versatile Node.js toolkit for file processing operations. Currently supports CSS minification with plans for expanded functionality including file grouping, media duration analysis, and more.
🚀 Quick Start
npm install -g turbotask
✨ Features
Current Features
- CSS Processing
- Minify CSS files by removing comments and whitespace
- Process single files or entire directories
- Maintain directory structures
- Safe processing with validation checks
Planned Features
- File grouping by type
- Media file duration analysis
- More file processing capabilities (coming soon)
📦 Installation
NPM
npm install -g turbotask
Manual Installation
# Clone the repository
git clone https://github.com/Fector101/TurboTask.git
# Navigate to the project directory
cd turbotask
# Install dependencies
npm install
🔨 Usage
Currently, the tool supports CSS processing:
turbotask noWhiteSpace <input_css_path> [optional_output_path]
The noWhiteSpace arguments:
- <input_css_path> can be a CSS file or Folder with CSS Files.
- [output_path] Output directory (defaults to "TurboTask-output") can be changed to a File or Folder Path
Examples For CLI Usage
turbotask noWhiteSpace rough.css clean.css
OR
turbotask noWhiteSpace ./styles ./minified
Examples For In-File Usage
const path = require("path") // This is packaged with NodeJS
const {noWhiteSpace} = require("turbotask")
// For Single File
noWhiteSpace('main.css','main-new.css')
// For Folders File
noWhiteSpace('./styles','./minified')
noWhiteSpace('./','./minified')
// If you dont' want to Over-Write Original Files add a output folder
noWhiteSpace('','')
🛠️ Core Utilities
File Operations
Directory Management
// Create directory (creates parent directories if needed)
createDirectory('./path/to/new/directory');
File Reading/Writing
// Read file
const content = readFile('./path/to/file.css');
// Write file
writeFile(content, './output/path.css',
'Success message', 'Error message');
Console Output
The toolkit includes formatted console output with color coding:
console.log(greenText('Success!')); // Green colored success message
console.log(redText('Error!')); // Red colored error message
🏗️ Technical Architecture
Core Modules
Helper Utilities (helper.js
)
- File system operations
createDirectory()
: Create directories recursivelyreadFile()
: Safe file reading with error handlingwriteFile()
: Safe file writing with directory creation
- Console formatting
greenText()
: Format success messagesredText()
: Format error messages
CSS Processing (workers/basic.js
)
removeComments()
: Strip CSS commentsmyStrip()
: Remove unnecessary whitespace- Validation and safety checks
Error Handling
The toolkit implements comprehensive error handling:
- File existence validation
- Directory creation verification
- Read/Write operation protection
- Format-specific validation (e.g., CSS comment structure)
- Colored error messages for visibility
🔄 Future Development
The toolkit is designed for expansion. Planned features include:
File Organization
- Group files by type
- Smart file sorting
- Duplicate detection
Media Processing
- Duration analysis
- Format conversion
- Metadata extraction
General Utilities
- Batch processing capabilities
- Custom filtering rules
- Advanced file manipulation
🤝 Contributing
Contributions are welcome! The modular architecture makes it easy to add new features:
- Add new worker modules for specific file types
- Extend helper utilities for common operations
- Implement new CLI commands for new features
⚠️ Error Codes
Common error messages and their meanings:
<Error - [filepath] Doesn't Exist>
: File not foundFailed to create directory
: Permission or path issues- Custom error messages can be specified for writeFile operations
📝 Notes
- The toolkit is under active development
- New features will be added progressively
- Maintains backward compatibility with existing functionality
- Focuses on safe file operations with comprehensive error handling
☕ Support the Project
If you find TurboTask helpful, consider buying me a coffee! Your support helps maintain and improve the project.
Your support helps me to:
- Maintain and improve TurboTask
- Add new features
- Keep the project active
📄 License
MIT © Fabian Joseph
Author
- Fabian - [email protected]
- GitHub: https://github.com/Fector101/TurboTask