@@ -100,9 +100,11 @@ export const publishFiles = async (
100
100
}
101
101
}
102
102
await HTMLGenerator . beginBatch ( allFiles ) ;
103
+ RenderLog . progress ( 0 , allFiles . length , "Exporting Docs" , "..." , "var(--color-accent)" ) ;
103
104
let externalFiles : Downloadable [ ] = [ ] ;
104
105
let toUploads : any [ ] = [ ] ;
105
106
107
+ let i = 0 ;
106
108
for ( const path of pathList ) {
107
109
const file = vault . getAbstractFileByPath ( path ) ;
108
110
if ( ! ( file instanceof TFile ) ) {
@@ -111,7 +113,7 @@ export const publishFiles = async (
111
113
}
112
114
log . info ( 'html path: ' , htmlPath , file ) ;
113
115
const htmlFilePath = htmlPath . joinString ( file . name ) . setExtension ( "html" ) ;
114
-
116
+ RenderLog . progress ( i ++ , path . length , "Exporting Docs" , "Exporting: " + file . path , "var(--color-accent)" ) ;
115
117
const exportedFile = await exportFile ( file , new Path ( path ) , true , htmlFilePath , new Path ( settings . localWatchDir ) ) ;
116
118
if ( exportedFile ) {
117
119
toUploads . push ( ...exportedFile . downloads . map ( d => {
@@ -129,16 +131,19 @@ export const publishFiles = async (
129
131
externalFiles . push ( ...exportedFile . downloads ) ;
130
132
}
131
133
}
134
+
135
+
132
136
133
137
externalFiles = externalFiles . filter ( ( file , index ) => externalFiles . findIndex ( ( f ) => f . relativeDownloadPath == file . relativeDownloadPath && f . filename === file . filename ) == index ) ;
134
138
await Utils . downloadFiles ( externalFiles , htmlPath ) ;
135
139
log . info ( 'download files to: ' , htmlPath , externalFiles ) ;
136
- HTMLGenerator . endBatch ( ) ;
137
140
138
141
await sleep ( 200 ) ;
139
142
140
143
try {
141
- const resPromise = toUploads . map ( upload => {
144
+ RenderLog . progress ( 0 , toUploads . length , "Uploading Docs" , "..." , "var(--color-accent)" ) ;
145
+
146
+ const resPromise = toUploads . map ( ( upload , i ) => {
142
147
const htmlFileRelPath = Path . getRelativePathFromVault ( new Path ( upload . path ) , true ) . asString ;
143
148
log . info ( 'rel path: ' , htmlFileRelPath ) ;
144
149
return client . uploadToRemote (
@@ -152,11 +157,17 @@ export const publishFiles = async (
152
157
false ,
153
158
'' ,
154
159
upload . key
155
- ) ;
160
+ ) . then ( ( resp ) => {
161
+ RenderLog . progress ( i ++ , toUploads . length , "Uploading Docs" , "Upload success: " + upload . key , "var(--color-accent)" ) ;
162
+ return resp ;
163
+ } )
156
164
} )
157
165
158
166
await Promise . all ( resPromise ) . then ( result => {
159
167
log . info ( 'upload to remote result: ' , result ) ;
168
+ RenderLog . progress ( toUploads . length , toUploads . length , "Uploading Docs" , "Uploading Done: " , "var(--color-accent)" ) ;
169
+ HTMLGenerator . endBatch ( ) ;
170
+
160
171
const bucket = settings . s3 . s3BucketName ;
161
172
const urls = result . map ( record => `https://${ bucket } .${ settings . s3 . s3Endpoint } /${ record ?. key } ` )
162
173
log . info ( 'url list: ' , urls ) ;
@@ -171,6 +182,7 @@ export const publishFiles = async (
171
182
} )
172
183
} catch ( error ) {
173
184
log . error ( 'exception: ' , error ) ;
185
+ HTMLGenerator . endBatch ( ) ;
174
186
}
175
187
176
188
0 commit comments