File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -393,28 +393,31 @@ export async function action(actionArgs: string[]) {
393393 let variantMetadata = variantMetadatas . get ( variant ) ;
394394 if ( variantMetadata != null ) {
395395
396- console . log ( ` 🏃♂️ Asset "${ variantKey } " is identical to an item we already know about, reusing existing copy.` ) ;
396+ if ( verbose ) {
397+ console . log ( ` 🏃♂️ Asset "${ variantKey } " is identical to an item we already know about, reusing existing copy.` ) ;
398+ }
397399
398400 } else {
399401
400402 if ( ! overwriteExisting ) {
401403 const assetVariantMetadata = await storageProvider . getExistingAssetVariant ( variantKey ) ;
402404 if ( assetVariantMetadata != null ) {
403- console . log ( ` ・ Asset found in storage with key "${ variantKey } ".` ) ;
405+ if ( verbose ) {
406+ console . log ( ` ・ Asset found in storage with key "${ variantKey } ".` ) ;
407+ }
404408 // And we already know its hash and size.
405409 variantMetadata = Object . assign ( assetVariantMetadata , { existsInKvStore : true } ) ;
406410 }
407411 }
408412
409413 if ( variantMetadata == null ) {
414+ console . log ( ` ↦ Prepping new asset for storage: "${ variantKey } "` ) ;
410415 await ensureVariantFileExists (
411416 variantFilePath ,
412417 variant ,
413418 file ,
419+ verbose ,
414420 ) ;
415- if ( localMode ) {
416- console . log ( ` ・ Prepping asset for storage with key "${ variantKey } ".` ) ;
417- }
418421
419422 let contentEncoding , hash , size ;
420423 if ( variant === 'original' ) {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export async function ensureVariantFileExists(
1414 variantFilePath : string ,
1515 variant : Variants ,
1616 file : string ,
17+ verbose : boolean ,
1718) {
1819
1920 // Compress/prepare the asset if it doesn't already exist
@@ -23,13 +24,17 @@ export async function ensureVariantFileExists(
2324 if ( variant === 'original' ) {
2425
2526 fs . cpSync ( file , variantFilePath ) ;
26- console . log ( ` 📄→📄 Copied file '${ rootRelative ( file ) } ' to '${ rootRelative ( variantFilePath ) } '.` ) ;
27+ if ( verbose ) {
28+ console . log ( ` 📄→📄 Copied file '${ rootRelative ( file ) } ' to '${ rootRelative ( variantFilePath ) } '.` ) ;
29+ }
2730
2831 } else {
2932
3033 const compressTo = algs [ variant ] ;
3134 await compressTo ( file , variantFilePath ) ;
32- console . log ( ` 📄→🗄️ Compressed file '${ rootRelative ( file ) } ' to '${ rootRelative ( variantFilePath ) } ' [${ variant } ].` ) ;
35+ if ( verbose ) {
36+ console . log ( ` 📄→🗄️ Compressed file '${ rootRelative ( file ) } ' to '${ rootRelative ( variantFilePath ) } ' [${ variant } ].` ) ;
37+ }
3338
3439 }
3540
You can’t perform that action at this time.
0 commit comments