vite-plugin-ssh

A vite ssh deploy plugin

Usage no npm install needed!

<script type="module">
  import vitePluginSsh from 'https://cdn.skypack.dev/vite-plugin-ssh';
</script>

README

vite-plugin-ssh

NPM Build With tsup

A vite ssh deploy plugin

Install

With yarn

yarn add --dev vite-plugin-ssh

With npm

npm install --dev vite-plugin-ssh

Usage

// vite.config.ts
import VitePluginSsh from 'vite-plugin-ssh'

export default defineConfig(() => {
  return {
    plugins: [
      VitePluginSsh({
        host: 'example.com',
        port: 22,
        username: 'username',
        password: 'password',
        // identity: '/path/to/privatekey',
        localPath: 'dist',
        remotePath: '/path/to/root',
        backupFiles: ['assets', 'index.html'], // or ['*']
      }),
    ],
  }
})

Options

Property Description Type Default
host Hostname or IP of the server string -
port Port number of the server number 22
username Username for authentication string -
password Password for connect to the remote server authentication string -
identity Use the private key to connect server, The path of private key file string -
localPath Local directory path to deployment files string dist
remotePath Full path to the remote directory string -
maxBuffer The maxBuffer option specifies the largest number of bytes allowed on stdout or stderr number 100*1024
backupFiles Backup the {remotePath} folder or files when you start the deployment string[] -
backupFilenameFormat Backup the timestamp of the filename string YYYYMMDDHHmmss

Example

$ cd example
$ yarn
$ yarn build

Development

$ yarn
$ yarn dev
$ yarn build

Questions & Suggestions

Please open an issue here.

LICENSE

MIT