sftp-upload-plugin
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -9,7 +9,7 @@ const upload = require ('./server/upload'); | ||
apply(compiler) { | ||
compiler.plugin('done', (compilation, callback) => { | ||
upload(this.config, callback); | ||
compiler.hooks.done.tap('done', () => { | ||
upload(this.config); | ||
}); | ||
compiler.plugin('failed', (err) => { | ||
compiler.hooks.failed.tap('failed', (err) => { | ||
console.log(err); | ||
@@ -16,0 +16,0 @@ }); |
{ | ||
"name": "sftp-upload-plugin", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "upload thought SFTP after build", | ||
@@ -25,4 +25,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"cli-progress": "^3.0.0", | ||
"ssh2-sftp-client": "^2.5.0" | ||
} | ||
} |
@@ -5,2 +5,3 @@ const Client = require ('ssh2-sftp-client'); | ||
const fs = require ('fs'); | ||
const _cliProgress = require('cli-progress'); | ||
@@ -71,6 +72,10 @@ /* | ||
const bar = new _cliProgress.SingleBar({}, _cliProgress.Presets.shades_classic); | ||
bar.start(200, 0); | ||
// create files | ||
for (let i = 0; i < fileHandler.length; i++) { | ||
try { | ||
console.log('files uploading --------------- ', parseInt((i + 1)/fileHandler.length * 100), '%'); | ||
console.log('files uploading --------------- ', parseInt((i + 1)/fileHandler.length * 100)); | ||
bar.update(parseInt((i + 1)/fileHandler.length * 100 * 2)); | ||
await this.put(fileHandler[i], fileHandler[i].replace(localPath, remotePath)) | ||
@@ -81,2 +86,3 @@ } catch (e) { | ||
} | ||
bar.stop(); | ||
@@ -87,3 +93,3 @@ return 'Finish upload' | ||
// 开始上传 | ||
function upload (config, cb) { | ||
function upload (config) { | ||
sftp | ||
@@ -93,3 +99,3 @@ .connect (config) | ||
sftp.dirPut(config.localPath, config.remotePath) | ||
.then(() => cb()) | ||
.then(() => process.exit(0)) | ||
}) | ||
@@ -96,0 +102,0 @@ .catch (err => { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13
112
15568
2
+ Addedcli-progress@^3.0.0
+ Addedansi-regex@5.0.1(transitive)
+ Addedcli-progress@3.12.0(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)