fix(core.gbapp): Fix in deploy.

This commit is contained in:
Rodrigo Rodriguez 2020-04-03 09:58:14 -03:00
parent c6d3086fa0
commit 9d5d754d92
2 changed files with 22 additions and 25 deletions

View file

@ -528,27 +528,23 @@ export class GBDeployer implements IGBDeployer {
}
}
folder = Path.join(e, 'dist');
if (!Fs.existsSync()) {
try {
GBLog.info(`process.env.GBAPP_DISABLE_COMPILE: ${process.env.GBAPP_DISABLE_COMPILE}`);
if (process.env.GBAPP_DISABLE_COMPILE !== "true" && false) {
child_process.execSync(Path.join(process.env.PWD, 'node_modules/.bin/tsc'), { cwd: e });
}
const m = await import(e);
const p = new m.Package();
p.loadPackage(core, core.sequelize);
appPackages.push(p);
GBLog.info(`App (.gbapp) deployed: ${e}.`);
appPackagesProcessed++;
} catch (error) {
GBLog.error(`Error compiling .gbapp package ${e}:\n${error.stdout.toString()}`);
appPackagesProcessed++;
try {
if (process.env.GBAPP_DISABLE_COMPILE !== "true") {
GBLog.info(`Compiling .gbapp: ${e}.`);
child_process.execSync(Path.join(process.env.PWD, 'node_modules/.bin/tsc'), { cwd: e });
}
const m = await import(e);
const p = new m.Package();
p.loadPackage(core, core.sequelize);
appPackages.push(p);
GBLog.info(`App (.gbapp) deployed: ${e}.`);
appPackagesProcessed++;
} catch (error) {
GBLog.error(`Error compiling .gbapp package ${e}:\n${error.stdout.toString()}`);
appPackagesProcessed++;
}
} else {
appPackagesProcessed++;
}
});

View file

@ -209,7 +209,7 @@ export class GBMinService {
// this.deployer.deployPackage(min, 'packages/default.gbdialog');
// Call the loadBot context.activity for all packages.
await this.invokeLoadBot(GBServer.globals.appPackages, GBServer.globals.sysPackages, min);
this.invokeLoadBot(GBServer.globals.appPackages, GBServer.globals.sysPackages, min);
// Serves individual URL for each bot conversational interface...
const url = `/api/messages/${instance.botId}`;
@ -404,7 +404,7 @@ export class GBMinService {
min.scriptMap = {};
min.sandBoxMap = {};
min.packages = sysPackages;
if (min.instance.whatsappServiceKey !== null ) {
if (min.instance.whatsappServiceKey !== null) {
min.whatsAppDirectLine = new WhatsappDirectLine(
min.botId,
min.instance.whatsappBotKey,
@ -424,11 +424,12 @@ export class GBMinService {
return { min, adapter, conversationState };
}
private async invokeLoadBot(appPackages: IGBPackage[], sysPackages: IGBPackage[], min: GBMinInstance) {
await CollectionUtil.asyncForEach(sysPackages, async e => {
private invokeLoadBot(appPackages: IGBPackage[], sysPackages: IGBPackage[], min: GBMinInstance) {
sysPackages.forEach(e => {
e.loadBot(min);
});
await CollectionUtil.asyncForEach(appPackages, async p => {
}, this);
appPackages.forEach(p => {
p.sysPackages = sysPackages;
p.loadBot(min);
if (p.getDialogs !== undefined) {
@ -437,7 +438,7 @@ export class GBMinService {
min.dialogs.add(new WaterfallDialog(dialog.id, dialog.waterfall));
});
}
});
}, this);
}
/**