Skip to content

Commit

Permalink
CNA: replace make-dir with core recursive mkdir (vercel#15006)
Browse files Browse the repository at this point in the history
Fix vercel#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?
  • Loading branch information
cristiand391 authored and rokinsky committed Jul 11, 2020
1 parent 41a9dd8 commit 242c37f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/create-next-app/create-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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'
Expand Down
8 changes: 8 additions & 0 deletions packages/create-next-app/helpers/make-dir.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import fs from 'fs'

export function makeDir(
root: string,
options = { recursive: true }
): Promise<void> {
return fs.promises.mkdir(root, options)
}
1 change: 0 additions & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 0 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10153,12 +10153,6 @@ magic-string@^0.25.2, magic-string@^0.25.3:
dependencies:
sourcemap-codec "^1.4.4"

[email protected]:
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"
Expand Down

0 comments on commit 242c37f

Please sign in to comment.