webpack-publish-plugin

Webpack environment code deployment upload support, support FTP and SFTP

Usage no npm install needed!

<script type="module">
  import webpackPublishPlugin from 'https://cdn.skypack.dev/webpack-publish-plugin';
</script>

README

webpack-publish-plugin

This plugin is a wrapper for basic-ftp and ssh2-sftp-client. You can upload directory to your ftp/sftp server after webpack build done.

Installation

npm i -D webpack-publish-plugin

Usage

add following code to your webpack config file.

const WebpackPublishPlugin = require('webpack-publish-plugin');

var webpackConfig = {
  entry: 'index.js',
  output: {
    path: 'assets',
    filename: 'index_bundle.js'
  },
  plugins: [
    new WebpackPublishPlugin({

        // config options, you can find options detail down here
        
    })
  ]
}

Options Detail:

Option Name Usage Type Default Value
type Server's connect type String (sftp)
host Server's IP address String (none)
port Number of ssh port String "22"
username Username for authentication String (none)
password Password for authentication String (none)
localPath Folder path which need upload String Deprecated,don't need it anymore
remotePath Folder path on server String (none)
log Show log when is uploading Boolean | {info: Boolean, progress: Boolean, warning: Boolean, error: Boolean} false
clearFolder Clear remote path files for the first time Boolean false
fileIgnores Files didn't upload(matching file path + file name), only sftp Array<RegExp> (none)
dirMode Change the mode (read, write or execute permissions) of a remote file or directory, only sftp integer (0o775)

for other options you can see webpack-ssh2-upload-plugin

Change Log

1.1.0

- feat: 基于 ssh2-sftp-client 组件重构sftp上传方式的功能逻辑(从此版本后不再依赖 webpack-ssh2-upload-plugin)

1.0.1

- fix: Revision version number
- fix: fix dependencies

1.0.0

- Initialize Project

License

This project is licensed under 996.ICU.