@vensst/vite-plugin-ssh-deploy
v1.0.0
Published
A Vite plugin to deploy build output to a remote server via SSH with backup and rollback.
Maintainers
Readme
@vensst/vite-plugin-ssh-deploy
A Vite plugin for automated remote deployment, with:
- 🔐 SSH upload
- 🗂 Automatic backup
- ♻️ Automatic rollback on failure
- 🔁 Optional nginx reload
- 🚀 Zero-config usage
📦 Install
npm i @vensst/vite-plugin-ssh-deploy -D⚙️ Usage
import deploy from '@vensst/vite-plugin-ssh-deploy'
export default {
plugins: [
deploy({
host: '1.2.3.4',
username: 'root',
password: 'yourpass',
remotePath: '/www/wwwroot/myapp',
localPath: 'dist',
backupKeep: 3,
isReloadNginx: true
})
]
}🔧 Options
| Field | Type | Required | Description |
|-------|------|---------|--------------------------------------------------|
| host | string | ✔ | SSH server host |
| port | number | ✖ | SSH server port. Default: 22 |
| username | string | ✔ | SSH username |
| password | string | ✔ | SSH password |
| remotePath | string | ✔ | Target deploy directory |
| localPath | string | ✖ | Default: dist |
| backupKeep | number | ✖ | Keep last N backups |
| buildCommand | string | ✖ | Optional build command. Default: npm run build |
| isReloadNginx | boolean | ✖ | Reload nginx on deploy. Default: false |
📁 Auto Backup & Rollback
The plugin:
- Backs up the previous version automatically
- Cleans old backups
- Rolls back automatically if upload or nginx reload fails
📜 License
MIT
