From 242c37fb34c08657d1d7d94f6bd69d75ca598168 Mon Sep 17 00:00:00 2001 From: Cristian Dominguez <6853656+cristiand391@users.noreply.github.com> Date: Fri, 10 Jul 2020 01:29:03 +0000 Subject: [PATCH] CNA: replace make-dir with core recursive mkdir (#15006) Fix #14902 I created a separated helper that wraps `fs.promises.mkdir` and sets `recursive` option to `true` by default. I'm not sure if this is the right approach (maybe it should just call `fs.promises.mkdir` from `create-app.ts`?), any thoughts? --- packages/create-next-app/create-app.ts | 2 +- packages/create-next-app/helpers/make-dir.ts | 8 ++++++++ packages/create-next-app/package.json | 1 - yarn.lock | 6 ------ 4 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 packages/create-next-app/helpers/make-dir.ts diff --git a/packages/create-next-app/create-app.ts b/packages/create-next-app/create-app.ts index ea95986e676457..a180c9f631ec59 100644 --- a/packages/create-next-app/create-app.ts +++ b/packages/create-next-app/create-app.ts @@ -3,7 +3,6 @@ import retry from 'async-retry' import chalk from 'chalk' import cpy from 'cpy' import fs from 'fs' -import makeDir from 'make-dir' import os from 'os' import path from 'path' import { @@ -14,6 +13,7 @@ import { hasRepo, RepoInfo, } from './helpers/examples' +import { makeDir } from './helpers/make-dir' import { tryGitInit } from './helpers/git' import { install } from './helpers/install' import { isFolderEmpty } from './helpers/is-folder-empty' diff --git a/packages/create-next-app/helpers/make-dir.ts b/packages/create-next-app/helpers/make-dir.ts new file mode 100644 index 00000000000000..00bfed2eb42ac0 --- /dev/null +++ b/packages/create-next-app/helpers/make-dir.ts @@ -0,0 +1,8 @@ +import fs from 'fs' + +export function makeDir( + root: string, + options = { recursive: true } +): Promise { + return fs.promises.mkdir(root, options) +} diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 77b613a1e7063f..1f3b4fbc0f263e 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -40,7 +40,6 @@ "cpy": "7.3.0", "cross-spawn": "6.0.5", "got": "10.7.0", - "make-dir": "3.0.0", "prompts": "2.1.0", "rimraf": "3.0.0", "tar": "4.4.10", diff --git a/yarn.lock b/yarn.lock index a6034f06acfc71..5a65dc5e203aed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10153,12 +10153,6 @@ magic-string@^0.25.2, magic-string@^0.25.3: dependencies: sourcemap-codec "^1.4.4" -make-dir@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.0.0.tgz#1b5f39f6b9270ed33f9f054c5c0f84304989f801" - dependencies: - semver "^6.0.0" - make-dir@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c"