@@ -8,7 +8,13 @@ import { qtHome } from "@nodegui/nodegui/config/qtConfig";
88const cwd = process . cwd ( ) ;
99const deployDirectory = path . resolve ( cwd , "deploy" ) ;
1010const configFile = path . resolve ( deployDirectory , "config.json" ) ;
11- const linuxDeployQtBin = path . resolve ( __dirname , ".." , ".." , "deps" , "linuxdeployqt" ) ;
11+ const linuxDeployQtBin = path . resolve (
12+ __dirname ,
13+ ".." ,
14+ ".." ,
15+ "deps" ,
16+ "linuxdeployqt"
17+ ) ;
1218
1319const copyQode = async ( dest : string ) => {
1420 const qodeBinaryFile = qode . qodePath ;
@@ -18,16 +24,16 @@ const copyQode = async (dest: string) => {
1824
1925const copyAppDist = async ( distPath : string , resourceDir : string ) => {
2026 await fs . copy ( distPath , path . resolve ( resourceDir , "dist" ) , {
21- recursive : true
27+ recursive : true ,
2228 } ) ;
2329} ;
2430
2531function getAllNodeAddons ( dirPath : string ) {
2632 const addonExt = "node" ;
2733 let dir = fs . readdirSync ( dirPath ) ;
2834 return dir
29- . filter ( elm => elm . match ( new RegExp ( `.*\.(${ addonExt } $)` , "ig" ) ) )
30- . map ( eachElement => path . resolve ( dirPath , eachElement ) ) ;
35+ . filter ( ( elm ) => elm . match ( new RegExp ( `.*\.(${ addonExt } $)` , "ig" ) ) )
36+ . map ( ( eachElement ) => path . resolve ( dirPath , eachElement ) ) ;
3137}
3238
3339const addonCommands = ( addonPaths : string [ ] ) : string [ ] => {
@@ -37,12 +43,10 @@ const addonCommands = (addonPaths: string[]): string[] => {
3743 } , [ ] ) ;
3844} ;
3945
40-
4146const runLinuxDeployQt = async ( appName : string , buildDir : string ) => {
42-
4347 const distPath = path . resolve ( buildDir , "dist" ) ;
4448 const allAddons = getAllNodeAddons ( distPath ) ;
45- const LD_LIBRARY_PATH = `${ qtHome } /lib:${ process . env . LD_LIBRARY_PATH } ` ;
49+ const LD_LIBRARY_PATH = `${ qtHome } /lib:${ process . env . LD_LIBRARY_PATH } ` ;
4650
4751 const linuxDeployQt = spawn (
4852 linuxDeployQtBin ,
@@ -52,23 +56,23 @@ const runLinuxDeployQt = async (appName: string, buildDir: string) => {
5256 "-bundle-non-qt-libs" ,
5357 "-appimage" ,
5458 `-qmake=${ path . resolve ( qtHome , "bin" , "qmake" ) } ` ,
55- ...addonCommands ( allAddons )
59+ ...addonCommands ( allAddons ) ,
5660 ] ,
57- { cwd : buildDir , env : { ...process . env , LD_LIBRARY_PATH } }
61+ { cwd : buildDir , env : { ...process . env , LD_LIBRARY_PATH } }
5862 ) ;
5963
6064 return new Promise ( ( resolve , reject ) => {
61- linuxDeployQt . stdout . on ( "data" , function ( data ) {
65+ linuxDeployQt . stdout . on ( "data" , function ( data ) {
6266 console . log ( "stdout: " + data . toString ( ) ) ;
6367 } ) ;
6468
65- linuxDeployQt . stderr . on ( "data" , function ( data ) {
69+ linuxDeployQt . stderr . on ( "data" , function ( data ) {
6670 console . log ( "stderr: " + data . toString ( ) ) ;
6771 } ) ;
6872
69- linuxDeployQt . on ( "exit" , function ( code ) {
73+ linuxDeployQt . on ( "exit" , function ( code ) {
7074 if ( ! code ) {
71- return resolve ( ) ;
75+ return resolve ( true ) ;
7276 }
7377 return reject ( "child process exited with code " + code ) ;
7478 } ) ;
@@ -77,7 +81,7 @@ const runLinuxDeployQt = async (appName: string, buildDir: string) => {
7781
7882export const init = async ( appName : string ) => {
7983 const config = {
80- appName : null
84+ appName : null ,
8185 } ;
8286 const templateDirectory = path . resolve ( __dirname , "../../template/linux" ) ;
8387 const userTemplate = path . resolve ( deployDirectory , "linux" ) ;
@@ -108,5 +112,7 @@ export const pack = async (distPath: string) => {
108112 await copyAppDist ( distPath , buildAppPackage ) ;
109113 console . log ( `running linuxdeployqt` ) ;
110114 await runLinuxDeployQt ( appName , buildAppPackage ) ;
111- console . log ( `Build successful. Find the AppImage at ${ buildAppPackage } . Look for an executable file with extension .AppImage` ) ;
115+ console . log (
116+ `Build successful. Find the AppImage at ${ buildAppPackage } . Look for an executable file with extension .AppImage`
117+ ) ;
112118} ;
0 commit comments