filemanager-webpack-plugin
Advanced tools
Comparing version 1.0.15 to 1.0.16
@@ -13,2 +13,3 @@ 'use strict'; | ||
var fs = require('fs'); | ||
var fsExtra = require('fs-extra'); | ||
var rimraf = require('rimraf'); | ||
@@ -85,2 +86,6 @@ var mv = require('mv'); | ||
if (this.options.verbose) { | ||
console.log(' - FileManagerPlugin: Start copy source file: ' + source + ' to destination file: ' + destination); | ||
} | ||
cpx.copy(source, destination, this.cpxOptions, function (err) { | ||
@@ -93,3 +98,3 @@ if (err && _this2.options.verbose) { | ||
if (_this2.options.verbose) { | ||
console.log(' - FileManagerPlugin: Finished copy source: ' + sourceDir + ' to destination: ' + command.destination); | ||
console.log(' - FileManagerPlugin: Finished copy source: ' + source + ' to destination: ' + destination); | ||
} | ||
@@ -139,20 +144,18 @@ | ||
if (_this3.options.verbose) { | ||
console.log(' - FileManagerPlugin: Start copy source: ' + sourceDir + ' to destination: ' + command.destination); | ||
} | ||
if (stats.isFile()) { | ||
fs.copyFile(command.source, command.destination, function (err) { | ||
if (err && _this3.options.verbose) { | ||
console.log(' - FileManagerPlugin: Start copy source file: ' + command.source + ' to destination file: ' + command.destination); | ||
} | ||
resolve(err); | ||
if (_this3.options.verbose) { | ||
console.log(' - FileManagerPlugin: Start copy source: ' + command.source + ' to destination: ' + command.destination); | ||
} | ||
fsExtra.copy(command.source, command.destination, function (err) { | ||
if (err) reject(err); | ||
resolve(); | ||
}); | ||
} else { | ||
var _sourceDir = command.source; | ||
_sourceDir += (_sourceDir.substr(-1) !== "/" ? "/" : "") + "**/*"; | ||
_this3.copyDirectory(_sourceDir, command.destination, resolve, reject); | ||
var sourceDir = command.source + (command.source.substr(-1) !== "/" ? "/" : "") + "**/*"; | ||
_this3.copyDirectory(sourceDir, command.destination, resolve, reject); | ||
} | ||
@@ -198,4 +201,6 @@ }); | ||
mv(command.source, command.destination, { mkdirp: _this3.options.moveWithMkdirp }, function (err) { | ||
if (err && _this3.options.verbose) { | ||
console.log(' - FileManagerPlugin: Error - move failed', err); | ||
if (err) { | ||
if (_this3.options.verbose) { | ||
console.log(' - FileManagerPlugin: Error - move failed', err); | ||
} | ||
reject(err); | ||
@@ -202,0 +207,0 @@ } |
{ | ||
"name": "filemanager-webpack-plugin", | ||
"version": "1.0.15", | ||
"version": "1.0.16", | ||
"description": "This Webpack plugin allows you to copy, move, delete files and directories before and after builds", | ||
@@ -42,2 +42,3 @@ "main": "lib/index.js", | ||
"cpx": "^1.5.0", | ||
"fs-extra": "^4.0.3", | ||
"make-dir": "^1.1.0", | ||
@@ -44,0 +45,0 @@ "mv": "^2.1.1", |
const cpx = require('cpx'); | ||
const fs = require('fs'); | ||
const fsExtra = require('fs-extra') | ||
const rimraf = require('rimraf'); | ||
@@ -69,2 +70,6 @@ const mv = require('mv'); | ||
if (this.options.verbose) { | ||
console.log(` - FileManagerPlugin: Start copy source file: ${source} to destination file: ${destination}`); | ||
} | ||
cpx.copy(source, destination, this.cpxOptions, (err) => { | ||
@@ -77,3 +82,3 @@ if (err && this.options.verbose) { | ||
if (this.options.verbose) { | ||
console.log(` - FileManagerPlugin: Finished copy source: ${sourceDir} to destination: ${command.destination}`) | ||
console.log(` - FileManagerPlugin: Finished copy source: ${source} to destination: ${destination}`) | ||
} | ||
@@ -121,13 +126,15 @@ | ||
if (this.options.verbose) { | ||
console.log(` - FileManagerPlugin: Start copy source: ${sourceDir} to destination: ${command.destination}`) | ||
} | ||
if(stats.isFile()) { | ||
fs.copyFile(command.source, command.destination, (err) => { | ||
if (err && this.options.verbose) { | ||
console.log(` - FileManagerPlugin: Start copy source file: ${command.source} to destination file: ${command.destination}`) | ||
} | ||
resolve(err) | ||
if (this.options.verbose) { | ||
console.log(` - FileManagerPlugin: Start copy source: ${command.source} to destination: ${command.destination}`); | ||
} | ||
fsExtra.copy(command.source, command.destination, (err) => { | ||
if (err) | ||
reject(err); | ||
resolve(); | ||
}); | ||
@@ -137,5 +144,3 @@ | ||
let sourceDir = command.source; | ||
sourceDir += ((sourceDir.substr(-1) !== "/") ? "/" : "") + "**/*"; | ||
const sourceDir = command.source + ((command.source.substr(-1) !== "/") ? "/" : "") + "**/*"; | ||
this.copyDirectory(sourceDir, command.destination, resolve, reject); | ||
@@ -176,8 +181,10 @@ | ||
if (this.options.verbose) { | ||
console.log(` - FileManagerPlugin: Start move source: ${command.source} to destination: ${command.destination}`) | ||
console.log(` - FileManagerPlugin: Start move source: ${command.source} to destination: ${command.destination}`); | ||
} | ||
mv(command.source, command.destination, { mkdirp: this.options.moveWithMkdirp }, (err) => { | ||
if (err && this.options.verbose) { | ||
console.log(' - FileManagerPlugin: Error - move failed', err); | ||
if (err) { | ||
if(this.options.verbose) { | ||
console.log(' - FileManagerPlugin: Error - move failed', err); | ||
} | ||
reject(err); | ||
@@ -187,3 +194,3 @@ } | ||
if (this.options.verbose) { | ||
console.log(` - FileManagerPlugin: Finished move source: ${command.source} to destination: ${command.destination}`) | ||
console.log(` - FileManagerPlugin: Finished move source: ${command.source} to destination: ${command.destination}`); | ||
} | ||
@@ -190,0 +197,0 @@ |
@@ -25,3 +25,5 @@ const path = require('path'); | ||
{ source: "./dist", destination: "./testing2" }, | ||
{ source: "./dist/bundle.js", destination: "./newfile.js" } | ||
{ source: "./dist/bundle.js", destination: "./newfile.js" }, | ||
{ source: "./dist/bundle.js", destination: "./newfile2.js" }, | ||
{ source: "./dist/bundle.js", destination: "./newfile3.js" } | ||
], | ||
@@ -28,0 +30,0 @@ } |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
38401
503
5
4
+ Addedfs-extra@^4.0.3
+ Addedfs-extra@4.0.3(transitive)
+ Addedjsonfile@4.0.0(transitive)
+ Addedshell-quote@1.8.1(transitive)
+ Addeduniversalify@0.1.2(transitive)
- Removedshell-quote@1.8.2(transitive)