-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
39 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ npm-debug.log | |
|
||
# other | ||
.next | ||
.next-* | ||
|
||
# coverage | ||
.nyc_output | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { resolve } from 'path' | ||
import del from 'del' | ||
|
||
export default function clean (dir, folderName = '.next') { | ||
return del(resolve(dir, folderName)) | ||
export default function clean (dir) { | ||
return del(resolve(dir, '.next')) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
import fs from 'fs' | ||
import path from 'path' | ||
import uuid from 'uuid' | ||
import { rename } from 'mz/fs' | ||
import { join } from 'path' | ||
|
||
export default function replaceCurrentBuild (dir, buildFolder, distFolder) { | ||
const distDir = path.resolve(dir, distFolder) | ||
const buildDir = path.resolve(dir, buildFolder) | ||
const oldDir = path.resolve(dir, `.next-${uuid.v4()}`) | ||
export default async function replaceCurrentBuild (dir, buildDir) { | ||
const _dir = join(dir, '.next') | ||
const _buildDir = join(buildDir, '.next') | ||
const oldDir = join(buildDir, '.next.old') | ||
|
||
return new Promise((resolve, reject) => { | ||
fs.rename(distDir, oldDir, () => { | ||
fs.rename(buildDir, distDir, (err) => { | ||
if (err) return reject(err) | ||
resolve(oldDir) | ||
}) | ||
}) | ||
}) | ||
try { | ||
await rename(_dir, oldDir) | ||
} catch (err) { | ||
if (err.code !== 'ENOENT') throw err | ||
} | ||
await rename(_buildDir, _dir) | ||
return oldDir | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters