|
1 |
| -const fs = require('fs') |
2 |
| -const { promisify } = require('util') |
3 |
| -const exists = promisify(fs.exists) |
4 | 1 | const path = require('path')
|
5 | 2 | const nextOnNetlify = require('next-on-netlify')
|
6 | 3 | const { PHASE_PRODUCTION_BUILD } = require('next/constants')
|
7 | 4 | const { default: loadConfig } = require('next/dist/next-server/server/config')
|
8 | 5 | const makef = require('makef')
|
9 | 6 | const makeDir = require('make-dir')
|
| 7 | +const pathExists = require('path-exists') |
10 | 8 | const cpx = require('cpx')
|
11 | 9 | const isStaticExportProject = require('./helpers/isStaticExportProject')
|
12 | 10 |
|
@@ -54,7 +52,7 @@ module.exports = {
|
54 | 52 | )
|
55 | 53 | }
|
56 | 54 |
|
57 |
| - const hasNextConfig = await exists('next.config.js') |
| 55 | + const hasNextConfig = await pathExists('next.config.js') |
58 | 56 | if (hasNextConfig) {
|
59 | 57 | // If the next config exists, fail build if target isnt in acceptableTargets
|
60 | 58 | const acceptableTargets = ['serverless', 'experimental-serverless-trace']
|
@@ -83,10 +81,10 @@ module.exports = {
|
83 | 81 |
|
84 | 82 | // TO-DO: use FUNCTIONS_DIST when internal bug is fixed
|
85 | 83 | 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) |
88 | 86 | // }
|
89 |
| - const hasPublishDir = await exists(PUBLISH_DIR) |
| 87 | + const hasPublishDir = await pathExists(PUBLISH_DIR) |
90 | 88 | if (!hasPublishDir) {
|
91 | 89 | await makeDir(PUBLISH_DIR)
|
92 | 90 | }
|
|
0 commit comments