Skip to content

Commit b31cf24

Browse files
committed
Fix mocking
1 parent daba4cf commit b31cf24

File tree

11 files changed

+69
-47
lines changed

11 files changed

+69
-47
lines changed

__mocks__/cpx.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

__mocks__/make-dir.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

__mocks__/makef.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

__mocks__/next-on-netlify.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1+
const fs = require('fs')
12
const path = require('path')
3+
const util = require('util')
4+
25
const nextOnNetlify = require('next-on-netlify')
36
const { PHASE_PRODUCTION_BUILD } = require('next/constants')
47
const { default: loadConfig } = require('next/dist/next-server/server/config')
5-
const makef = require('makef')
68
const makeDir = require('make-dir')
79
const pathExists = require('path-exists')
810
const cpx = require('cpx')
11+
912
const isStaticExportProject = require('./helpers/isStaticExportProject')
1013

14+
const pWriteFile = util.promisify(fs.writeFile)
15+
1116
// * Helpful Plugin Context *
1217
// - Between the prebuild and build steps, the project's build command is run
1318
// - Between the build and postbuild steps, any functions are bundled
@@ -64,7 +69,7 @@ module.exports = {
6469
target: 'serverless'
6570
}
6671
`
67-
makef.createFile({ 'next.config.js': nextConfig })
72+
await pWriteFile('next.config.js', nextConfig)
6873
console.log(`** Adding next.config.js with target set to 'serverless' **`)
6974
}
7075
},

package-lock.json

Lines changed: 18 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"dependencies": {
2727
"cpx": "^1.5.0",
2828
"make-dir": "^3.1.0",
29-
"makef": "^1.0.0",
3029
"next": "^9.5.3",
3130
"next-on-netlify": "^2.6.0",
3231
"path-exists": "^4.0.0"
@@ -37,7 +36,8 @@
3736
"jest": "^26.6.1",
3837
"prettier": "^2.1.2",
3938
"react": "^17.0.1",
40-
"react-dom": "^17.0.1"
39+
"react-dom": "^17.0.1",
40+
"tmp-promise": "^3.0.2"
4141
},
4242
"husky": {
4343
"hooks": {

test/fixtures/publish_copy_files/out_publish/subdir/dummy.txt

Whitespace-only changes.

test/fixtures/publish_copy_files/publish/subdir/dummy.txt

Whitespace-only changes.

test/fixtures/publish_copy_files/subdir/dummy.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)