Skip to content

Commit

Permalink
fix(core.gbapp): Just compile what has been changed.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Dec 26, 2021
1 parent 55fdcbb commit df6f146
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
5 changes: 3 additions & 2 deletions packages/core.gbapp/services/GBConversationalService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,9 @@ export class GBConversationalService {
}

public async sendEvent(min: GBMinInstance, step: GBDialogStep, name: string, value: Object): Promise<any> {
if (step.context.activity.channelId === 'webchat') {
GBLog.info(`Sending event ${name}:${typeof value === 'object' ? JSON.stringify(value) : value} to client...`);
if (!this.userMobile(step)) {
GBLog.info(`Sending event ${name}:${typeof value === 'object' ? JSON.stringify(value) :
value?value:''} to client...`);
const msg = MessageFactory.text('');
msg.value = value;
msg.type = 'event';
Expand Down
30 changes: 23 additions & 7 deletions packages/core.gbapp/services/GBDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,11 +500,27 @@ export class GBDeployer implements IGBDeployer {
const nextFolder = urlJoin(remotePath, item.name);
await this.downloadFolder(min, localPath, nextFolder);
} else {
GBLog.info(`Downloading ${itemPath}...`);
const url = item['@microsoft.graph.downloadUrl'];

const response = await request({ uri: url, encoding: null });
Fs.writeFileSync(itemPath, response, { encoding: null });
let download = false;

if (Fs.existsSync(itemPath)) {
const dt = Fs.statSync(itemPath);
if (new Date(dt.mtime) < new Date(item.lastModifiedDateTime)) {
download = true;
}
}

if (download) {
GBLog.info(`Downloading ${itemPath}...`);
const url = item['@microsoft.graph.downloadUrl'];

const response = await request({ uri: url, encoding: null });
Fs.writeFileSync(itemPath, response, { encoding: null });
Fs.utimesSync(itemPath,
new Date(), new Date(item.lastModifiedDateTime));
}
else{
GBLog.info(`Local is up to date: ${itemPath}...`);
}
}
});
}
Expand Down Expand Up @@ -811,7 +827,7 @@ export class GBDeployer implements IGBDeployer {
/**
* Servers bot storage assets to be used by web, WhatsApp and other channels.
*/
public static mountGBKBAssets(packageName: any, botId: string, filename: string) {
public static mountGBKBAssets(packageName: any, botId: string, filename: string) {

// Servers menu assets.

Expand All @@ -833,7 +849,7 @@ export class GBDeployer implements IGBDeployer {
express.static(urlJoin('work', gbaiName, filename, 'videos')));
GBServer.globals.server.use(`/${botId}/cache`,
express.static(urlJoin('work', gbaiName, 'cache')));
GBServer.globals.server.use(`/${gbaiName}/${botId}.gbdata/public`,
GBServer.globals.server.use(`/${gbaiName}/${botId}.gbdata/public`,
express.static(urlJoin('work', gbaiName, `${botId}.gbdata`, 'public')));


Expand Down
3 changes: 2 additions & 1 deletion packages/whatsapp.gblib/services/WhatsappDirectLine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export class WhatsappDirectLine extends GBService {
return; // Exit here.
}

if (message.chatName.charAt(0) !== '+') {
if (message.chatName.charAt(0) !== '+') {
group = message.chatName;

let botGroupName = this.min.core.getParam<string>(this.min.instance, 'WhatsApp Group Name', null);
Expand All @@ -205,6 +205,7 @@ export class WhatsappDirectLine extends GBService {
botShortcuts.forEach(e2 => {
if (e1 === e2 && !found) {
found = true;
text = text.replace (e2, '');
}
});

Expand Down

0 comments on commit df6f146

Please sign in to comment.