@@ -6,14 +6,16 @@ import * as path from "path";
66const qs = querystring . parse ( window . location . search . slice ( 1 ) ) ;
77
88let settings : WebBuildSettings ;
9+ let projectWindowId : number ;
910
1011const progress = { index : 0 , total : 0 , errors : 0 } ;
1112const statusElt = document . querySelector ( ".status" ) ;
1213const progressElt = document . querySelector ( "progress" ) as HTMLProgressElement ;
1314const detailsListElt = document . querySelector ( ".details ol" ) as HTMLOListElement ;
1415
15- export default function build ( socket : SocketIOClient . Socket , theSettings : WebBuildSettings , buildPort : number ) {
16+ export default function build ( socket : SocketIOClient . Socket , theSettings : WebBuildSettings , theProjectWindowId : number , buildPort : number ) {
1617 settings = theSettings ;
18+ projectWindowId = theProjectWindowId ;
1719
1820 socket . emit ( "build:project" , ( err : string , buildId : string ) => {
1921 const buildPath = `${ window . location . protocol } //${ window . location . hostname } :${ buildPort } /builds/${ qs . project } /${ buildId } /` ;
@@ -51,14 +53,16 @@ function updateProgress() {
5153
5254 if ( progress . index < progress . total ) {
5355 statusElt . textContent = SupClient . i18n . t ( "builds:web.progress" , { path : settings . outputFolder , index : progress . index , total : progress . total } ) ;
54- } else if ( progress . errors > 0 ) {
55- statusElt . textContent = SupClient . i18n . t ( "builds:web.doneWithErrors" , { path : settings . outputFolder , total : progress . total , errors : progress . errors } ) ;
5656 } else {
57- statusElt . textContent = SupClient . i18n . t ( "builds:web.done" , { path : settings . outputFolder , total : progress . total } ) ;
57+ statusElt . textContent = progress . errors > 0 ?
58+ SupClient . i18n . t ( "builds:web.doneWithErrors" , { path : settings . outputFolder , total : progress . total , errors : progress . errors } ) :
59+ SupClient . i18n . t ( "builds:web.done" , { path : settings . outputFolder , total : progress . total } ) ;
60+
61+ SupApp . sendMessage ( projectWindowId , "build-finished" ) ;
5862 }
5963}
6064
61- function downloadFile ( buildPath : string , filePath : string , callback : ErrorCallback ) {
65+ function downloadFile ( buildPath : string , filePath : string , callback : ( err : Error ) => void ) {
6266 const inputPath = `${ buildPath } files/${ filePath } ` ;
6367 const outputPath = path . join ( settings . outputFolder , filePath ) ;
6468
0 commit comments