From e263d8861ba6552976ff2b5bbc3649e99ea25552 Mon Sep 17 00:00:00 2001 From: Rudi Yardley Date: Mon, 9 Mar 2020 14:13:21 +0700 Subject: [PATCH 1/2] Unlink doesnt work on folders --- packages/cli/src/scripts/build.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/scripts/build.ts b/packages/cli/src/scripts/build.ts index 95401bda56..3470f6705b 100644 --- a/packages/cli/src/scripts/build.ts +++ b/packages/cli/src/scripts/build.ts @@ -1,6 +1,6 @@ import {resolve} from 'path' import {synchronizeFiles} from './synchronizer' -import {move, unlink, pathExists} from 'fs-extra' +import {move, remove, pathExists} from 'fs-extra' import {Config, enhance} from './config' import {nextBuild} from './next-utils' @@ -17,6 +17,6 @@ export async function build(config: Config) { const rootNextFolder = resolve(rootFolder, '.next') const buildNextFolder = resolve(buildFolder, '.next') - if (await pathExists(rootNextFolder)) await unlink(rootNextFolder) + if (await pathExists(rootNextFolder)) await remove(rootNextFolder) await move(buildNextFolder, rootNextFolder) } From 6edc5bc7cee9295b83e949f26d17e95755984c7f Mon Sep 17 00:00:00 2001 From: Rudi Yardley Date: Mon, 9 Mar 2020 14:17:14 +0700 Subject: [PATCH 2/2] Mock remove --- packages/cli/test/scripts/build.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli/test/scripts/build.test.ts b/packages/cli/test/scripts/build.test.ts index b383ad3b7f..477691c16a 100644 --- a/packages/cli/test/scripts/build.test.ts +++ b/packages/cli/test/scripts/build.test.ts @@ -5,6 +5,7 @@ const fsExtraMock = { unlink: jest.fn(), ensureDir: jest.fn(), move: jest.fn(), + remove: jest.fn(), pathExists: jest.fn(), }