77 *
88 * Options:
99 * --dist <path> Path to dist directory (default: ./dist)
10- * --module <name> Convex module with upload functions (default: staticHosting)
10+ * --component <name> Convex component with upload functions (default: staticHosting)
1111 * --domain <domain> Domain for Cloudflare cache purge (auto-detects zone ID)
1212 * --help Show help
1313 */
@@ -47,15 +47,15 @@ function getMimeType(path: string): string {
4747
4848interface ParsedArgs {
4949 dist: string ;
50- module : string ;
50+ component : string ;
5151 domain: string | null ;
5252 help: boolean ;
5353}
5454
5555function parseArgs ( args : string [ ] ) : ParsedArgs {
5656 const result : ParsedArgs = {
5757 dist : "./dist" ,
58- module : "staticHosting" ,
58+ component : "staticHosting" ,
5959 domain : null ,
6060 help : false ,
6161 } ;
@@ -66,8 +66,8 @@ function parseArgs(args: string[]): ParsedArgs {
6666 result . help = true ;
6767 } else if ( arg === "--dist" || arg === "-d" ) {
6868 result . dist = args [ ++ i ] || result . dist ;
69- } else if ( arg === "--module " || arg === "-m " ) {
70- result . module = args [ ++ i ] || result . module ;
69+ } else if ( arg === "--component " || arg === "-c " ) {
70+ result . component = args [ ++ i ] || result . component ;
7171 } else if ( arg === "--domain" ) {
7272 result . domain = args [ ++ i ] || null ;
7373 }
@@ -83,10 +83,10 @@ Usage: npx @get-convex/self-static-hosting upload [options]
8383Upload static files from a dist directory to Convex storage.
8484
8585Options:
86- -d, --dist <path> Path to dist directory (default: ./dist)
87- -m , --module <name> Convex module with upload functions (default: staticHosting)
88- --domain <name> Domain for Cloudflare cache purge (e.g., example.com)
89- -h, --help Show this help message
86+ -d, --dist <path> Path to dist directory (default: ./dist)
87+ -c , --component <name> Convex component with upload functions (default: staticHosting)
88+ --domain <name> Domain for Cloudflare cache purge (e.g., example.com)
89+ -h, --help Show this help message
9090
9191Cloudflare Cache Purging:
9292 The CLI will automatically purge Cloudflare cache if credentials are available.
@@ -277,7 +277,7 @@ async function main(): Promise<void> {
277277 }
278278
279279 const distDir = resolve ( args . dist ) ;
280- const moduleName = args . module ;
280+ const componentName = args . component ;
281281
282282 if ( ! existsSync ( distDir ) ) {
283283 console . error ( `Error: dist directory not found: ${ distDir } ` ) ;
@@ -292,14 +292,14 @@ async function main(): Promise<void> {
292292 console . log (
293293 `Uploading ${ files . length } files with deployment ID: ${ deploymentId } ` ,
294294 ) ;
295- console . log ( `Module : ${ moduleName } ` ) ;
295+ console . log ( `Component : ${ componentName } ` ) ;
296296 console . log ( "" ) ;
297297
298298 for ( const file of files ) {
299299 const content = readFileSync ( file . localPath ) ;
300300
301301 // Get upload URL via internal function
302- const uploadUrlOutput = convexRun ( `${ moduleName } :generateUploadUrl` ) ;
302+ const uploadUrlOutput = convexRun ( `${ componentName } :generateUploadUrl` ) ;
303303 const uploadUrl = JSON . parse ( uploadUrlOutput ) ;
304304
305305 // Upload to storage
@@ -312,7 +312,7 @@ async function main(): Promise<void> {
312312 const { storageId } = ( await response . json ( ) ) as { storageId : string } ;
313313
314314 // Record in database via internal function
315- convexRun ( `${ moduleName } :recordAsset` , {
315+ convexRun ( `${ componentName } :recordAsset` , {
316316 path : file . path ,
317317 storageId,
318318 contentType : file . contentType ,
@@ -325,7 +325,7 @@ async function main(): Promise<void> {
325325 console . log ( "" ) ;
326326
327327 // Garbage collect old files
328- const deletedOutput = convexRun ( `${ moduleName } :gcOldAssets` , {
328+ const deletedOutput = convexRun ( `${ componentName } :gcOldAssets` , {
329329 currentDeploymentId : deploymentId ,
330330 } ) ;
331331 const deleted = JSON . parse ( deletedOutput ) ;
@@ -364,7 +364,7 @@ async function main(): Promise<void> {
364364 console . log ( "☁️ Purging Cloudflare cache..." ) ;
365365 try {
366366 // Use Convex function (useful for CI/CD where you might want logging)
367- convexRun ( `${ moduleName } :purgeCloudflareCache` , {
367+ convexRun ( `${ componentName } :purgeCloudflareCache` , {
368368 zoneId : cloudflareZoneId ,
369369 apiToken : cloudflareApiToken ,
370370 purgeAll : true ,
0 commit comments