Skip to content

Commit f372d62

Browse files
committed
save .next output
1 parent 9303340 commit f372d62

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

TODO.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
TODO:
22

3-
- [] copy the template folders
4-
- [] figure out the assets
5-
- [] dependency graph
3+
- figure out the assets
4+
- dependency graph
65

76
DONE:
87

8+
- copy the template folders
99

1010
-----
1111

builder/src/build/index.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import path from "node:path";
66
import { fileURLToPath } from "node:url";
77
import { cpSync, rmSync } from "node:fs";
88

9+
const SAVE_DIR = ".save.next";
10+
911
/**
1012
* Builds the application in a format that can be passed to workerd
1113
*
@@ -20,15 +22,19 @@ export async function build(
2022
opts: BuildOptions
2123
): Promise<void> {
2224
if (!opts.skipBuild) {
23-
// Build the next app and save a copy in .next.save
25+
// Build the next app and save a copy in .save.next
2426
buildNextjsApp(inputNextAppDir);
25-
cpSync(`${inputNextAppDir}/.next`, `${inputNextAppDir}/save.next`, {
27+
rmSync(`${inputNextAppDir}/${SAVE_DIR}`, {
28+
recursive: true,
29+
force: true,
30+
});
31+
cpSync(`${inputNextAppDir}/.next`, `${inputNextAppDir}/${SAVE_DIR}`, {
2632
recursive: true,
2733
});
2834
} else {
2935
// Skip the next build and restore the copy from .next.save
3036
rmSync(`${inputNextAppDir}/.next`, { recursive: true, force: true });
31-
cpSync(`${inputNextAppDir}/save.next`, `${inputNextAppDir}/.next`, {
37+
cpSync(`${inputNextAppDir}/${SAVE_DIR}`, `${inputNextAppDir}/.next`, {
3238
recursive: true,
3339
});
3440
}

0 commit comments

Comments
 (0)