Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove mkdirp as a dependency #420

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
"chownr": "^3.0.0",
"minipass": "^7.1.2",
"minizlib": "^3.0.1",
"mkdirp": "^3.0.1",
"yallist": "^5.0.0"
},
"devDependencies": {
"chmodr": "^1.2.0",
"end-of-stream": "^1.4.3",
"events-to-array": "^2.0.3",
"mkdirp": "^3.0.1",
benmccann marked this conversation as resolved.
Show resolved Hide resolved
"mutate-fs": "^2.1.1",
"nock": "^13.5.4",
"prettier": "^3.2.5",
Expand Down
10 changes: 5 additions & 5 deletions src/mkdir.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { chownr, chownrSync } from 'chownr'
import fs from 'fs'
import { mkdirp, mkdirpSync } from 'mkdirp'
import fs from 'node:fs'
import fsp from 'node:fs/promises'
import path from 'node:path'
import { CwdError } from './cwd-error.js'
import { normalizeWindowsPath } from './normalize-windows-path.js'
Expand Down Expand Up @@ -48,7 +48,7 @@ const checkCwd = (
}

/**
* Wrapper around mkdirp for tar's needs.
* Wrapper around mkdir for tar's needs.
*
* The main purpose is to avoid creating directories if we know that
* they already exist (and track which ones exist for this purpose),
Expand Down Expand Up @@ -107,7 +107,7 @@ export const mkdir = (
}

if (preserve) {
return mkdirp(dir, { mode }).then(
return fsp.mkdir(dir, { recursive: true, mode }).then(
made => done(null, made ?? undefined), // oh, ts
done,
)
Expand Down Expand Up @@ -252,7 +252,7 @@ export const mkdirSync = (dir: string, opt: MkdirOptions) => {
}

if (preserve) {
return done(mkdirpSync(dir, mode) ?? undefined)
return done(fs.mkdirSync(dir, { recursive: true, mode }) ?? undefined)
}

const sub = normalizeWindowsPath(path.relative(cwd, dir))
Expand Down