File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 1
1
TODO:
2
2
3
- - [] copy the template folders
4
- - [] figure out the assets
5
- - [] dependency graph
3
+ - figure out the assets
4
+ - dependency graph
6
5
7
6
DONE:
8
7
8
+ - copy the template folders
9
9
10
10
-----
11
11
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import path from "node:path";
6
6
import { fileURLToPath } from "node:url" ;
7
7
import { cpSync , rmSync } from "node:fs" ;
8
8
9
+ const SAVE_DIR = ".save.next" ;
10
+
9
11
/**
10
12
* Builds the application in a format that can be passed to workerd
11
13
*
@@ -20,15 +22,19 @@ export async function build(
20
22
opts : BuildOptions
21
23
) : Promise < void > {
22
24
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
24
26
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 } ` , {
26
32
recursive : true ,
27
33
} ) ;
28
34
} else {
29
35
// Skip the next build and restore the copy from .next.save
30
36
rmSync ( `${ inputNextAppDir } /.next` , { recursive : true , force : true } ) ;
31
- cpSync ( `${ inputNextAppDir } /save.next ` , `${ inputNextAppDir } /.next` , {
37
+ cpSync ( `${ inputNextAppDir } /${ SAVE_DIR } ` , `${ inputNextAppDir } /.next` , {
32
38
recursive : true ,
33
39
} ) ;
34
40
}
You can’t perform that action at this time.
0 commit comments