npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@oiij/vite-plugin-deploy

v0.0.3

Published

A Vite plugin for deploying static files use ssh2-sftp-client

Readme

vite-plugin-deploy

NPM version GITHUB star MIT-license GITHUB-language

A Vite plugin for deploying static files using ssh2-sftp-client.

Features

  • 🚀 Automatic deployment after build
  • 🔧 Configurable connection options
  • 📁 Backup remote directory before deployment
  • 📊 Real-time deployment progress
  • 🔍 Automatic detection of build output directory from Vite config
  • 🛡️ Robust error handling and recovery
  • ✅ Comprehensive test coverage with Vitest

Install

pnpm add @oiij/vite-plugin-deploy -D

Usage

// vite.config.js

import { vitePluginDeploy } from '@oiij/vite-plugin-deploy'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [
    // ...other plugins
    vitePluginDeploy({
      // Enable deployment (default: true)
      enable: true,

      // Local directory to deploy (default: Vite's build.outDir or 'dist')
      localDir: 'dist',

      // Remote directory to deploy to (default: /home/dist)
      remoteDir: '/home/dist',

      // Backup remote directory before deployment
      // Can be boolean or string (custom backup path)
      // Default: true (backs up to /home/dist_backup)
      backup: true,

      // SSH connection options
      connectOptions: {
        host: 'xxx.xxx.xxx.xxx',
        port: 22,
        username: 'xxx',
        password: 'xxx',
        // privateKey: '',
        // ...other options from ssh2-sftp-client
      },

      // Upload options from ssh2-sftp-client
      uploadOptions: {
        // ...upload options
      }
    }) // Please place at the end
  ]
})

Configuration

Options

| Option | Type | Default | Description | | ---------------- | ----------------- | ------------------------------- | ------------------------------------------------------------------------------------------------ | | enable | boolean | true | Whether to enable deployment | | localDir | string | Vite's build.outDir or 'dist' | Local directory to deploy | | remoteDir | string | /home/dist | Remote directory to deploy to | | backup | boolean string | true | Whether to backup remote directory before deployment, or custom backup path | | connectOptions | object | {} | SSH connection options (see ssh2-sftp-client) | | uploadOptions | object | {} | Upload options (see ssh2-sftp-client) |

How it works

  1. Configuration Resolution: The plugin resolves Vite config in the configResolved hook
  2. Build Completion: Deployment starts after the build completes via the closeBundle hook
  3. Connection Establishment: Establishes SSH connection to the remote server
  4. Backup (if enabled): Backs up the existing remote directory
  5. File Upload: Uploads all files from the local directory to the remote server
  6. Progress Tracking: Displays real-time upload progress
  7. Error Handling: Gracefully handles errors and attempts to restore from backup if needed
  8. Connection Closure: Ensures SSH connection is properly closed

Tips

  • Place at the end: Always place the plugin at the end of the plugins array to ensure it runs after all other plugins
  • Security: For production deployments, consider using privateKey instead of password for authentication
  • Backup: Enable backup to prevent data loss in case of deployment failures
  • Logging: The plugin provides detailed logs during deployment for easy debugging

License

MIT