1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Fix "EXDEV: cross-device link not permitted" error (#1174)

* Fix "EXDEV: cross-device link not permitted" error

* Fix lint errors

Not sure why standard passes in my dev environment, but hopefully this fixes the CI errors.

* Fix logic mistake

Wow, my bad :/
This commit is contained in:
Joe Lutz 2017-02-16 08:16:02 -06:00 committed by Tim Neutkens
parent d5208389be
commit 2e0db62b52
2 changed files with 9 additions and 3 deletions

View file

@ -70,6 +70,7 @@
"loader-utils": "0.2.16",
"minimist": "1.2.0",
"mkdirp-then": "1.2.0",
"mv": "^2.1.1",
"mz": "2.6.0",
"path-match": "1.2.4",
"pkg-up": "1.0.0",

View file

@ -1,4 +1,4 @@
import { rename } from 'mz/fs'
import mv from 'mv'
import { join } from 'path'
export default async function replaceCurrentBuild (dir, buildDir) {
@ -7,10 +7,15 @@ export default async function replaceCurrentBuild (dir, buildDir) {
const oldDir = join(buildDir, '.next.old')
try {
await rename(_dir, oldDir)
await move(_dir, oldDir)
} catch (err) {
if (err.code !== 'ENOENT') throw err
}
await rename(_buildDir, _dir)
await move(_buildDir, _dir)
return oldDir
}
function move (from, to) {
return new Promise((resolve, reject) =>
mv(from, to, err => err ? reject(err) : resolve()))
}