externals
This commit is contained in:
@@ -11,8 +11,7 @@ import { promises as fs } from "fs"
|
||||
import { GitUpdater, RepoFolderStatus, } from "./GitUpdater";
|
||||
import * as path from "path"
|
||||
import { UpdateManager } from './UpdateManger';
|
||||
|
||||
const kfs = require("key-file-storage").default('kfs')
|
||||
var exec = require('child-process-promise').exec;
|
||||
|
||||
Logger.configure({
|
||||
appenders:
|
||||
@@ -85,6 +84,7 @@ export class FrontblockAdmin extends ConfigLoader<AdminConf>{
|
||||
|
||||
private async initialize(){
|
||||
await this.updateManager.updateAdmin()
|
||||
await this.updateManager.updatePlatformDependencies()
|
||||
await this.updateManager.updateDashboard()
|
||||
await this.updateManager.updateFrontblockLib()
|
||||
|
||||
@@ -184,7 +184,7 @@ export class FrontblockAdmin extends ConfigLoader<AdminConf>{
|
||||
return
|
||||
}
|
||||
|
||||
let port:number = this.conf.httpPort
|
||||
let port:number = this.getConfig().httpPort
|
||||
this.express = express()
|
||||
this.express.use('/', express.static('static'))
|
||||
|
||||
@@ -240,7 +240,7 @@ export class FrontblockAdmin extends ConfigLoader<AdminConf>{
|
||||
|
||||
private restartWebserver(port:number){
|
||||
this.stopWebserver()
|
||||
kfs[this.name+".conf"] = <AdminConf>{ httpPort: port }
|
||||
this.setConfigKey("httpPort", port)
|
||||
this.startWebserver()
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ import { Plugin, socketioRPC } from "frontblock-generic/Plugin";
|
||||
import { GitUpdater, RepoFolderStatus } from "./GitUpdater";
|
||||
import { FrontblockCherryPicker } from "git-cherrypicker";
|
||||
import * as Logger from 'log4js'
|
||||
import { mkdirSync } from "fs";
|
||||
var exec = require('child-process-promise').exec;
|
||||
|
||||
Logger.configure({
|
||||
appenders:
|
||||
{
|
||||
@@ -61,6 +64,17 @@ export class UpdateManager implements Plugin{
|
||||
}]
|
||||
}
|
||||
|
||||
async updatePlatformDependencies(){
|
||||
|
||||
logger.info("installing npm stuff")
|
||||
const res = await exec('npm install --prefix ./externals knex sqlite3')
|
||||
logger.warn(res.stderr)
|
||||
logger.info(res.stdout)
|
||||
|
||||
//mkdirSync("./test", {recursive:true})
|
||||
//await npmInstallAsync(["sqlite3"], "./test")
|
||||
}
|
||||
|
||||
async updateAdmin(force:boolean = false){
|
||||
this.adminUpdater = new GitUpdater("./dist")
|
||||
let status = await this.adminUpdater.getStatus()
|
||||
@@ -108,7 +122,7 @@ export class UpdateManager implements Plugin{
|
||||
|
||||
|
||||
let str = "../plugins/"+name+"/Plugin"
|
||||
const pluginClass = await import(str)
|
||||
const pluginClass = await eval('require')(str)
|
||||
const pluginObj = new pluginClass.default()
|
||||
await pluginObj.start()
|
||||
this.loadedPlugins[name] = pluginObj
|
||||
|
||||
@@ -1,12 +1,33 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
module.exports = [{
|
||||
mode: 'production',
|
||||
target: "web",
|
||||
|
||||
entry: path.resolve(__dirname, '../../dist/FrontblockLib.js'),
|
||||
entry: path.resolve(__dirname, '../../lib/FrontblockLib.js'),
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../../dist'),
|
||||
filename: 'FrontblockLib.js',
|
||||
}
|
||||
}
|
||||
},{
|
||||
mode: 'production',
|
||||
target: "node",
|
||||
node: {
|
||||
global: true,
|
||||
process: true,
|
||||
__filename: false,
|
||||
__dirname: false,
|
||||
Buffer: true,
|
||||
},
|
||||
externals:[
|
||||
'knex'
|
||||
],
|
||||
optimization: {
|
||||
minimize: false
|
||||
},
|
||||
entry: path.resolve(__dirname, '../../lib/FrontblockAdmin.js'),
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../../dist'),
|
||||
filename: 'FrontblockAdmin.js',
|
||||
}
|
||||
}]
|
||||
Reference in New Issue
Block a user