where to call install with what

This commit is contained in:
Daniel Hübleitner
2019-08-27 22:20:33 +02:00
parent 1a0191f63d
commit ca378f111e
6 changed files with 63 additions and 2763 deletions
+34
View File
@@ -0,0 +1,34 @@
import * as Logger from 'log4js'
var exec = require('child-process-promise').exec;
Logger.configure({
appenders:
{
"installer": { type: 'stdout' },
//app: { type: 'file', filename: 'application.log' }
},
categories:
{
default: { appenders: [ 'installer' ], level: 'debug' }
}
})
const logger = Logger.getLogger("installer")
export type NPMPkgName = string
export type NPMVersion = string
export const install = (plugins: Plugin[] = [], npmPkgs: [NPMPkgName, NPMVersion][] = []) => {
logger.info("Checking npm dependencies...")
const deps = npmPkgs.map((pkg) => {return pkg[0] + '@' + pkg[1]} )
exec("npm i --prefix ./plugins " + deps.join(' ')).then(process => {
logger.debug(process.stdout)
const Admin = require("./Admin").FrontblockAdmin
new Admin(plugins)
})
}
install([], [['sqlite3', '4.1.0'], ['knex', '0.19.2']])