Skip to content

Commit 0ebc25b

Browse files
committed
Merge pull request #34 from doapp-ryanp/patch-2
Replace wrench with node-fs-extra
2 parents 9509e06 + 9af3b89 commit 0ebc25b

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

index.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ module.exports = function(S) {
88

99
const path = require('path'),
1010
_ = require('lodash'),
11-
fs = require('fs'),
11+
fs = require('fs-extra'),
1212
browserify = require('browserify'),
1313
UglifyJS = require('uglify-js'),
14-
wrench = require('wrench'),
1514
BbPromise = require('bluebird');
1615

1716
/**
@@ -270,16 +269,11 @@ module.exports = function(S) {
270269
let destPath = path.join(_this.optimizedDistPath, p);
271270

272271
if (fs.lstatSync(p).isDirectory()) {
273-
wrench.mkdirSyncRecursive(destPath, '0777');
274-
wrench.copyDirSyncRecursive(
275-
path.join(_this.evt.options.pathDist, p),
276-
destPath, {
277-
forceDelete: true
278-
}
279-
);
272+
fs.mkdirsSync(destPath, '0777');
273+
fs.copySync(path.join(_this.evt.options.pathDist, p), destPath, {clobber: true, dereference: true});
280274
} else {
281-
wrench.mkdirSyncRecursive(path.dirname(destPath), '0777');
282-
S.utils.writeFileSync(destPath, S.utils.readFileSync(p));
275+
fs.mkdirsSync(path.dirname(destPath), '0777');
276+
fs.copySync(p, destPath, {clobber: true, dereference: true});
283277
}
284278
});
285279
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "serverless-optimizer-plugin",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"engines": {
55
"node": ">=4.0"
66
},
@@ -41,6 +41,6 @@
4141
"browserify": "^13.0.0",
4242
"lodash": "^4.0.0",
4343
"uglify-js": "^2.6.1",
44-
"wrench": "^1.5.8"
44+
"fs-extra": "~0.26.7"
4545
}
4646
}

0 commit comments

Comments
 (0)