Skip to content

Commit

Permalink
refactor: Replace mkdrip with esnureDir from fs-extra
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Sep 10, 2020
1 parent 861686b commit 1beb8d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
10 changes: 4 additions & 6 deletions lib/plugins/aws/invokeLocal/index.js
Expand Up @@ -12,7 +12,7 @@ const spawnExt = require('child-process-ext/spawn');
const { spawn } = require('child_process');
const inspect = require('util').inspect;
const download = require('download');
const mkdirp = require('mkdirp');
const { ensureDir } = require('fs-extra');
const cachedir = require('cachedir');
const decompress = require('decompress');
const dirExists = require('../../../utils/fs/dirExists');
Expand All @@ -22,8 +22,6 @@ const getEnsureArtifact = require('../../../utils/getEnsureArtifact');
const resolveCfImportValue = require('../utils/resolveCfImportValue');
const resolveCfRefValue = require('../utils/resolveCfRefValue');

const mkdirpAsync = BbPromise.promisify(mkdirp);

const cachePath = path.join(cachedir('serverless'), 'invokeLocal');

const ensureRuntimeWrappers = isStandalone
Expand Down Expand Up @@ -339,7 +337,7 @@ class AwsInvokeLocal {
return dirExists(layerContentsCachePath).then(cacheExists => {
if (!cacheExists) {
this.serverless.cli.log(`Downloading layer ${layer}...`);
return mkdirpAsync(path.join(layerContentsCachePath))
return ensureDir(path.join(layerContentsCachePath))
.then(() =>
this.provider.request('Lambda', 'getLayerVersion', {
LayerName: layerArn,
Expand Down Expand Up @@ -395,8 +393,8 @@ class AwsInvokeLocal {
return imageName;
}
return BbPromise.all([
mkdirpAsync(path.join('.serverless', 'invokeLocal', runtime)),
mkdirpAsync(path.join(cachePath, 'dockerfiles', runtime)),
ensureDir(path.join('.serverless', 'invokeLocal', runtime)),
ensureDir(path.join(cachePath, 'dockerfiles', runtime)),
])
.then(() => {
this.serverless.cli.log('Writing Dockerfile...');
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -57,7 +57,6 @@
"lodash": "^4.17.20",
"memoizee": "^0.4.14",
"micromatch": "^4.0.2",
"mkdirp": "^0.5.4",
"ncjsm": "^4.1.0",
"node-fetch": "^2.6.1",
"object-hash": "^2.0.3",
Expand Down

0 comments on commit 1beb8d0

Please sign in to comment.