@@ -16,7 +16,8 @@ type DownloadCommandArgs = {
16
16
repo : string ,
17
17
release : "latest" | string ,
18
18
arch ?: string ,
19
- nodeTarget ?: string
19
+ nodeTarget ?: string ,
20
+ skipBuild ?: boolean
20
21
} ;
21
22
22
23
export const DownloadCommand : CommandModule < object , DownloadCommandArgs > = {
@@ -41,12 +42,17 @@ export const DownloadCommand: CommandModule<object, DownloadCommandArgs> = {
41
42
. option ( "nodeTarget" , {
42
43
type : "string" ,
43
44
description : "The Node.js version to compile llama.cpp for. Example: v18.0.0"
45
+ } )
46
+ . option ( "skipBuild" , {
47
+ type : "boolean" ,
48
+ default : false ,
49
+ description : "Skip building llama.cpp after downloading it"
44
50
} ) ;
45
51
} ,
46
52
handler : DownloadLlamaCppCommand
47
53
} ;
48
54
49
- export async function DownloadLlamaCppCommand ( { repo, release, arch, nodeTarget} : DownloadCommandArgs ) {
55
+ export async function DownloadLlamaCppCommand ( { repo, release, arch, nodeTarget, skipBuild } : DownloadCommandArgs ) {
50
56
const octokit = new Octokit ( ) ;
51
57
const [ githubOwner , githubRepo ] = repo . split ( "/" ) ;
52
58
@@ -124,13 +130,6 @@ export async function DownloadLlamaCppCommand({repo, release, arch, nodeTarget}:
124
130
await unzipLlamaReleaseZipFile ( path . join ( tempDownloadDirectory , "llama.cpp.zip" ) , llamaCppDirectory ) ;
125
131
} ) ;
126
132
127
- console . log ( chalk . blue ( "Compiling llama.cpp" ) ) ;
128
- await compileLlamaCpp ( {
129
- arch : arch ? arch : undefined ,
130
- nodeTarget : nodeTarget ? nodeTarget : undefined ,
131
- setUsedBingFlag : true
132
- } ) ;
133
-
134
133
await withOra ( {
135
134
loading : chalk . blue ( "Removing temporary files" ) ,
136
135
success : chalk . blue ( "Removed temporary files" ) ,
@@ -139,6 +138,15 @@ export async function DownloadLlamaCppCommand({repo, release, arch, nodeTarget}:
139
138
await clearTempFolder ( ) ;
140
139
} ) ;
141
140
141
+ if ( ! skipBuild ) {
142
+ console . log ( chalk . blue ( "Compiling llama.cpp" ) ) ;
143
+ await compileLlamaCpp ( {
144
+ arch : arch ? arch : undefined ,
145
+ nodeTarget : nodeTarget ? nodeTarget : undefined ,
146
+ setUsedBingFlag : true
147
+ } ) ;
148
+ }
149
+
142
150
console . log ( ) ;
143
151
console . log ( ) ;
144
152
console . log ( `${ chalk . yellow ( "Repo:" ) } ${ repo } ` ) ;
0 commit comments