Browse Source

fix

master
Daniel Huebleitner 2 years ago
parent
commit
e3330b634a
2 changed files with 11 additions and 28 deletions
  1. 1
    1
      src/backend/Admin.ts
  2. 10
    27
      src/backend/Installer.ts

+ 1
- 1
src/backend/Admin.ts View File

@@ -184,5 +184,5 @@ export class FrontblockAdmin extends AdminBase<AdminConf>{
184 184
 process.on( 'SIGINT', function() {
185 185
     logger.info( "Gracefully shutting down from SIGINT (Ctrl-C)" );
186 186
     // some other closing procedures go here
187
-    process.exit( );
187
+    process.exit(0);
188 188
 })

+ 10
- 27
src/backend/Installer.ts View File

@@ -19,34 +19,17 @@ const logger = Logger.getLogger("installer")
19 19
 export type NPMPkgName = string
20 20
 export type NPMVersion = string
21 21
 
22
-export const defaultNodePkgs = ():[NPMPkgName, NPMVersion][] => {
23
-    return [
24
-        ['sqlite3', '4.1.0'], 
25
-        ['knex', '0.19.2']
26
-    ]
27
-}
28
-
29
-export const npmInstall = (prefix: string = './plugins') => async (npmPkgs: [NPMPkgName, NPMVersion][]) => {
22
+export const installAdmin = (plugins: Plugin[] = []) => {
23
+    
24
+    const npmPkgs:[NPMPkgName, NPMVersion][] = [['sqlite3', '4.1.0'], ['knex', '0.19.2']]
30 25
     const deps = npmPkgs.map(tuple => tuple.join('@') ).join(" ")
31
-    logger.info('npm install --prefix', prefix, deps)
32
-
33
-    const { error, stdout, stderr } = await exec('npm i --prefix ' + prefix + ' ' + deps)
34
-
35
-    if (error) throw new Error(stderr)
36
-    else logger.info(stdout)
37
-}
26
+    logger.info("Installing plaform dependencies: "+deps)
38 27
 
39
-export const installAdmin = async (plugins: Plugin[] = []) => {
40
-    logger.debug('Installing Admin')
41
-
42
-    try {
43
-        await npmInstall()(defaultNodePkgs())
44
-        logger.info('Installed node dependencies')
45
-    } catch (error) {
46
-        logger.fatal('Unable to install node dependencies: ', error)
47
-        process.exit(1);
48
-    }
28
+    exec("npm i --prefix ./plugins " + deps).then(process => {
29
+    
30
+        logger.debug(process.stdout)    
31
+        const Admin = require("./Admin").FrontblockAdmin
32
+        new Admin(plugins)
33
+    })
49 34
 
50
-    const Admin = require("./Admin").FrontblockAdmin
51
-    new Admin(plugins)
52 35
 }

Loading…
Cancel
Save