fix
This commit is contained in:
@@ -184,5 +184,5 @@ export class FrontblockAdmin extends AdminBase<AdminConf>{
|
|||||||
process.on( 'SIGINT', function() {
|
process.on( 'SIGINT', function() {
|
||||||
logger.info( "Gracefully shutting down from SIGINT (Ctrl-C)" );
|
logger.info( "Gracefully shutting down from SIGINT (Ctrl-C)" );
|
||||||
// some other closing procedures go here
|
// some other closing procedures go here
|
||||||
process.exit( );
|
process.exit(0);
|
||||||
})
|
})
|
||||||
@@ -19,34 +19,17 @@ const logger = Logger.getLogger("installer")
|
|||||||
export type NPMPkgName = string
|
export type NPMPkgName = string
|
||||||
export type NPMVersion = string
|
export type NPMVersion = string
|
||||||
|
|
||||||
export const defaultNodePkgs = ():[NPMPkgName, NPMVersion][] => {
|
export const installAdmin = (plugins: Plugin[] = []) => {
|
||||||
return [
|
|
||||||
['sqlite3', '4.1.0'],
|
|
||||||
['knex', '0.19.2']
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
export const npmInstall = (prefix: string = './plugins') => async (npmPkgs: [NPMPkgName, NPMVersion][]) => {
|
const npmPkgs:[NPMPkgName, NPMVersion][] = [['sqlite3', '4.1.0'], ['knex', '0.19.2']]
|
||||||
const deps = npmPkgs.map(tuple => tuple.join('@') ).join(" ")
|
const deps = npmPkgs.map(tuple => tuple.join('@') ).join(" ")
|
||||||
logger.info('npm install --prefix', prefix, deps)
|
logger.info("Installing plaform dependencies: "+deps)
|
||||||
|
|
||||||
const { error, stdout, stderr } = await exec('npm i --prefix ' + prefix + ' ' + deps)
|
exec("npm i --prefix ./plugins " + deps).then(process => {
|
||||||
|
|
||||||
if (error) throw new Error(stderr)
|
logger.debug(process.stdout)
|
||||||
else logger.info(stdout)
|
const Admin = require("./Admin").FrontblockAdmin
|
||||||
}
|
new Admin(plugins)
|
||||||
|
})
|
||||||
|
|
||||||
export const installAdmin = async (plugins: Plugin[] = []) => {
|
|
||||||
logger.debug('Installing Admin')
|
|
||||||
|
|
||||||
try {
|
|
||||||
await npmInstall()(defaultNodePkgs())
|
|
||||||
logger.info('Installed node dependencies')
|
|
||||||
} catch (error) {
|
|
||||||
logger.fatal('Unable to install node dependencies: ', error)
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Admin = require("./Admin").FrontblockAdmin
|
|
||||||
new Admin(plugins)
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user