@@ -16,7 +16,8 @@ type DownloadCommandArgs = {
1616 repo : string ,
1717 release : "latest" | string ,
1818 arch ?: string ,
19- nodeTarget ?: string
19+ nodeTarget ?: string ,
20+ skipBuild ?: boolean
2021} ;
2122
2223export const DownloadCommand : CommandModule < object , DownloadCommandArgs > = {
@@ -41,12 +42,17 @@ export const DownloadCommand: CommandModule<object, DownloadCommandArgs> = {
4142 . option ( "nodeTarget" , {
4243 type : "string" ,
4344 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"
4450 } ) ;
4551 } ,
4652 handler : DownloadLlamaCppCommand
4753} ;
4854
49- export async function DownloadLlamaCppCommand ( { repo, release, arch, nodeTarget} : DownloadCommandArgs ) {
55+ export async function DownloadLlamaCppCommand ( { repo, release, arch, nodeTarget, skipBuild } : DownloadCommandArgs ) {
5056 const octokit = new Octokit ( ) ;
5157 const [ githubOwner , githubRepo ] = repo . split ( "/" ) ;
5258
@@ -124,13 +130,6 @@ export async function DownloadLlamaCppCommand({repo, release, arch, nodeTarget}:
124130 await unzipLlamaReleaseZipFile ( path . join ( tempDownloadDirectory , "llama.cpp.zip" ) , llamaCppDirectory ) ;
125131 } ) ;
126132
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-
134133 await withOra ( {
135134 loading : chalk . blue ( "Removing temporary files" ) ,
136135 success : chalk . blue ( "Removed temporary files" ) ,
@@ -139,6 +138,15 @@ export async function DownloadLlamaCppCommand({repo, release, arch, nodeTarget}:
139138 await clearTempFolder ( ) ;
140139 } ) ;
141140
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+
142150 console . log ( ) ;
143151 console . log ( ) ;
144152 console . log ( `${ chalk . yellow ( "Repo:" ) } ${ repo } ` ) ;
0 commit comments