where to call install with what
This commit is contained in:
@@ -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']])
|
||||
Reference in New Issue
Block a user