Skip to content

Commit

Permalink
fix(core.gbapp): Fix in deploy.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Apr 3, 2020
1 parent c6d3086 commit 9d5d754
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 25 deletions.
32 changes: 14 additions & 18 deletions packages/core.gbapp/services/GBDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
});

Expand Down
15 changes: 8 additions & 7 deletions packages/core.gbapp/services/GBMinService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down Expand Up @@ -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,
Expand All @@ -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) {
Expand All @@ -437,7 +438,7 @@ export class GBMinService {
min.dialogs.add(new WaterfallDialog(dialog.id, dialog.waterfall));
});
}
});
}, this);
}

/**
Expand Down

0 comments on commit 9d5d754

Please sign in to comment.