English version | Versione Italiana
A TypeScript command-line utility (CLI) to quickly create and extract ZIP backup archives of your project, allowing granular selection of files and folders and secure encryption.
- Compression & Decompression: Choose whether to create a new backup or extract an existing one from a simple initial menu.
- Interactive Selection: Choose which files and folders from the root to include in the archive.
- Automatic Encryption: Generates a secure 14-character password to protect the ZIP archive.
- Secure Extraction: Allows extracting encrypted ZIP files by providing the correct password.
- Smart Exclusions: Automatically excludes heavy or unnecessary folders like
node_modules,dist,.git, and other existing backup files. - Optimized Compression: Uses
archiverwith compression level 9 (Zlib). - Customizable Naming: Suggests a name based on today's date (
backup_YYYY-MM-DD.zip), but allows customization. - Overwrite Protection: Asks for confirmation before overwriting an existing file.
- Real-time Feedback: Displays progress percentage and the size of processed data during compression.
- Code Quality: Linting with ESLint and formatting with Prettier.
- Automated Testing: Test suite with Jest to ensure logic correctness.
- Continuous Integration: GitHub Actions configured for automatic lint, build, and test on every push.
- Node.js (recommended version: 22 or higher)
- pnpm (recommended), npm, or yarn
-
Clone the repository:
git clone <repository-url> cd backup-script
-
Install dependencies:
pnpm install
You can install the tool globally to use it in any project:
npm install -g backup-script-cliAfter installation, you can use the command:
backup-cliTo run the script directly from TypeScript sources:
npm run devTo compile the script into an optimized bundle (using esbuild):
npm run buildAfter the build, you can run the standard version:
npm startTo lint the code:
npm run lintTo automatically format the code:
npm run formatTo run the test suite with Jest:
npm testsrc/main.ts: Main entry point of the script (manages the main menu).src/utils/utils.ts: Utility functions extracted for testability.tests/: Automated test suite.dist/: Contains bundles generated after the build.package.json: Project configuration and npm scripts..github/workflows/: Configuration for GitHub Actions.eslint.config.js&.prettierrc: Configurations for code quality.
- archiver: ZIP archive generation.
- archiver-zip-encryptable: Password encryption support.
- adm-zip: Estrazione robusta di file ZIP con supporto password.
- inquirer: Interactive CLI interface.
- glob: Pattern matching for files.
- esbuild: Ultra-fast bundler for compilation.
- Jest: Testing framework.
- ESLint: Linting tool.
- Prettier: Code formatter.
Maurizio Tolomeo
- Website: https://www.mauriziotolomeo.it
- Email: maurizio.tolomeo@outlook.it
Created to simplify local backup management during development.
Un'utilità a riga di comando (CLI) in TypeScript per creare ed estrarre rapidamente archivi ZIP di backup del progetto, permettendo la selezione granulare dei file e delle cartelle e la cifratura sicura.
- Compressione e Decompressione: Scegli se creare un nuovo backup o estrarne uno esistente tramite un semplice menu iniziale.
- Selezione Interattiva: Scegli quali file e cartelle della root includere nell'archivio.
- Cifratura Automatica: Genera una password sicura a 14 caratteri per proteggere l'archivio ZIP.
- Estrazione Sicura: Permette di decomprimere file ZIP cifrati fornendo la password corretta.
- Esclusioni Intelligenti: Esclude automaticamente cartelle pesanti o inutili come
node_modules,dist,.gite altri file di backup esistenti. - Compressione Ottimizzata: Utilizza
archivercon livello di compressione 9 (Zlib). - Naming Personalizzabile: Suggerisce un nome basato sulla data odierna (
backup_YYYY-MM-DD.zip), ma permette la personalizzazione. - Protezione Sovrascrittura: Chiede conferma prima di sovrascrivere un file esistente.
- Feedback in Tempo Reale: Mostra la percentuale di avanzamento e la dimensione dei dati processati durante la compressione.
- Qualità del Codice: Linting con ESLint e formattazione con Prettier.
- Test Automatizzati: Suite di test con Jest per garantire la correttezza della logica.
- Continuous Integration: GitHub Actions configurate per lint, build e test automatici ad ogni push.
- Node.js (versione consigliata: 22 o superiore)
- pnpm (consigliato), npm o yarn
-
Clona la repository:
git clone <repository-url> cd backup-script
-
Installa le dipendenze:
pnpm install
Puoi installare lo strumento globalmente per usarlo in qualsiasi progetto:
npm install -g backup-script-cliDopo l'installazione, potrai usare il comando:
backup-cliPer eseguire lo script direttamente dai sorgenti TypeScript:
npm run devPer compilare lo script in un bundle ottimizzato (utilizzando esbuild):
npm run buildDopo la build, puoi eseguire la versione standard:
npm startPer eseguire il linting del codice:
npm run lintPer formattare automaticamente il codice:
npm run formatPer eseguire la suite di test con Jest:
npm testsrc/main.ts: Punto di ingresso principale dello script (gestisce il menu principale).src/utils/utils.ts: Funzioni di utilità estratte per testabilità.tests/: Suite di test automatizzati.dist/: Contiene i bundle generati dopo la build.package.json: Configurazione del progetto e script npm..github/workflows/: Configurazione per GitHub Actions.eslint.config.js&.prettierrc: Configurazioni per la qualità del codice.
- archiver: Generazione di archivi ZIP.
- archiver-zip-encryptable: Supporto alla cifratura con password.
- adm-zip: Estrazione robusta di file ZIP con supporto password.
- inquirer: Interfaccia interattiva CLI.
- glob: Corrispondenza di pattern per i file.
- esbuild: Bundler ultra-veloce per la compilazione.
- Jest: Framework di testing.
- ESLint: Strumento di linting.
- Prettier: Formattatore di codice.
Maurizio Tolomeo
- Website: https://www.mauriziotolomeo.it
- Email: maurizio.tolomeo@outlook.it
Creato per semplificare la gestione dei backup locali durante lo sviluppo.