diff --git a/frontend.js b/frontend.js index 35ca436..6c35c1a 100644 --- a/frontend.js +++ b/frontend.js @@ -111,7 +111,7 @@ export class Frontend { } let prevCount = 0 while (this.tasks.count > prevCount) { - prevCount = this.tasks.count + prevCount = this.tasks.length await Promise.all(this.tasks) } } diff --git a/server.js b/server.js index e9bec63..9736982 100644 --- a/server.js +++ b/server.js @@ -43,11 +43,6 @@ export class Server { apiBaseUrl: this.giteaApiBaseUrl, }) const promises = [] - promises.push(server.frontend.loadRepo( - 'macchiato', - 'pages', - {srcPath: [], destPath: []} - )) const repos = [ 'loader', 'editor', @@ -65,7 +60,37 @@ export class Server { {srcPath: [], destPath: [repo]} )) } + promises.push(server.frontend.loadRepo( + 'macchiato', + 'pages', + {srcPath: [], destPath: []} + )) + promises.push(server.frontend.loadRepo( + 'macchiato', + 'server', + { + srcPath: [], + destPath: ['server'], + ref: 'shared-server' + } + )) await Promise.all(promises) + this.frontend.files['/app.js'] = ( + this.frontend.files['/server/app.js'] + ) + this.frontend.files['/'] = ( + this.frontend.files['/index.html'] + ) + const sw = this.frontend.files['/sw.js'] + const commit = ( + this.frontend.files['/server/app.js'].commit + ) + sw.body = ( + new TextEncoder().encode( + new TextDecoder().decode(sw.body) + + `\n// ${commit}\n` + ) + ) } async serveRequest(event) {