From b4fd350334359db0efdac3849d5324f49158302e Mon Sep 17 00:00:00 2001 From: lohit Date: Tue, 27 Aug 2024 14:05:49 +0530 Subject: [PATCH] feat: electron sandbox bundle libraries check (#2932) chore: check sandbox libraries bundle file --- packages/bruno-electron/src/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/bruno-electron/src/index.js b/packages/bruno-electron/src/index.js index cad10a10c..6b353112f 100644 --- a/packages/bruno-electron/src/index.js +++ b/packages/bruno-electron/src/index.js @@ -1,5 +1,15 @@ +const fs = require('fs'); const path = require('path'); const isDev = require('electron-is-dev'); + +if (isDev) { + if (!fs.existsSync('./src/sandbox/bundle-browser-rollup.js')) { + console.log('JS Sandbox libraries have not been bundled yet'); + console.log('Please run the below command \nnpm run sandbox:bundle-libraries --workspace=packages/bruno-js'); + throw new Error('JS Sandbox libraries have not been bundled yet'); + } +} + const { format } = require('url'); const { BrowserWindow, app, Menu, ipcMain } = require('electron'); const { setContentSecurityPolicy } = require('electron-util'); @@ -70,7 +80,7 @@ app.on('ready', async () => { mainWindow.once('ready-to-show', () => { mainWindow.show(); - }) + }); const url = isDev ? 'http://localhost:3000' : format({