happy-upload
v1.2.1
Published
A delightful, reliable, and multi-environment friendly CLI tool for frontend deployment via SSH with i18n support.
Maintainers
Readme
Happy Upload CLI 🚀
A delightful, reliable, and multi-environment friendly CLI tool for frontend deployment via SSH.
Features
- 🌍 Internationalization (i18n): Supports English (en-US) and Chinese (zh-CN) with auto-detection.
- 🌳 Multi-Environment: Manage
dev,prod,stagingenvironments in one config. - � Atomic Rollback: One-command rollback to any previous version.
- 🛠 Zero Configuration Start: Interactive
initto generate templates. - � Smart Compression: Auto-zip local assets with progress visualization.
- � Zero-Downtime: Atomic switch implementation (upload -> unzip -> switch).
- 🤖 CI/CD Ready: Full support for CLI arguments to override config/secrets.
- 🧹 Auto Cleanup: Automatically rotate backups to save disk space.
Installation
npm install -g happy-uploadUsage
1. Initialize
Run in your project root:
happy-upload initThis generates a happy-deploy.config.js.
2. Configuration
Supports standard JS config with Environment isolation:
export default {
// Interface Language (zh-CN | en-US)
lang: 'zh-CN',
// Common defaults
default: {
port: 22,
distPath: './dist',
remotePath: '/var/www/project',
maxHistory: 5,
},
// Environments
envs: {
dev: {
host: '192.168.1.100',
username: 'root',
privateKey: '/path/to/dev.key',
},
prod: {
host: '1.2.3.4',
username: 'admin',
// CI/CD tip: Don't commit passwords! Use CLI args or env vars instead.
}
}
};3. Deploy (Upload)
Deploy to default environment (or interactive select if multiple exist):
happy-upload uploadDeploy to specific environment:
happy-upload upload --env prodCI/CD Mode (Non-interactive):
# Inject secrets via CLI args to avoid hardcoding in file
happy-upload upload --env prod --yes --password $DEPLOY_PASS4. Rollback
Mistake happened? Rollback instantly:
happy-upload rollbackInteractive menu lets you choose which version to restore.
5. Switch Language
happy-upload language
# or
happy-upload --lang en-USCLI Reference
| Command | Description |
| :--- | :--- |
| init | Generate configuration file |
| upload | Deploy project (supports --env, --yes) |
| rollback | Rollback to previous version |
| language | Switch interface language |
| --help | Show help info |
Global Options
--lang <lang>: Force interface language (e.g.,zh-CN,en-US).
Upload Options
Priority: CLI Args > Config File
-e, --env <name>: Target environment key-y, --yes: Skip confirmation prompts--host <ip>--username <user>--password <pwd>--private-key <path>--dist-path <path>--remote-path <path>
Requirements
- Node.js >= 18.0.0
- Target Server: Linux with SSH access (unzip required)
License
ISC
