From 1beb8d0246e705d3d724dbd2fb4c6639bc961cba Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 3 Sep 2020 10:47:27 +0200 Subject: [PATCH] refactor: Replace mkdrip with esnureDir from fs-extra --- lib/plugins/aws/invokeLocal/index.js | 10 ++++------ package.json | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/plugins/aws/invokeLocal/index.js b/lib/plugins/aws/invokeLocal/index.js index bfe259e0d11..d0e2d473893 100644 --- a/lib/plugins/aws/invokeLocal/index.js +++ b/lib/plugins/aws/invokeLocal/index.js @@ -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'); @@ -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 @@ -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, @@ -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...'); diff --git a/package.json b/package.json index 55309f6ac91..bf0242a8b7a 100644 --- a/package.json +++ b/package.json @@ -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",