Commit 2e0db62b authored by Joe Lutz's avatar Joe Lutz Committed by Tim Neutkens

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 :/
parent d5208389
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
"loader-utils": "0.2.16", "loader-utils": "0.2.16",
"minimist": "1.2.0", "minimist": "1.2.0",
"mkdirp-then": "1.2.0", "mkdirp-then": "1.2.0",
"mv": "^2.1.1",
"mz": "2.6.0", "mz": "2.6.0",
"path-match": "1.2.4", "path-match": "1.2.4",
"pkg-up": "1.0.0", "pkg-up": "1.0.0",
......
import { rename } from 'mz/fs' import mv from 'mv'
import { join } from 'path' import { join } from 'path'
export default async function replaceCurrentBuild (dir, buildDir) { export default async function replaceCurrentBuild (dir, buildDir) {
...@@ -7,10 +7,15 @@ export default async function replaceCurrentBuild (dir, buildDir) { ...@@ -7,10 +7,15 @@ export default async function replaceCurrentBuild (dir, buildDir) {
const oldDir = join(buildDir, '.next.old') const oldDir = join(buildDir, '.next.old')
try { try {
await rename(_dir, oldDir) await move(_dir, oldDir)
} catch (err) { } catch (err) {
if (err.code !== 'ENOENT') throw err if (err.code !== 'ENOENT') throw err
} }
await rename(_buildDir, _dir) await move(_buildDir, _dir)
return oldDir return oldDir
} }
function move (from, to) {
return new Promise((resolve, reject) =>
mv(from, to, err => err ? reject(err) : resolve()))
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment