Unverified Commit ebcc855a authored by Sukka's avatar Sukka Committed by GitHub

chore: revert back to moving files w/ `fs-extra` (#57030)

Follows #56917, revert back to moving files using `fs-extra`. This should help with the flaky `fs.rename` operation on Windows.

cc @styfle 
parent ab7b0f59
...@@ -2,7 +2,7 @@ import os from 'os' ...@@ -2,7 +2,7 @@ import os from 'os'
import path from 'path' import path from 'path'
import execa from 'execa' import execa from 'execa'
import fs from 'fs' import fs from 'fs'
import fsp from 'fs/promises' import { move } from 'fs-extra'
;(async function () { ;(async function () {
if (process.env.NEXT_SKIP_NATIVE_POSTINSTALL) { if (process.env.NEXT_SKIP_NATIVE_POSTINSTALL) {
console.log( console.log(
...@@ -71,8 +71,7 @@ import fsp from 'fs/promises' ...@@ -71,8 +71,7 @@ import fsp from 'fs/promises'
const from = path.join(tmpdir, 'node_modules/@next', pkg) const from = path.join(tmpdir, 'node_modules/@next', pkg)
const to = path.join(cwd, 'node_modules/@next', pkg) const to = path.join(cwd, 'node_modules/@next', pkg)
// overwriting by removing the target first // overwriting by removing the target first
await fsp.rm(to, { recursive: true, force: true }) return move(from, to, { overwrite: true })
return fsp.rename(from, to)
}) })
) )
fs.rmSync(tmpdir, { recursive: true, force: true }) fs.rmSync(tmpdir, { recursive: true, force: true })
......
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