1.3.5 • Published 28 days ago

webpack-publish-plugin v1.3.5

Weekly downloads
13
License
996.ICU
Repository
-
Last release
28 days ago

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
        host: 'YOUR_HOST',
        port: 'YOUR_PORT',
        username: 'YOUR_USER_NAME',
        password: 'YOUR_PASSWORD',
        remotePath: 'YOUR_REMOTE_PATH'
    })
  ]
}
  • How can I connect through a Socks Proxy
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
        host: 'YOUR_TARGET_HOST',  // target host
        port: 'YOUR_TARGET_PORT',  // target host port
        username: 'YOUR_TARGET_USER_NAME', // target host username
        password: 'YOUR_TARGET_PASSWORD',  // target host password
        remotePath: 'YOUR_REMOTE_PATH',
        proxy: {
          // proxy host options
          host: 'YOUR_PROXY_HOST',  // proxy host
          port: 'YOUR_PROXY_PORT',  // proxy host port
          username: 'YOUR_PROXY_USER_NAME', // proxy host username
          password: 'YOUR_PROXY_PASSWORD',  // proxy host password
        }
    })
  ]
}

Options Detail:

支持分布式项目代码部署,参数改成传入数组即可: [{Options}, {Options}]
- PS:将代码部署到N台分布式的服务器上。
Option NameUsageTypeRequestDefault Value
typeServer's connect typeStringNo(sftp/ftp)
hostServer's IP addressStringYes(None)
portNumber of ssh portNumberNo22
usernameUsername for authenticationStringYes(None)
passwordPassword for authenticationStringYes(None)
proxyConnect to SOCKS 4/5 ProxyObjectNo(None)
localPathFolder path which need uploadStringNoDeprecated,don't need it anymore
remotePathFolder path on serverStringYes(None)
logShow log when is uploadingBoolean | {info: Boolean, progress: Boolean, warning: Boolean, error: Boolean}Nofalse
clearFolderClear remote path files for the first timeBooleanNofalse
fileIgnoresFiles didn't upload(matching file path + file name), only sftpArray\<RegExp>No(None)
dirModeChange the mode (read, write or execute permissions) of a remote file or directory, only sftpIntegerNo(0o775)

For other options you can see:

Changelog

1.3.5

- fix: 修复chalk版本被升级至v5后导致出现依赖报错

1.3.2

- perf: 优化ftp上传方式的UE和进度展示
- fix: 修复上传异常报错后被挂起的问题
- docs: 补全代理跳板的参数和参考示例

1.3.0

- feat: 增加支持开启代理跳板
- fix:修复ftp无法部署的问题

1.2.0

- feat: 增加支持webpack5(3 | 4| 5)
- feat:支持分布式代码部署

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.