Skip to content

Commit 8166471

Browse files
committed
Fix deprecated method
1 parent 2849dc5 commit 8166471

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

index.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
const fs = require('fs')
2-
const { promisify } = require('util')
3-
const exists = promisify(fs.exists)
41
const path = require('path')
52
const nextOnNetlify = require('next-on-netlify')
63
const { PHASE_PRODUCTION_BUILD } = require('next/constants')
74
const { default: loadConfig } = require('next/dist/next-server/server/config')
85
const makef = require('makef')
96
const makeDir = require('make-dir')
7+
const pathExists = require('path-exists')
108
const cpx = require('cpx')
119
const isStaticExportProject = require('./helpers/isStaticExportProject')
1210

@@ -54,7 +52,7 @@ module.exports = {
5452
)
5553
}
5654

57-
const hasNextConfig = await exists('next.config.js')
55+
const hasNextConfig = await pathExists('next.config.js')
5856
if (hasNextConfig) {
5957
// If the next config exists, fail build if target isnt in acceptableTargets
6058
const acceptableTargets = ['serverless', 'experimental-serverless-trace']
@@ -83,10 +81,10 @@ module.exports = {
8381

8482
// TO-DO: use FUNCTIONS_DIST when internal bug is fixed
8583
const { PUBLISH_DIR } = constants
86-
// if (!existsSync(FUNCTIONS_DIST)) {
87-
// await makeDir(FUNCTIONS_DIST);
84+
// if (!(await pathExists(FUNCTIONS_DIST))) {
85+
// await makeDir(FUNCTIONS_DIST)
8886
// }
89-
const hasPublishDir = await exists(PUBLISH_DIR)
87+
const hasPublishDir = await pathExists(PUBLISH_DIR)
9088
if (!hasPublishDir) {
9189
await makeDir(PUBLISH_DIR)
9290
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"make-dir": "^3.1.0",
2929
"makef": "^1.0.0",
3030
"next": "^9.5.3",
31-
"next-on-netlify": "^2.6.0"
31+
"next-on-netlify": "^2.6.0",
32+
"path-exists": "^4.0.0"
3233
},
3334
"devDependencies": {
3435
"@netlify/eslint-config-node": "^0.3.0",

0 commit comments

Comments
 (0)