|
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 |
|
@@ -55,7 +53,7 @@ module.exports = {
|
55 | 53 | )
|
56 | 54 | }
|
57 | 55 |
|
58 |
| - const hasNextConfig = await exists('next.config.js') |
| 56 | + const hasNextConfig = await pathExists('next.config.js') |
59 | 57 | if (hasNextConfig) {
|
60 | 58 | // If the next config exists, fail build if target isnt in acceptableTargets
|
61 | 59 | const acceptableTargets = ['serverless', 'experimental-serverless-trace']
|
@@ -84,10 +82,10 @@ module.exports = {
|
84 | 82 |
|
85 | 83 | // TO-DO: use FUNCTIONS_DIST when internal bug is fixed
|
86 | 84 | const { PUBLISH_DIR } = constants
|
87 |
| - // if (!existsSync(FUNCTIONS_DIST)) { |
88 |
| - // await makeDir(FUNCTIONS_DIST); |
| 85 | + // if (!(await pathExists(FUNCTIONS_DIST))) { |
| 86 | + // await makeDir(FUNCTIONS_DIST) |
89 | 87 | // }
|
90 |
| - const hasPublishDir = await exists(PUBLISH_DIR) |
| 88 | + const hasPublishDir = await pathExists(PUBLISH_DIR) |
91 | 89 | if (!hasPublishDir) {
|
92 | 90 | await makeDir(PUBLISH_DIR)
|
93 | 91 | }
|
|
0 commit comments