1.3.5 • Published 2 years ago
webpack-publish-plugin v1.3.5
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-pluginUsage
- 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 Name | Usage | Type | Request | Default Value |
|---|---|---|---|---|
| type | Server's connect type | String | No | (sftp/ftp) |
| host | Server's IP address | String | Yes | (None) |
| port | Number of ssh port | Number | No | 22 |
| username | Username for authentication | String | Yes | (None) |
| password | Password for authentication | String | Yes | (None) |
| proxy | Connect to SOCKS 4/5 Proxy | Object | No | (None) |
| No | Deprecated,don't need it anymore | |||
| remotePath | Folder path on server | String | Yes | (None) |
| log | Show log when is uploading | Boolean | {info: Boolean, progress: Boolean, warning: Boolean, error: Boolean} | No | false |
| clearFolder | Clear remote path files for the first time | Boolean | No | false |
| fileIgnores | Files didn't upload(matching file path + file name), only sftp | Array\<RegExp> | No | (None) |
| dirMode | Change the mode (read, write or execute permissions) of a remote file or directory, only sftp | Integer | No | (0o775) |
For other options you can see:
- Type for FTP: basic-ftp
- Type for SFTP: ssh2-sftp-client
- Socks Proxy: ssh2
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 dependencies1.0.0
- Initialize ProjectLicense
This project is licensed under 996.ICU.