diff --git a/index.js b/index.js index a64232e..3796fd7 100644 --- a/index.js +++ b/index.js @@ -8,10 +8,9 @@ module.exports = function(S) { const path = require('path'), _ = require('lodash'), - fs = require('fs'), + fs = require('fs-extra'), browserify = require('browserify'), UglifyJS = require('uglify-js'), - wrench = require('wrench'), BbPromise = require('bluebird'); /** @@ -270,16 +269,11 @@ module.exports = function(S) { let destPath = path.join(_this.optimizedDistPath, p); if (fs.lstatSync(p).isDirectory()) { - wrench.mkdirSyncRecursive(destPath, '0777'); - wrench.copyDirSyncRecursive( - path.join(_this.evt.options.pathDist, p), - destPath, { - forceDelete: true - } - ); + fs.mkdirsSync(destPath, '0777'); + fs.copySync(path.join(_this.evt.options.pathDist, p), destPath, {clobber: true, dereference: true}); } else { - wrench.mkdirSyncRecursive(path.dirname(destPath), '0777'); - S.utils.writeFileSync(destPath, S.utils.readFileSync(p)); + fs.mkdirsSync(path.dirname(destPath), '0777'); + fs.copySync(p, destPath, {clobber: true, dereference: true}); } }); } diff --git a/package.json b/package.json index 81a4ff7..0fcacc3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "serverless-optimizer-plugin", - "version": "2.1.0", + "version": "2.1.1", "engines": { "node": ">=4.0" }, @@ -41,6 +41,6 @@ "browserify": "^13.0.0", "lodash": "^4.0.0", "uglify-js": "^2.6.1", - "wrench": "^1.5.8" + "fs-extra": "~0.26.7" } }