Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

faster-webpack-upload-plugin

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

faster-webpack-upload-plugin - npm Package Compare versions

Comparing version 1.0.6 to 1.1.0

2

package.json
{
"name": "faster-webpack-upload-plugin",
"version": "1.0.6",
"version": "1.1.0",
"author": "WangTieZhu92",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -25,10 +25,5 @@ # faster-webpack-upload-plugin

new FasterUploadPlugin({
host: 'host',
port: 'post', // default: 22
username: 'username',
password: 'password',
localPath: 'local path', // eg. 'assets'
remotePath: 'remote path', // eg. /home/website/assets
log: boolean, //default: false, is log details
clearFolder: boolean //default: false, clear remote path files for the first time
// config options, you can find options detail down here
})

@@ -39,2 +34,15 @@ ]

```
### Options Detail:
Option Name|Usage|Type|Default Value
---|:--:|:--:|:-:
host|Server's IP address|String|(none)
port|Number of ssh port| String | "22"
username|Username for authentication|String|(none)
localPath|Folder path which need upload|String|(none)
remotePath|Folder path on server|String|(none)
log|Show log when is uploading|Boolean|false
clearFolder|Clear remote path files for the first time|Boolean|false
fileIgnores|Files didn't upload(matching file name with file path)|Array\<RegExp\>|(none)
for other options you can see https://github.com/mscdex/ssh2#client-methods

@@ -41,0 +49,0 @@

@@ -44,3 +44,3 @@ 'use strict'

async upload(compilation, callback) {
const {localPath, remotePath, log, clearFolder, ...others} = this.options;
const {localPath, remotePath, log, clearFolder, fileIgnores, ...others} = this.options;
const folders = [];

@@ -65,3 +65,3 @@ const files = [];

getFolderNFiles(folders, files, localPath, remotePath);
this.getFolderNFiles(folders, files, localPath, remotePath);

@@ -73,2 +73,6 @@ this.options.firstEmit = false;

if (assets[file].emitted) {
if (fileIgnores && fileIgnores.some((regexp) => regexp.test(assets[file].existsAt))) {
return;
}
files.push({

@@ -117,29 +121,31 @@ local: assets[file].existsAt,

}
getFolderNFiles(folders, files, local, remote, file) {
if (file) {
const localPath = path.join(local, file);
const stats = fs.statSync(localPath);
if (stats.isDirectory()) {
const folder = remote + '/' + file;
const list = fs.readdirSync(local + '/' + file);
function getFolderNFiles(folders, files, local, remote, file) {
if (file) {
const localPath = path.join(local, file);
const stats = fs.statSync(localPath);
if (stats.isDirectory()) {
const folder = remote + '/' + file;
const list = fs.readdirSync(local + '/' + file);
folders.push(folder);
for (const f of list) {
getFolderNFiles(folders, files, localPath, folder, f);
folders.push(folder);
for (const f of list) {
this.getFolderNFiles(folders, files, localPath, folder, f);
}
} else {
if (this.options.fileIgnores && this.options.fileIgnores.some((regexp) => regexp.test(localPath))) {
return;
}
files.push({
local: localPath,
remote: remote + '/' + file,
size: stats.size,
});
}
} else {
files.push({
local: localPath,
remote: remote + '/' + file,
size: stats.size,
});
const fileList = fs.readdirSync(local);
for (const f of fileList) {
this.getFolderNFiles(folders, files, local, remote, f);
}
}
} else {
const fileList = fs.readdirSync(local);
for (const file of fileList) {
getFolderNFiles(folders, files, local, remote, file);
}
}

@@ -149,2 +155,5 @@

function formatRemotePath(remotePath, filePath) {

@@ -151,0 +160,0 @@ return (remotePath + '/' + filePath).replace(/\\/g, '/');

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc