Repository: netlify/build
Pull request #4025 (2022-01-11 19:37:24)

chore: remove make-dir and use fs promises
I hope everything LGTY; I did the same as the other projects.

Notes:

1. there are still a few cases of `promisify` in tests but ESLint complains that it's unsupported. My guess is that because the closest fixture package.json doesn't have an engines version, but I wasn't sure so I left those 3-4 cases
2. I'm not sure if the import is what you like. I also removed a couple of (seemingly unneeded) test helper functions
3. I haven't tested this at all (because ava cripples my dev VM), so I'm going to wait for someone to fire up CI :)

---

🎉 Thanks for submitting a pull request! 🎉

#### Summary

Fixes #<replace_with_issue_number>

<!--
Explain the **motivation** for making this change. What existing problem does the pull request solve and how?
-->

---

For us to review and ship your PR efficiently, please perform the following steps:

- [ ] Open a [bug/issue](https://github.com/netlify/build/issues/new/choose) before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you\`re fixing a typo or something that\`s on fire 🔥 (e.g. incident related), you can skip this step.
- [ ] Read the [contribution guidelines](../CONTRIBUTING.md) 📖. This ensures your code follows our style guide and
      passes our tests.
- [ ] Update or add tests (if any source code was changed or added) 🧪
- [ ] Update or add documentation (if features were changed or added) 📝
- [ ] Make sure the status checks below are successful ✅

**A picture of a cute animal (not mandatory, but encouraged)**


ehmicky: That's a huge PR! This is looking good so far, thanks!

Patch:
diff --git a/package-lock.json b/package-lock.json
index b68388f1e..5d8af16ba 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15838,7 +15838,6 @@
         "keep-func-props": "^3.0.0",
         "locate-path": "^6.0.0",
         "log-process-errors": "^6.0.0",
-        "make-dir": "^3.0.2",
         "map-obj": "^4.0.0",
         "memoize-one": "^6.0.0",
         "os-name": "^4.0.1",
@@ -16036,7 +16035,6 @@
         "globby": "^11.0.0",
         "junk": "^3.1.0",
         "locate-path": "^6.0.0",
-        "make-dir": "^3.1.0",
         "move-file": "^2.0.0",
         "path-exists": "^4.0.0",
         "readdirp": "^3.4.0"
@@ -16113,7 +16111,6 @@
         "indent-string": "^4.0.0",
         "is-plain-obj": "^3.0.0",
         "js-yaml": "^4.0.0",
-        "make-dir": "^3.1.0",
         "map-obj": "^4.0.0",
         "netlify": "^10.1.1",
         "netlify-headers-parser": "^6.0.0",
@@ -18014,7 +18011,6 @@
         "keep-func-props": "^3.0.0",
         "locate-path": "^6.0.0",
         "log-process-errors": "^6.0.0",
-        "make-dir": "^3.0.2",
         "map-obj": "^4.0.0",
         "memoize-one": "^6.0.0",
         "moize": "^6.0.0",
@@ -18162,7 +18158,6 @@
         "globby": "^11.0.0",
         "junk": "^3.1.0",
         "locate-path": "^6.0.0",
-        "make-dir": "^3.1.0",
         "move-file": "^2.0.0",
         "path-exists": "^4.0.0",
         "readdirp": "^3.4.0",
@@ -18230,7 +18225,6 @@
         "is-ci": "^3.0.0",
         "is-plain-obj": "^3.0.0",
         "js-yaml": "^4.0.0",
-        "make-dir": "^3.1.0",
         "map-obj": "^4.0.0",
         "netlify": "^10.1.1",
         "netlify-headers-parser": "^6.0.0",
diff --git a/packages/build/package.json b/packages/build/package.json
index e4caf3011..87b9c5be6 100644
--- a/packages/build/package.json
+++ b/packages/build/package.json
@@ -78,7 +78,6 @@
     "keep-func-props": "^3.0.0",
     "locate-path": "^6.0.0",
     "log-process-errors": "^6.0.0",
-    "make-dir": "^3.0.2",
     "map-obj": "^4.0.0",
     "memoize-one": "^6.0.0",
     "os-name": "^4.0.1",
diff --git a/packages/build/src/install/missing.js b/packages/build/src/install/missing.js
index 609ca7e1a..3247e217a 100644
--- a/packages/build/src/install/missing.js
+++ b/packages/build/src/install/missing.js
@@ -1,8 +1,6 @@
-import { writeFile, unlink } from 'fs'
+import { promises as fs } from 'fs'
 import { normalize } from 'path'
-import { promisify } from 'util'
 
-import makeDir from 'make-dir'
 import pathExists from 'path-exists'
 import { isFile } from 'path-type'
 
@@ -10,9 +8,6 @@ import { logInstallMissingPlugins } from '../log/messages/install.js'
 
 import { addExactDependencies } from './main.js'
 
-const pWriteFile = promisify(writeFile)
-const pUnlink = promisify(unlink)
-
 // Automatically install plugins if not already installed.
 // Since this is done under the hood, we always use `npm` with specific `npm`
 // options. We do not allow configure the package manager nor its options.
@@ -45,10 +40,10 @@ const ensureDir = async function (logs, autoPluginsDir) {
   // If `.netlify` exists but is not a directory, we remove it first
   const autoPluginsParent = normalize(`${autoPluginsDir}/..`)
   if (await isFile(autoPluginsParent)) {
-    await pUnlink(autoPluginsParent)
+    await fs.unlink(autoPluginsParent)
   }
 
-  await makeDir(autoPluginsDir)
+  await fs.mkdir(autoPluginsDir, { recursive: true })
 }
 
 // Create a dummy `package.json` so we can run `npm install` and get a lock file
@@ -59,7 +54,7 @@ const createPackageJson = async function (autoPluginsDir) {
   }
 
   const packageJsonContent = JSON.stringify(AUTO_PLUGINS_PACKAGE_JSON, null, 2)
-  await pWriteFile(packageJsonPath, packageJsonContent)
+  await fs.writeFile(packageJsonPath, packageJsonContent)
 }
 
 const AUTO_PLUGINS_PACKAGE_JSON = {
diff --git a/packages/build/src/log/messages/mutations.js b/packages/build/src/log/messages/mutations.js
index cc82b1f28..f14efea60 100644
--- a/packages/build/src/log/messages/mutations.js
+++ b/packages/build/src/log/messages/mutations.js
@@ -1,12 +1,10 @@
-import { readFile } from 'fs'
-import { inspect, promisify } from 'util'
+import { promises as fs } from 'fs'
+import { inspect } from 'util'
 
 import pathExists from 'path-exists'
 
 import { log, logMessage, logSubHeader } from '../logger.js'
 
-const pReadFile = promisify(readFile)
-
 export const logConfigMutations = function (logs, newConfigMutations, debug) {
   const configMutationsToLog = debug ? newConfigMutations : newConfigMutations.filter(shouldLogConfigMutation)
   configMutationsToLog.forEach(({ keysString, value }) => {
@@ -47,7 +45,7 @@ export const logConfigOnUpload = async function ({ logs, configPath, debug }) {
     return
   }
 
-  const configContents = await pReadFile(configPath, 'utf8')
+  const configContents = await fs.readFile(configPath, 'utf8')
   logMessage(logs, configContents.trim())
 }
 
@@ -63,7 +61,7 @@ export const logHeadersOnUpload = async function ({ logs, headersPath, debug })
     return
   }
 
-  const headersContents = await pReadFile(headersPath, 'utf8')
+  const headersContents = await fs.readFile(headersPath, 'utf8')
   logMessage(logs, headersContents.trim())
 }
 
@@ -79,6 +77,6 @@ export const logRedirectsOnUpload = async function ({ logs, redirectsPath, debug
     return
   }
 
-  const redirectsContents = await pReadFile(redirectsPath, 'utf8')
+  const redirectsContents = await fs.readFile(redirectsPath, 'utf8')
   logMessage(logs, `${redirectsContents.trim()}\n`)
 }
diff --git a/packages/build/src/plugins/manifest/load.js b/packages/build/src/plugins/manifest/load.js
index 153c6f37f..2a93e54c6 100644
--- a/packages/build/src/plugins/manifest/load.js
+++ b/packages/build/src/plugins/manifest/load.js
@@ -1,5 +1,4 @@
-import { readFile } from 'fs'
-import { promisify } from 'util'
+import { promises as fs } from 'fs'
 
 import { load as loadYaml, JSON_SCHEMA } from 'js-yaml'
 
@@ -7,8 +6,6 @@ import { addErrorInfo } from '../../error/info.js'
 
 import { validateManifest } from './validate.js'
 
-const pReadFile = promisify(readFile)
-
 // Load "manifest.yml" using its file path
 export const loadManifest = async function ({ manifestPath, packageName, pluginPackageJson, loadedFrom, origin }) {
   try {
@@ -28,7 +25,7 @@ export const loadManifest = async function ({ manifestPath, packageName, pluginP
 
 const loadRawManifest = async function (manifestPath) {
   try {
-    return await pReadFile(manifestPath, 'utf8')
+    return await fs.readFile(manifestPath, 'utf8')
   } catch (error) {
     error.message = `Could not load plugin's "manifest.yml"\n${error.message}`
     throw error
diff --git a/packages/cache-utils/package.json b/packages/cache-utils/package.json
index 3b744c3de..8c3608a4d 100644
--- a/packages/cache-utils/package.json
+++ b/packages/cache-utils/package.json
@@ -51,7 +51,6 @@
     "globby": "^11.0.0",
     "junk": "^3.1.0",
     "locate-path": "^6.0.0",
-    "make-dir": "^3.1.0",
     "move-file": "^2.0.0",
     "path-exists": "^4.0.0",
     "readdirp": "^3.4.0"
diff --git a/packages/cache-utils/src/manifest.js b/packages/cache-utils/src/manifest.js
index d752e59cf..5aafbdaa7 100644
--- a/packages/cache-utils/src/manifest.js
+++ b/packages/cache-utils/src/manifest.js
@@ -1,17 +1,12 @@
-import { writeFile, readFile } from 'fs'
+import { promises as fs } from 'fs'
 import { dirname } from 'path'
-import { promisify } from 'util'
 
 import del from 'del'
-import makeDir from 'make-dir'
 import pathExists from 'path-exists'
 
 import { getExpires, checkExpires } from './expire.js'
 import { getHash } from './hash.js'
 
-const pWriteFile = promisify(writeFile)
-const pReadFile = promisify(readFile)
-
 // Retrieve cache manifest of a file to cache, which contains the file/directory
 // contents hash and the `expires` date.
 export const getManifestInfo = async function ({ cachePath, move, ttl, digests }) {
@@ -30,14 +25,14 @@ const isIdentical = async function ({ hash, manifestPath, manifestString }) {
     return false
   }
 
-  const oldManifestString = await pReadFile(manifestPath, 'utf8')
+  const oldManifestString = await fs.readFile(manifestPath, 'utf8')
   return oldManifestString === manifestString
 }
 
 // Persist the cache manifest to filesystem
 export const writeManifest = async function ({ manifestPath, manifestString }) {
-  await makeDir(dirname(manifestPath))
-  await pWriteFile(manifestPath, manifestString)
+  await fs.mkdir(dirname(manifestPath), { recursive: true })
+  await fs.writeFile(manifestPath, manifestString)
 }
 
 // Remove the cache manifest from filesystem
@@ -70,7 +65,7 @@ export const isExpired = async function (cachePath) {
 
 const readManifest = async function (cachePath) {
   const manifestPath = getManifestPath(cachePath)
-  const manifestString = await pReadFile(manifestPath, 'utf8')
+  const manifestString = await fs.readFile(manifestPath)
   const manifest = JSON.parse(manifestString)
   return manifest
 }
diff --git a/packages/config/package.json b/packages/config/package.json
index 3e052d34e..27c3932df 100644
--- a/packages/config/package.json
+++ b/packages/config/package.json
@@ -63,7 +63,6 @@
     "indent-string": "^4.0.0",
     "is-plain-obj": "^3.0.0",
     "js-yaml": "^4.0.0",
-    "make-dir": "^3.1.0",
     "map-obj": "^4.0.0",
     "netlify": "^10.1.1",
     "netlify-headers-parser": "^6.0.0",
diff --git a/packages/config/src/bin/main.js b/packages/config/src/bin/main.js
index 5e0e60ea0..6915cb829 100755
--- a/packages/config/src/bin/main.js
+++ b/packages/config/src/bin/main.js
@@ -1,12 +1,10 @@
 #!/usr/bin/env node
 
-import { writeFile } from 'fs'
+import { promises as fs } from 'fs'
 import { dirname } from 'path'
 import process from 'process'
-import { promisify } from 'util'
 
 import fastSafeStringify from 'fast-safe-stringify'
-import makeDir from 'make-dir'
 import omit from 'omit.js'
 
 import { isUserError } from '../error.js'
@@ -14,8 +12,6 @@ import { resolveConfig } from '../main.js'
 
 import { parseFlags } from './flags.js'
 
-const pWriteFile = promisify(writeFile)
-
 // CLI entry point
 const runCli = async function () {
   try {
@@ -45,8 +41,8 @@ const outputResult = async function (resultJson, output) {
     return
   }
 
-  await makeDir(dirname(output))
-  await pWriteFile(output, resultJson)
+  await fs.mkdir(dirname(output), { recursive: true })
+  await fs.writeFile(output, resultJson)
 }
 
 // `api` is not JSON-serializable, so we remove it
diff --git a/packages/config/src/cached_config.js b/packages/config/src/cached_config.js
index 33e23ba23..4268445f8 100644
--- a/packages/config/src/cached_config.js
+++ b/packages/config/src/cached_config.js
@@ -1,7 +1,4 @@
-import { readFile } from 'fs'
-import { promisify } from 'util'
-
-const pReadFile = promisify(readFile)
+import { promises as fs } from 'fs'
 
 // Performance optimization when @netlify/config caller has already previously
 // called it and cached the result.
@@ -27,6 +24,6 @@ const parseCachedConfig = async function (cachedConfig, cachedConfigPath) {
   }
 
   if (cachedConfigPath !== undefined) {
-    return JSON.parse(await pReadFile(cachedConfigPath, 'utf8'))
+    return JSON.parse(await fs.readFile(cachedConfigPath))
   }
 }
diff --git a/packages/config/src/mutations/update.js b/packages/config/src/mutations/update.js
index efb015e9c..82fdaffc1 100644
--- a/packages/config/src/mutations/update.js
+++ b/packages/config/src/mutations/update.js
@@ -1,7 +1,5 @@
-import { writeFile, unlink, copyFile } from 'fs'
-import { promisify } from 'util'
+import { promises as fs } from 'fs'
 
-import makeDir from 'make-dir'
 import pathExists from 'path-exists'
 
 import { ensureConfigPriority } from '../context.js'
@@ -14,10 +12,6 @@ import { serializeToml } from '../utils/toml.js'
 
 import { applyMutations } from './apply.js'
 
-const pWriteFile = promisify(writeFile)
-const pUnlink = promisify(unlink)
-const pCopyFile = promisify(copyFile)
-
 // Persist configuration changes to `netlify.toml`.
 // If `netlify.toml` does not exist, creates it. Otherwise, merges the changes.
 export const updateConfig = async function (
@@ -52,7 +46,7 @@ const mergeWithConfig = async function (normalizedInlineConfig, configPath) {
 // Serialize the changes to `netlify.toml`
 const saveConfig = async function (configPath, simplifiedConfig) {
   const serializedConfig = serializeToml(simplifiedConfig)
-  await pWriteFile(configPath, serializedConfig)
+  await fs.writeFile(configPath, serializedConfig)
 }
 
 // Deletes `_headers/_redirects` since they are merged to `netlify.toml`,
@@ -62,7 +56,7 @@ const deleteSideFile = async function (filePath) {
     return
   }
 
-  await pUnlink(filePath)
+  await fs.unlink(filePath)
 }
 
 // Modifications to `netlify.toml` and `_headers/_redirects` are only meant for
@@ -71,7 +65,7 @@ const deleteSideFile = async function (filePath) {
 // We do this by backing them up inside some sibling directory.
 const backupConfig = async function ({ buildDir, configPath, headersPath, redirectsPath }) {
   const tempDir = getTempDir(buildDir)
-  await makeDir(tempDir)
+  await fs.mkdir(tempDir, { recursive: true })
   await Promise.all([
     backupFile(configPath, `${tempDir}/netlify.toml`),
     backupFile(headersPath, `${tempDir}/_headers`),
@@ -104,18 +98,18 @@ const backupFile = async function (original, backup) {
     return
   }
 
-  await pCopyFile(original, backup)
+  await fs.copyFile(original, backup)
 }
 
 const deleteNoError = async (path) => {
   try {
-    await pUnlink(path)
+    await fs.unlink(path)
   } catch {}
 }
 
 const copyOrDelete = async function (src, dest) {
   if (await pathExists(src)) {
-    await pCopyFile(src, dest)
+    await fs.copyFile(src, dest)
     return
   }
 
diff --git a/packages/config/src/options/base.js b/packages/config/src/options/base.js
index 55b06e431..819a9a2e7 100644
--- a/packages/config/src/options/base.js
+++ b/packages/config/src/options/base.js
@@ -1,11 +1,8 @@
-import { realpath } from 'fs'
+import { promises as fs } from 'fs'
 import { dirname, relative, sep } from 'path'
-import { promisify } from 'util'
 
 import pathExists from 'path-exists'
 
-const pRealpath = promisify(realpath)
-
 // Retrieve `base` override.
 // This uses any directory below `repositoryRoot` and above (or equal to)
 // `cwd` that has a `.netlify` or `netlify.toml`. This allows Netlify CLI users
@@ -17,7 +14,7 @@ export const getBaseOverride = async function ({ repositoryRoot, cwd }) {
     return {}
   }
 
-  const [repositoryRootA, cwdA] = await Promise.all([pRealpath(repositoryRoot), pRealpath(cwd)])
+  const [repositoryRootA, cwdA] = await Promise.all([fs.realpath(repositoryRoot), fs.realpath(cwd)])
   const basePaths = getBasePaths(repositoryRootA, cwdA)
   const basePath = await locatePath(basePaths)
 
diff --git a/packages/config/src/parse.js b/packages/config/src/parse.js
index d6301ff41..5c69ba5ea 100644
--- a/packages/config/src/parse.js
+++ b/packages/config/src/parse.js
@@ -1,5 +1,4 @@
-import { readFile } from 'fs'
-import { promisify } from 'util'
+import { promises as fs } from 'fs'
 
 import pathExists from 'path-exists'
 
@@ -7,8 +6,6 @@ import { throwUserError } from './error.js'
 import { throwOnInvalidTomlSequence } from './log/messages.js'
 import { parseToml } from './utils/toml.js'
 
-const pReadFile = promisify(readFile)
-
 // Load the configuration file and parse it (TOML)
 export const parseConfig = async function (configPath) {
   if (configPath === undefined) {
@@ -47,7 +44,7 @@ const readConfigPath = async function (configPath) {
 // Reach the configuration file's raw content
 const readConfig = async function (configPath) {
   try {
-    return await pReadFile(configPath, 'utf8')
+    return await fs.readFile(configPath, 'utf8')
   } catch (error) {
     throwUserError('Could not read configuration file', error)
   }


Test patch:
diff --git a/packages/build/tests/core/tests.js b/packages/build/tests/core/tests.js
index 4ecaa4775..159a2150a 100644
--- a/packages/build/tests/core/tests.js
+++ b/packages/build/tests/core/tests.js
@@ -1,7 +1,6 @@
-import { unlink, writeFile } from 'fs'
+import { promises as fs } from 'fs'
 import { join } from 'path'
 import { kill, platform } from 'process'
-import { promisify } from 'util'
 
 import test from 'ava'
 import getNode from 'get-node'
@@ -17,9 +16,6 @@ import { removeDir } from '../helpers/dir.js'
 import { runFixture, FIXTURES_DIR } from '../helpers/main.js'
 import { startServer } from '../helpers/server.js'
 
-const pWriteFile = promisify(writeFile)
-const pUnlink = promisify(unlink)
-
 test('--help', async (t) => {
   await runFixture(t, '', { flags: { help: true }, useBinary: true })
 })
@@ -150,7 +146,7 @@ test('--cachedConfigPath CLI flag', async (t) => {
     })
     await runFixture(t, 'cached_config', { flags: { cachedConfigPath, context: 'test' }, useBinary: true })
   } finally {
-    await pUnlink(cachedConfigPath)
+    await fs.unlink(cachedConfigPath)
   }
 })
 
@@ -164,10 +160,10 @@ test('--cachedConfigPath', async (t) => {
   const cachedConfigPath = await tmpName()
   try {
     const { returnValue } = await runFixtureConfig(t, 'cached_config', { snapshot: false })
-    await pWriteFile(cachedConfigPath, returnValue)
+    await fs.writeFile(cachedConfigPath, returnValue)
     await runFixture(t, 'cached_config', { flags: { cachedConfigPath, context: 'test' } })
   } finally {
-    await pUnlink(cachedConfigPath)
+    await fs.unlink(cachedConfigPath)
   }
 })
 
diff --git a/packages/build/tests/functions/tests.js b/packages/build/tests/functions/tests.js
index 9155cf36c..13865d398 100644
--- a/packages/build/tests/functions/tests.js
+++ b/packages/build/tests/functions/tests.js
@@ -1,5 +1,4 @@
-import { writeFile, readdir } from 'fs'
-import { promisify } from 'util'
+import { promises as fs } from 'fs'
 
 import test from 'ava'
 import del from 'del'
@@ -9,9 +8,6 @@ import { removeDir } from '../helpers/dir.js'
 import { runFixture, FIXTURES_DIR } from '../helpers/main.js'
 import { getTempName } from '../helpers/temp.js'
 
-const pWriteFile = promisify(writeFile)
-const pReaddir = promisify(readdir)
-
 test('Functions: missing source directory', async (t) => {
   await runFixture(t, 'missing')
 })
@@ -42,7 +38,7 @@ test('Functions: invalid package.json', async (t) => {
   const packageJsonPath = `${FIXTURES_DIR}/${fixtureName}/package.json`
   // We need to create that file during tests. Otherwise, ESLint fails when
   // detecting an invalid *.json file.
-  await pWriteFile(packageJsonPath, '{{}')
+  await fs.writeFile(packageJsonPath, '{{}')
   try {
     await runFixture(t, fixtureName)
   } finally {
@@ -55,7 +51,7 @@ test('Functions: --functionsDistDir', async (t) => {
   try {
     await runFixture(t, 'simple', { flags: { mode: 'buildbot', functionsDistDir } })
     t.true(await pathExists(functionsDistDir))
-    const files = await pReaddir(functionsDistDir)
+    const files = await fs.readdir(functionsDistDir)
     t.is(files.length, 1)
   } finally {
     await removeDir(functionsDistDir)
diff --git a/packages/build/tests/helpers/temp.js b/packages/build/tests/helpers/temp.js
index fa2af51c7..ed5f4a11c 100644
--- a/packages/build/tests/helpers/temp.js
+++ b/packages/build/tests/helpers/temp.js
@@ -1,22 +1,17 @@
-import { realpath } from 'fs'
+import { promises as fs } from 'fs'
 import { tmpdir } from 'os'
 import { normalize } from 'path'
-import { promisify } from 'util'
-
-import makeDir from 'make-dir'
-
-const pRealpath = promisify(realpath)
 
 // Create and retrieve a new temporary sub-directory
 export const getTempDir = async function () {
   const tempDir = await getTempName()
-  await makeDir(tempDir)
+  await fs.mkdir(tempDir, { recursive: true })
   return tempDir
 }
 
 export const getTempName = async function () {
   const tempDir = tmpdir()
-  const tempDirA = await pRealpath(tempDir)
+  const tempDirA = await fs.realpath(tempDir)
   const id = String(Math.random()).replace('.', '')
   const tempName = normalize(`${tempDirA}/netlify-build-tmp-dir${id}`)
   return tempName
diff --git a/packages/build/tests/mutate_headers_redirects/fixtures/headers_before/plugin.js b/packages/build/tests/mutate_headers_redirects/fixtures/headers_before/plugin.js
index 9439664a3..2668ac044 100644
--- a/packages/build/tests/mutate_headers_redirects/fixtures/headers_before/plugin.js
+++ b/packages/build/tests/mutate_headers_redirects/fixtures/headers_before/plugin.js
@@ -1,8 +1,5 @@
-import { copyFile } from 'fs'
+import { promises as fs } from 'fs'
 import { fileURLToPath } from 'url'
-import { promisify } from 'util'
-
-const pCopyFile = promisify(copyFile)
 
 const fixtureHeadersPath = fileURLToPath(new URL('headers_file', import.meta.url))
 const headersPath = fileURLToPath(new URL('_headers', import.meta.url))
@@ -13,7 +10,7 @@ export default {
     netlifyConfig.headers = [...netlifyConfig.headers, { for: '/path', values: { test: 'two' } }]
   },
   async onBuild() {
-    await pCopyFile(fixtureHeadersPath, headersPath)
+    await fs.copyFile(fixtureHeadersPath, headersPath)
   },
   onPostBuild({ netlifyConfig: { headers } }) {
     console.log(headers)
diff --git a/packages/build/tests/mutate_headers_redirects/fixtures/headers_command/command.js b/packages/build/tests/mutate_headers_redirects/fixtures/headers_command/command.js
index c4092ef9c..7fe309c5d 100644
--- a/packages/build/tests/mutate_headers_redirects/fixtures/headers_command/command.js
+++ b/packages/build/tests/mutate_headers_redirects/fixtures/headers_command/command.js
@@ -1,13 +1,10 @@
-import { writeFile } from 'fs'
+import { promises as fs } from 'fs'
 import { fileURLToPath } from 'url'
-import { promisify } from 'util'
-
-const pWriteFile = promisify(writeFile)
 
 const headersPath = fileURLToPath(new URL('_headers', import.meta.url))
 
 const buildCommand = async function () {
-  await pWriteFile(headersPath, '/path\n  test: one')
+  await fs.writeFile(headersPath, '/path\n  test: one')
 }
 
 buildCommand()
diff --git a/packages/build/tests/mutate_headers_redirects/fixtures/headers_command_dynamic/command.js b/packages/build/tests/mutate_headers_redirects/fixtures/headers_command_dynamic/command.js
index 61d950212..7feec9e8c 100644
--- a/packages/build/tests/mutate_headers_redirects/fixtures/headers_command_dynamic/command.js
+++ b/packages/build/tests/mutate_headers_redirects/fixtures/headers_command_dynamic/command.js
@@ -1,13 +1,10 @@
-import { writeFile } from 'fs'
+import { promises as fs } from 'fs'
 import { fileURLToPath } from 'url'
-import { promisify } from 'util'
-
-const pWriteFile = promisify(writeFile)
 
 const headersPath = fileURLToPath(new URL('test/_headers', import.meta.url))
 
 const buildCommand = async function () {
-  await pWriteFile(headersPath, '/path\n  test: one')
+  await fs.writeFile(headersPath, '/path\n  test: one')
 }
 
 buildCommand()
diff --git a/packages/build/tests/mutate_headers_redirects/fixtures/headers_plugin/plugin.js b/packages/build/tests/mutate_headers_redirects/fixtures/headers_plugin/plugin.js
index 207a52d6e..b8115c843 100644
--- a/packages/build/tests/mutate_headers_redirects/fixtures/headers_plugin/plugin.js
+++ b/packages/build/tests/mutate_headers_redirects/fixtures/headers_plugin/plugin.js
@@ -1,12 +1,9 @@
-import { writeFile } from 'fs'
-import { promisify } from 'util'
-
-const pWriteFile = promisify(writeFile)
+import { promises as fs } from 'fs'
 
 export default {
   async onPreBuild({ netlifyConfig: { headers }, constants: { PUBLISH_DIR } }) {
     console.log(headers)
-    await pWriteFile(`${PUBLISH_DIR}/_headers`, '/path\n  test: one')
+    await fs.writeFile(`${PUBLISH_DIR}/_headers`, '/path\n  test: one')
   },
   onBuild({ netlifyConfig: { headers } }) {
     console.log(headers)
diff --git a/packages/build/tests/mutate_headers_redirects/fixtures/headers_plugin_dynamic/plugin.js b/packages/build/tests/mutate_headers_redirects/fixtures/headers_plugin_dynamic/plugin.js
index 1f57e242d..7c6bfabd0 100644
--- a/packages/build/tests/mutate_headers_redirects/fixtures/headers_plugin_dynamic/plugin.js
+++ b/packages/build/tests/mutate_headers_redirects/fixtures/headers_plugin_dynamic/plugin.js
@@ -1,7 +1,4 @@
-import { writeFile } from 'fs'
-import { promisify } from 'util'
-
-const pWriteFile = promisify(writeFile)
+import { promises as fs } from 'fs'
 
 export default {
   onPreBuild({ netlifyConfig }) {
@@ -11,7 +8,7 @@ export default {
   async onBuild({ netlifyConfig: { headers }, constants: { PUBLISH_DIR } }) {
     console.log(headers)
     console.log(PUBLISH_DIR)
-    await pWriteFile(`${PUBLISH_DIR}/_headers`, '/path\n  test: one')
+    await fs.writeFile(`${PUBLISH_DIR}/_headers`, '/path\n  test: one')
   },
   onPostBuild({ netlifyConfig: { headers } }) {
     console.log(headers)
diff --git a/packages/build/tests/mutate_headers_redirects/fixtures/redirects_before/plugin.js b/packages/build/tests/mutate_headers_redirects/fixtures/redirects_before/plugin.js
index 07835a012..7e32a23a8 100644
--- a/packages/build/tests/mutate_headers_redirects/fixtures/redirects_before/plugin.js
+++ b/packages/build/tests/mutate_headers_redirects/fixtures/redirects_before/plugin.js
@@ -1,8 +1,5 @@
-import { copyFile } from 'fs'
+import { promises as fs } from 'fs'
 import { fileURLToPath } from 'url'
-import { promisify } from 'util'
-
-const pCopyFile = promisify(copyFile)
 
 const fixtureRedirectsPath = fileURLToPath(new URL('redirects_file', import.meta.url))
 const redirectsPath = fileURLToPath(new URL('_redirects', import.meta.url))
@@ -13,7 +10,7 @@ export default {
     netlifyConfig.redirects = [...netlifyConfig.redirects, { from: '/three', to: '/four' }]
   },
   async onBuild() {
-    await pCopyFile(fixtureRedirectsPath, redirectsPath)
+    await fs.copyFile(fixtureRedirectsPath, redirectsPath)
   },
   onPostBuild({ netlifyConfig: { redirects } }) {
     console.log(redirects)
diff --git a/packages/build/tests/mutate_headers_redirects/fixtures/redirects_command/command.js b/packages/build/tests/mutate_headers_redirects/fixtures/redirects_command/command.js
index 42a7fbda1..d7221b341 100644
--- a/packages/build/tests/mutate_headers_redirects/fixtures/redirects_command/command.js
+++ b/packages/build/tests/mutate_headers_redirects/fixtures/redirects_command/command.js
@@ -1,13 +1,10 @@
-import { writeFile } from 'fs'
+import { promises as fs } from 'fs'
 import { fileURLToPath } from 'url'
-import { promisify } from 'util'
-
-const pWriteFile = promisify(writeFile)
 
 const redirectsPath = fileURLToPath(new URL('_redirects', import.meta.url))
 
 const buildCommand = async function () {
-  await pWriteFile(redirectsPath, '/from /to')
+  await fs.writeFile(redirectsPath, '/from /to')
 }
 
 buildCommand()
diff --git a/packages/build/tests/mutate_headers_redirects/fixtures/redirects_command_dynamic/command.js b/packages/build/tests/mutate_headers_redirects/fixtures/redirects_command_dynamic/command.js
index f6ac25aab..a048f18a9 100644
--- a/packages/build/tests/mutate_headers_redirects/fixtures/redirects_command_dynamic/command.js
+++ b/packages/build/tests/mutate_headers_redirects/fixtures/redirects_command_dynamic/command.js
@@ -1,13 +1,10 @@
-import { writeFile } from 'fs'
+import { promises as fs } from 'fs'
 import { fileURLToPath } from 'url'
-import { promisify } from 'util'
-
-const pWriteFile = promisify(writeFile)
 
 const redirectsPath = fileURLToPath(new URL('test/_redirects', import.meta.url))
 
 const buildCommand = async function () {
-  await pWriteFile(redirectsPath, '/from /to')
+  await fs.writeFile(redirectsPath, '/from /to')
 }
 
 buildCommand()
diff --git a/packages/build/tests/mutate_headers_redirects/fixtures/redirects_plugin/plugin.js b/packages/build/tests/mutate_headers_redirects/fixtures/redirects_plugin/plugin.js
index 85b6ce387..810169e07 100644
--- a/packages/build/tests/mutate_headers_redirects/fixtures/redirects_plugin/plugin.js
+++ b/packages/build/tests/mutate_headers_redirects/fixtures/redirects_plugin/plugin.js
@@ -1,12 +1,9 @@
-import { writeFile } from 'fs'
-import { promisify } from 'util'
-
-const pWriteFile = promisify(writeFile)
+import { promises as fs } from 'fs'
 
 export default {
   async onPreBuild({ netlifyConfig: { redirects }, constants: { PUBLISH_DIR } }) {
     console.log(redirects)
-    await pWriteFile(`${PUBLISH_DIR}/_redirects`, '/from /to')
+    await fs.writeFile(`${PUBLISH_DIR}/_redirects`, '/from /to')
   },
   onBuild({ netlifyConfig: { redirects } }) {
     console.log(redirects)
diff --git a/packages/build/tests/mutate_headers_redirects/fixtures/redirects_plugin_dynamic/plugin.js b/packages/build/tests/mutate_headers_redirects/fixtures/redirects_plugin_dynamic/plugin.js
index f72668292..03339bd97 100644
--- a/packages/build/tests/mutate_headers_redirects/fixtures/redirects_plugin_dynamic/plugin.js
+++ b/packages/build/tests/mutate_headers_redirects/fixtures/redirects_plugin_dynamic/plugin.js
@@ -1,7 +1,4 @@
-import { writeFile } from 'fs'
-import { promisify } from 'util'
-
-const pWriteFile = promisify(writeFile)
+import { promises as fs } from 'fs'
 
 export default {
   onPreBuild({ netlifyConfig }) {
@@ -11,7 +8,7 @@ export default {
   async onBuild({ netlifyConfig: { redirects }, constants: { PUBLISH_DIR } }) {
     console.log(redirects)
     console.log(PUBLISH_DIR)
-    await pWriteFile(`${PUBLISH_DIR}/_redirects`, '/from /to')
+    await fs.writeFile(`${PUBLISH_DIR}/_redirects`, '/from /to')
   },
   onPostBuild({ netlifyConfig: { redirects } }) {
     console.log(redirects)
diff --git a/packages/build/tests/mutate_save/fixtures/headers_command_error/command.js b/packages/build/tests/mutate_save/fixtures/headers_command_error/command.js
index cff6a4894..758074a1f 100644
--- a/packages/build/tests/mutate_save/fixtures/headers_command_error/command.js
+++ b/packages/build/tests/mutate_save/fixtures/headers_command_error/command.js
@@ -1,13 +1,10 @@
-import { writeFile } from 'fs'
+import { promises as fs } from 'fs'
 import { fileURLToPath } from 'url'
-import { promisify } from 'util'
-
-const pWriteFile = promisify(writeFile)
 
 const headersPath = fileURLToPath(new URL('_headers', import.meta.url))
 
 const buildCommand = async function () {
-  await pWriteFile(headersPath, 'test: one')
+  await fs.writeFile(headersPath, 'test: one')
 }
 
 buildCommand()
diff --git a/packages/build/tests/mutate_save/fixtures/save_headers/plugin.js b/packages/build/tests/mutate_save/fixtures/save_headers/plugin.js
index 6298abc1c..84c8aae51 100644
--- a/packages/build/tests/mutate_save/fixtures/save_headers/plugin.js
+++ b/packages/build/tests/mutate_save/fixtures/save_headers/plugin.js
@@ -1,8 +1,5 @@
-import { copyFile } from 'fs'
+import { promises as fs } from 'fs'
 import { fileURLToPath } from 'url'
-import { promisify } from 'util'
-
-const pCopyFile = promisify(copyFile)
 
 const fixtureHeadersPath = fileURLToPath(new URL('_headers_file', import.meta.url))
 const headersPath = fileURLToPath(new URL('_headers', import.meta.url))
@@ -13,7 +10,7 @@ export default {
     netlifyConfig.headers = [...netlifyConfig.headers, { for: '/path', values: { test: 'two' } }]
   },
   async onBuild() {
-    await pCopyFile(fixtureHeadersPath, headersPath)
+    await fs.copyFile(fixtureHeadersPath, headersPath)
   },
   onPostBuild({ netlifyConfig: { headers } }) {
     console.log(headers)
diff --git a/packages/build/tests/mutate_save/fixtures/save_redirects/plugin.js b/packages/build/tests/mutate_save/fixtures/save_redirects/plugin.js
index 4e4229ec2..d341f1b62 100644
--- a/packages/build/tests/mutate_save/fixtures/save_redirects/plugin.js
+++ b/packages/build/tests/mutate_save/fixtures/save_redirects/plugin.js
@@ -1,8 +1,5 @@
-import { copyFile } from 'fs'
+import { promises as fs } from 'fs'
 import { fileURLToPath } from 'url'
-import { promisify } from 'util'
-
-const pCopyFile = promisify(copyFile)
 
 const fixtureRedirectsPath = fileURLToPath(new URL('_redirects_file', import.meta.url))
 const redirectsPath = fileURLToPath(new URL('_redirects', import.meta.url))
@@ -13,7 +10,7 @@ export default {
     netlifyConfig.redirects = [...netlifyConfig.redirects, { from: '/one', to: '/two' }]
   },
   async onBuild() {
-    await pCopyFile(fixtureRedirectsPath, redirectsPath)
+    await fs.copyFile(fixtureRedirectsPath, redirectsPath)
   },
   onSuccess({ netlifyConfig }) {
     console.log(netlifyConfig.redirects)
diff --git a/packages/build/tests/mutate_save/tests.js b/packages/build/tests/mutate_save/tests.js
index 97bf24216..e079d2fef 100644
--- a/packages/build/tests/mutate_save/tests.js
+++ b/packages/build/tests/mutate_save/tests.js
@@ -1,6 +1,5 @@
-import { copyFile } from 'fs'
+import { promises as fs } from 'fs'
 import { platform } from 'process'
-import { promisify } from 'util'
 
 import test from 'ava'
 import del from 'del'
@@ -9,8 +8,6 @@ import pathExists from 'path-exists'
 import { runFixture, FIXTURES_DIR } from '../helpers/main.js'
 import { startTcpServer } from '../helpers/tcp_server.js'
 
-const pCopyFile = promisify(copyFile)
-
 const startDeployServer = function (opts = {}) {
   const useUnixSocket = platform !== 'win32'
   return startTcpServer({ useUnixSocket, response: { succeeded: true, ...opts.response }, ...opts })
@@ -22,7 +19,7 @@ test('--saveConfig deletes headers file if headers were changed', async (t) => {
   const configPath = `${fixtureDir}/test_netlify.toml`
   const fixtureHeadersPath = `${fixtureDir}/_headers_file`
   const headersPath = `${fixtureDir}/_headers`
-  await Promise.all([pCopyFile(fixtureConfigPath, configPath), pCopyFile(fixtureHeadersPath, headersPath)])
+  await Promise.all([fs.copyFile(fixtureConfigPath, configPath), fs.copyFile(fixtureHeadersPath, headersPath)])
   const { address, stopServer } = await startDeployServer()
   try {
     try {
@@ -49,7 +46,7 @@ test('--saveConfig deletes headers file if any configuration property was change
   const configPath = `${fixtureDir}/test_netlify.toml`
   const fixtureHeadersPath = `${fixtureDir}/_headers_file`
   const headersPath = `${fixtureDir}/_headers`
-  await Promise.all([pCopyFile(fixtureConfigPath, configPath), pCopyFile(fixtureHeadersPath, headersPath)])
+  await Promise.all([fs.copyFile(fixtureConfigPath, configPath), fs.copyFile(fixtureHeadersPath, headersPath)])
   const { address, stopServer } = await startDeployServer()
   try {
     try {
@@ -75,7 +72,7 @@ test('Erroneous headers created by a build command are handled', async (t) => {
   const fixtureConfigPath = `${fixtureDir}/netlify.toml`
   const configPath = `${fixtureDir}/test_netlify.toml`
   const headersPath = `${fixtureDir}/_headers`
-  await pCopyFile(fixtureConfigPath, configPath)
+  await fs.copyFile(fixtureConfigPath, configPath)
   const { address, stopServer } = await startDeployServer()
   try {
     try {
@@ -102,7 +99,7 @@ test('Erroneous headers created by a plugin are handled', async (t) => {
   const fixtureConfigPath = `${fixtureDir}/netlify.toml`
   const configPath = `${fixtureDir}/test_netlify.toml`
   const headersPath = `${fixtureDir}/_headers`
-  await pCopyFile(fixtureConfigPath, configPath)
+  await fs.copyFile(fixtureConfigPath, configPath)
   const { address, stopServer } = await startDeployServer()
   try {
     try {
@@ -130,7 +127,7 @@ test('--saveConfig deletes redirects file if redirects were changed', async (t)
   const configPath = `${fixtureDir}/test_netlify.toml`
   const fixtureRedirectsPath = `${fixtureDir}/_redirects_file`
   const redirectsPath = `${fixtureDir}/_redirects`
-  await Promise.all([pCopyFile(fixtureConfigPath, configPath), pCopyFile(fixtureRedirectsPath, redirectsPath)])
+  await Promise.all([fs.copyFile(fixtureConfigPath, configPath), fs.copyFile(fixtureRedirectsPath, redirectsPath)])
   const { address, stopServer } = await startDeployServer()
   try {
     try {
@@ -157,7 +154,7 @@ test('--saveConfig deletes redirects file if any configuration property was chan
   const configPath = `${fixtureDir}/test_netlify.toml`
   const fixtureRedirectsPath = `${fixtureDir}/_redirects_file`
   const redirectsPath = `${fixtureDir}/_redirects`
-  await Promise.all([pCopyFile(fixtureConfigPath, configPath), pCopyFile(fixtureRedirectsPath, redirectsPath)])
+  await Promise.all([fs.copyFile(fixtureConfigPath, configPath), fs.copyFile(fixtureRedirectsPath, redirectsPath)])
   const { address, stopServer } = await startDeployServer()
   try {
     try {
@@ -182,7 +179,7 @@ test('--saveConfig saves the configuration changes as netlify.toml', async (t) =
   const fixtureDir = `${FIXTURES_DIR}/save_changes`
   const fixtureConfigPath = `${fixtureDir}/netlify.toml`
   const configPath = `${fixtureDir}/test_netlify.toml`
-  await pCopyFile(fixtureConfigPath, configPath)
+  await fs.copyFile(fixtureConfigPath, configPath)
   const { address, stopServer } = await startDeployServer()
   try {
     await runFixture(t, 'save_changes', {
@@ -203,7 +200,7 @@ test('--saveConfig is required to save the configuration changes as netlify.toml
   const fixtureDir = `${FIXTURES_DIR}/save_none`
   const fixtureConfigPath = `${fixtureDir}/netlify.toml`
   const configPath = `${fixtureDir}/test_netlify.toml`
-  await pCopyFile(fixtureConfigPath, configPath)
+  await fs.copyFile(fixtureConfigPath, configPath)
   const { address, stopServer } = await startDeployServer()
   try {
     await runFixture(t, 'save_none', {
@@ -239,7 +236,7 @@ test('--saveConfig gives higher priority to configuration changes than context p
   const fixtureDir = `${FIXTURES_DIR}/save_context`
   const fixtureConfigPath = `${fixtureDir}/netlify.toml`
   const configPath = `${fixtureDir}/test_netlify.toml`
-  await pCopyFile(fixtureConfigPath, configPath)
+  await fs.copyFile(fixtureConfigPath, configPath)
   const { address, stopServer } = await startDeployServer()
   try {
     await runFixture(t, 'save_context', {
diff --git a/packages/build/tests/plugins_list/tests.js b/packages/build/tests/plugins_list/tests.js
index 2142fe2c6..484a6f7a0 100644
--- a/packages/build/tests/plugins_list/tests.js
+++ b/packages/build/tests/plugins_list/tests.js
@@ -1,5 +1,4 @@
-import { writeFile } from 'fs'
-import { promisify } from 'util'
+import { promises as fs } from 'fs'
 
 import { pluginsList } from '@netlify/plugins-list'
 import test from 'ava'
@@ -9,8 +8,6 @@ import { removeDir } from '../helpers/dir.js'
 import { runFixture, FIXTURES_DIR } from '../helpers/main.js'
 import { startServer } from '../helpers/server.js'
 
-const pWriteFile = promisify(writeFile)
-
 const runWithApiMock = async function (
   t,
   fixtureName,
@@ -105,7 +102,7 @@ test('Can require site dependencies when using .netlify/plugins/', async (t) =>
 
 test('Works with .netlify being a regular file', async (t) => {
   const dotNetlifyFile = `${FIXTURES_DIR}/plugins_cache_regular_file/.netlify`
-  await pWriteFile(dotNetlifyFile, '')
+  await fs.writeFile(dotNetlifyFile, '')
   try {
     await runWithApiMock(t, 'plugins_cache_regular_file')
   } finally {
diff --git a/packages/cache-utils/tests/digests.js b/packages/cache-utils/tests/digests.js
index 335b7d6d1..d24421522 100644
--- a/packages/cache-utils/tests/digests.js
+++ b/packages/cache-utils/tests/digests.js
@@ -1,20 +1,22 @@
+import { promises as fs } from 'fs'
+
 import test from 'ava'
 
 import { save, restore } from '../src/main.js'
 
-import { pWriteFile, pReadFile, createTmpDir, removeFiles } from './helpers/main.js'
+import { createTmpDir, removeFiles } from './helpers/main.js'
 
 test('Should allow caching according to a digest file', async (t) => {
   const [cacheDir, srcDir] = await Promise.all([createTmpDir(), createTmpDir()])
   try {
     const srcFile = `${srcDir}/test`
     const digest = `${srcDir}/digest`
-    await Promise.all([pWriteFile(srcFile, 'test'), pWriteFile(digest, 'digest')])
+    await Promise.all([fs.writeFile(srcFile, 'test'), fs.writeFile(digest, 'digest')])
     t.true(await save(srcDir, { cacheDir, digests: [digest] }))
-    await pWriteFile(srcFile, 'newTest')
+    await fs.writeFile(srcFile, 'newTest')
     t.true(await save(srcDir, { cacheDir, digests: [digest] }))
     t.true(await restore(srcDir, { cacheDir, digests: [digest] }))
-    const content = await pReadFile(srcFile, 'utf8')
+    const content = await fs.readFile(srcFile, 'utf8')
     t.is(content, 'test')
   } finally {
     await removeFiles([cacheDir, srcDir])
@@ -27,12 +29,12 @@ test('Should allow caching according to several potential digests files', async
     const srcFile = `${srcDir}/test`
     const digest = `${srcDir}/digest`
     const digestTwo = `${srcDir}/digestTwo`
-    await Promise.all([pWriteFile(srcFile, 'test'), pWriteFile(digest, 'digest')])
+    await Promise.all([fs.writeFile(srcFile, 'test'), fs.writeFile(digest, 'digest')])
     t.true(await save(srcDir, { cacheDir, digests: [digestTwo, digest] }))
-    await pWriteFile(srcFile, 'newTest')
+    await fs.writeFile(srcFile, 'newTest')
     t.true(await save(srcDir, { cacheDir, digests: [digestTwo, digest] }))
     t.true(await restore(srcDir, { cacheDir, digests: [digestTwo, digest] }))
-    const content = await pReadFile(srcFile, 'utf8')
+    const content = await fs.readFile(srcFile, 'utf8')
     t.is(content, 'test')
   } finally {
     await removeFiles([cacheDir, srcDir])
@@ -44,9 +46,9 @@ test('Should ignore non-existing digests files', async (t) => {
   try {
     const srcFile = `${srcDir}/test`
     const digest = `${srcDir}/digest`
-    await pWriteFile(srcFile, 'test')
+    await fs.writeFile(srcFile, 'test')
     t.true(await save(srcDir, { cacheDir, digests: [digest] }))
-    await pWriteFile(srcFile, 'newTest')
+    await fs.writeFile(srcFile, 'newTest')
     t.true(await save(srcDir, { cacheDir, digests: [digest] }))
   } finally {
     await removeFiles([cacheDir, srcDir])
diff --git a/packages/cache-utils/tests/dir.js b/packages/cache-utils/tests/dir.js
index 699e51f5d..cf2affbd5 100644
--- a/packages/cache-utils/tests/dir.js
+++ b/packages/cache-utils/tests/dir.js
@@ -1,3 +1,4 @@
+import { promises as fs } from 'fs'
 import { cwd as getCwd, chdir } from 'process'
 
 import test from 'ava'
@@ -5,7 +6,7 @@ import pathExists from 'path-exists'
 
 import { save, restore } from '../src/main.js'
 
-import { pWriteFile, pReaddir, createTmpDir, removeFiles } from './helpers/main.js'
+import { createTmpDir, removeFiles } from './helpers/main.js'
 
 test('Should allow changing the cache directory', async (t) => {
   const [cacheDir, srcDir] = await Promise.all([createTmpDir(), createTmpDir()])
@@ -13,9 +14,9 @@ test('Should allow changing the cache directory', async (t) => {
   chdir(srcDir)
   try {
     const srcFile = `${srcDir}/test`
-    await pWriteFile(srcFile, '')
+    await fs.writeFile(srcFile, '')
     t.true(await save(srcFile, { cacheDir }))
-    const cachedFiles = await pReaddir(cacheDir)
+    const cachedFiles = await fs.readdir(cacheDir)
     t.is(cachedFiles.length, 1)
     await removeFiles(srcFile)
     t.true(await restore(srcFile, { cacheDir }))
diff --git a/packages/cache-utils/tests/helpers/main.js b/packages/cache-utils/tests/helpers/main.js
index 5a8c2509b..619466fc1 100644
--- a/packages/cache-utils/tests/helpers/main.js
+++ b/packages/cache-utils/tests/helpers/main.js
@@ -1,4 +1,4 @@
-import { writeFile, readFile, readdir } from 'fs'
+import { promises as fs } from 'fs'
 import { join, basename } from 'path'
 import { promisify } from 'util'
 
@@ -7,9 +7,6 @@ import { dir as getTmpDir, tmpName } from 'tmp-promise'
 
 // TODO: replace with `timers/promises` after dropping Node < 15.0.0
 export const pSetTimeout = promisify(setTimeout)
-export const pWriteFile = promisify(writeFile)
-export const pReadFile = promisify(readFile)
-export const pReaddir = promisify(readdir)
 
 export const createTmpDir = async function (opts) {
   const { path } = await getTmpDir({ ...opts, prefix: PREFIX })
@@ -30,7 +27,7 @@ export const createTmpFiles = async function (files, opts) {
     files.map(async ({ name }) => {
       const filename = name || basename(await tmpName())
       const tmpFile = join(tmpDir, filename)
-      await pWriteFile(tmpFile, '')
+      await fs.writeFile(tmpFile, '')
       return tmpFile
     }),
   )
diff --git a/packages/cache-utils/tests/save_restore.js b/packages/cache-utils/tests/save_restore.js
index fffefe0b7..5102835a2 100644
--- a/packages/cache-utils/tests/save_restore.js
+++ b/packages/cache-utils/tests/save_restore.js
@@ -1,10 +1,11 @@
+import { promises as fs } from 'fs'
+
 import test from 'ava'
-import makeDir from 'make-dir'
 import pathExists from 'path-exists'
 
 import { save, restore, bindOpts, getCacheDir } from '../src/main.js'
 
-import { pWriteFile, pReadFile, createTmpDir, createTmpFile, removeFiles } from './helpers/main.js'
+import { createTmpDir, createTmpFile, removeFiles } from './helpers/main.js'
 
 test('Should expose several methods', (t) => {
   t.is(typeof bindOpts, 'function')
@@ -43,7 +44,7 @@ test('Should cache and restore one directory', async (t) => {
   const [cacheDir, srcDir] = await Promise.all([createTmpDir(), createTmpDir()])
   try {
     const srcFile = `${srcDir}/test`
-    await pWriteFile(srcFile, '')
+    await fs.writeFile(srcFile, '')
     t.true(await save(srcDir, { cacheDir }))
     await removeFiles(srcDir)
     t.true(await restore(srcDir, { cacheDir }))
@@ -56,12 +57,12 @@ test('Should cache and restore one directory', async (t) => {
 test('Should keep file contents when caching files', async (t) => {
   const [cacheDir, [srcFile, srcDir]] = await Promise.all([createTmpDir(), createTmpFile()])
   try {
-    await pWriteFile(srcFile, 'test')
+    await fs.writeFile(srcFile, 'test')
     t.true(await save(srcFile, { cacheDir }))
     await removeFiles(srcFile)
     t.true(await restore(srcFile, { cacheDir }))
     t.true(await pathExists(srcFile))
-    t.is(await pReadFile(srcFile, 'utf8'), 'test')
+    t.is(await fs.readFile(srcFile, 'utf8'), 'test')
   } finally {
     await removeFiles([cacheDir, srcDir])
   }
@@ -70,12 +71,12 @@ test('Should keep file contents when caching files', async (t) => {
 test('Should overwrite files on restore', async (t) => {
   const [cacheDir, [srcFile, srcDir]] = await Promise.all([createTmpDir(), createTmpFile()])
   try {
-    await pWriteFile(srcFile, 'test')
+    await fs.writeFile(srcFile, 'test')
     t.true(await save(srcFile, { cacheDir }))
-    await pWriteFile(srcFile, 'newTest')
+    await fs.writeFile(srcFile, 'newTest')
     t.true(await restore(srcFile, { cacheDir }))
     t.true(await pathExists(srcFile))
-    t.is(await pReadFile(srcFile, 'utf8'), 'test')
+    t.is(await fs.readFile(srcFile, 'utf8'), 'test')
   } finally {
     await removeFiles([cacheDir, srcDir])
   }
@@ -104,7 +105,7 @@ test('Should skip empty directories on restore', async (t) => {
   try {
     const srcDir = 'test'
     const cacheSubDir = `${cacheDir}/cwd/${srcDir}`
-    await makeDir(cacheSubDir)
+    await fs.mkdir(cacheSubDir, { recursive: true })
 
     t.false(await restore(srcDir, { cacheDir }))
   } finally {
@@ -116,7 +117,7 @@ test('Should skip deep empty directories on save', async (t) => {
   const [cacheDir, srcDir] = await Promise.all([createTmpDir(), createTmpDir()])
   try {
     const srcSubDir = `${srcDir}/test`
-    await makeDir(srcSubDir)
+    await fs.mkdir(srcSubDir, { recursive: true })
 
     t.false(await save(srcSubDir, { cacheDir }))
   } finally {
@@ -131,7 +132,7 @@ test('Should skip deep empty directories on restore', async (t) => {
     const srcDir = 'test'
     const srcSubDir = `${srcDir}/test`
     const cacheSubDir = `${cacheDir}/cwd/${srcSubDir}`
-    await makeDir(cacheSubDir)
+    await fs.mkdir(cacheSubDir, { recursive: true })
 
     t.false(await restore(srcDir, { cacheDir }))
   } finally {
diff --git a/packages/config/tests/cli/tests.js b/packages/config/tests/cli/tests.js
index dae952495..953bb3fcc 100644
--- a/packages/config/tests/cli/tests.js
+++ b/packages/config/tests/cli/tests.js
@@ -1,6 +1,5 @@
-import { writeFile, readFile, unlink } from 'fs'
+import { promises as fs } from 'fs'
 import { fileURLToPath } from 'url'
-import { promisify } from 'util'
 
 import test from 'ava'
 import del from 'del'
@@ -11,10 +10,6 @@ import { runFixture, FIXTURES_DIR } from '../helpers/main.js'
 
 const INVALID_CONFIG_PATH = fileURLToPath(new URL('invalid', import.meta.url))
 
-const pWriteFile = promisify(writeFile)
-const pReadFile = promisify(readFile)
-const pUnlink = promisify(unlink)
-
 test('--help', async (t) => {
   await runFixture(t, '', { flags: { help: true }, useBinary: true })
 })
@@ -47,11 +42,11 @@ test('Write on file with the --output flag', async (t) => {
   const output = await getTmpName({ dir: 'netlify-build-test' })
   try {
     await runFixture(t, 'empty', { flags: { output }, useBinary: true, snapshot: false })
-    const content = await pReadFile(output)
+    const content = await fs.readFile(output)
     const { context } = JSON.parse(content)
     t.is(context, 'production')
   } finally {
-    await pUnlink(output)
+    await fs.unlink(output)
   }
 })
 
@@ -61,7 +56,7 @@ test('Do not write on stdout with the --output flag', async (t) => {
     const { returnValue } = await runFixture(t, 'empty', { flags: { output }, useBinary: true, snapshot: false })
     t.is(returnValue, '')
   } finally {
-    await pUnlink(output)
+    await fs.unlink(output)
   }
 })
 
@@ -76,7 +71,7 @@ if (isCI) {
     await del(bigNetlify, { force: true })
     try {
       const bigContent = getBigNetlifyContent()
-      await pWriteFile(bigNetlify, bigContent)
+      await fs.writeFile(bigNetlify, bigContent)
       const { returnValue } = await runFixture(t, 'big', { snapshot: false, useBinary: true })
       t.notThrows(() => {
         JSON.parse(returnValue)
diff --git a/packages/config/tests/load/tests.js b/packages/config/tests/load/tests.js
index 87585f3a7..ab98ce181 100644
--- a/packages/config/tests/load/tests.js
+++ b/packages/config/tests/load/tests.js
@@ -1,7 +1,6 @@
-import { unlink, writeFile } from 'fs'
+import { promises as fs } from 'fs'
 import { relative } from 'path'
 import { cwd } from 'process'
-import { promisify } from 'util'
 
 import test from 'ava'
 import { tmpName } from 'tmp-promise'
@@ -9,9 +8,6 @@ import { tmpName } from 'tmp-promise'
 import { resolveConfig } from '../../src/main.js'
 import { runFixture, FIXTURES_DIR } from '../helpers/main.js'
 
-const pWriteFile = promisify(writeFile)
-const pUnlink = promisify(unlink)
-
 test('Empty configuration', async (t) => {
   await runFixture(t, 'empty')
 })
@@ -142,7 +138,7 @@ test('--cachedConfigPath CLI flag', async (t) => {
     await runFixture(t, 'cached_config', { flags: { output: cachedConfigPath }, snapshot: false, useBinary: true })
     await runFixture(t, 'cached_config', { flags: { cachedConfigPath, context: 'test' }, useBinary: true })
   } finally {
-    await pUnlink(cachedConfigPath)
+    await fs.unlink(cachedConfigPath)
   }
 })
 
@@ -156,10 +152,10 @@ test('--cachedConfigPath', async (t) => {
   const cachedConfigPath = await tmpName()
   try {
     const { returnValue } = await runFixture(t, 'cached_config', { snapshot: false })
-    await pWriteFile(cachedConfigPath, returnValue)
+    await fs.writeFile(cachedConfigPath, returnValue)
     await runFixture(t, 'cached_config', { flags: { cachedConfigPath, context: 'test' } })
   } finally {
-    await pUnlink(cachedConfigPath)
+    await fs.unlink(cachedConfigPath)
   }
 })
 
diff --git a/packages/config/tests/mutate/tests.js b/packages/config/tests/mutate/tests.js
index 345185f65..8511ce3b8 100644
--- a/packages/config/tests/mutate/tests.js
+++ b/packages/config/tests/mutate/tests.js
@@ -1,5 +1,4 @@
-import { copyFile } from 'fs'
-import { promisify } from 'util'
+import { promises as fs } from 'fs'
 
 import test from 'ava'
 import del from 'del'
@@ -8,8 +7,6 @@ import pathExists from 'path-exists'
 import { updateConfig } from '../../src/main.js'
 import { runFixture, FIXTURES_DIR } from '../helpers/main.js'
 
-const pCopyFile = promisify(copyFile)
-
 // Call the main function
 const runUpdateConfig = async function (fixtureName, { configMutations = [buildCommandMutation], ...opts } = {}) {
   const { configPath, headersPath, redirectsPath, buildDir } = await initFixtureDir(fixtureName)
@@ -51,7 +48,7 @@ const initFixtureDir = async function (fixtureName) {
 // directory to use in tests
 const copyIfExists = async function (fixturePath, tempPath) {
   if (await pathExists(fixturePath)) {
-    await pCopyFile(fixturePath, tempPath)
+    await fs.copyFile(fixturePath, tempPath)
     return
   }