Skip to content

Commit

Permalink
Merge branch 'main' into docker-support
Browse files Browse the repository at this point in the history
  • Loading branch information
oz-keisar-d committed Aug 20, 2024
2 parents f735d74 + dc5582d commit 941b322
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/backend/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ let socketIo: SocketIOServer | null;

export const initSocketIO = (server: HttpServer) => {
socketIo = new SocketIOServer(server, {
maxHttpBufferSize: 1e8,
pingTimeout: 60000,
cors: {
origin: '*',
methods: ['GET', 'POST'],
Expand Down
16 changes: 14 additions & 2 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ import { closeInternalServer, startInternalServer } from '../backend';
import { closeProjectServers } from '../backend/server';
import { EVENT_KEYS } from '../types/events';

const { exec } = require('child_process');
const { promisify } = require('util');

const execAsync = promisify(exec);


// eslint-disable-next-line import/no-mutable-exports
let mainWindow: BrowserWindow | null = null;

Expand Down Expand Up @@ -240,12 +246,18 @@ ipcMain.on('selectDirectory', async (event) => {
});
});

ipcMain.on('openProjectDirectory', async (event) => {
ipcMain.on('openProjectDirectory', async (event, args) => {
try {
const {platform} = args;

const activeProjectName = await getActiveProjectName();
if (activeProjectName) {
const projectPath = await getProjectPath(activeProjectName);
shell.showItemInFolder(projectPath); // Show the given file in a file manager. If possible, select the file.
if(platform === 'vscode'){
await execAsync('code .', { cwd: projectPath });
}else{
shell.showItemInFolder(projectPath); // Show the given file in a file manager. If possible, select the file.
}
} else {
event.reply('openProjectDirectory', {
success: false,
Expand Down
7 changes: 7 additions & 0 deletions src/renderer/components/devTools/terminal/terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Commands = {
swagger: CommandFunc;
git: CommandFunc;
open: CommandFunc;
code: CommandFunc;
};

type CommandDescriptions<C extends Commands> = {
Expand All @@ -51,6 +52,7 @@ const commandsDescription: CommandDescriptions<Commands & { git: string }> = {
swagger: 'opens mockingbird swagger',
git: 'all the git commands available here.',
open: 'open the project root folder in file manager',
code: 'open the project in vsCode',
};

export function CommandsTerminal() {
Expand Down Expand Up @@ -136,6 +138,11 @@ export function CommandsTerminal() {
open: () => {
ElectronEvents.sendMessage(EVENT_KEYS.OPEN_PROJECT_DIRECTORY);
},
code: () => {
ElectronEvents.sendMessage(EVENT_KEYS.OPEN_PROJECT_DIRECTORY, {
platform: 'vscode',
});
},
};

const printInTerminal = (content: string | string[]) => {
Expand Down
6 changes: 6 additions & 0 deletions src/renderer/utils/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ export const reportEventReceived = (
...args,
});
}
if (EVENT_COUNTER[event] === 1) {
reportEvent(`event received - ${event}:1`, {
eventName: `${event}:1`,
...args,
});
}
return;
}

Expand Down

0 comments on commit 941b322

Please sign in to comment.