feat: electron sandbox bundle libraries check (#2932)

chore: check sandbox libraries bundle file
This commit is contained in:
lohit 2024-08-27 14:05:49 +05:30 committed by GitHub
parent ad388e5a6a
commit b4fd350334
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,15 @@
const fs = require('fs');
const path = require('path'); const path = require('path');
const isDev = require('electron-is-dev'); 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 { format } = require('url');
const { BrowserWindow, app, Menu, ipcMain } = require('electron'); const { BrowserWindow, app, Menu, ipcMain } = require('electron');
const { setContentSecurityPolicy } = require('electron-util'); const { setContentSecurityPolicy } = require('electron-util');
@ -70,7 +80,7 @@ app.on('ready', async () => {
mainWindow.once('ready-to-show', () => { mainWindow.once('ready-to-show', () => {
mainWindow.show(); mainWindow.show();
}) });
const url = isDev const url = isDev
? 'http://localhost:3000' ? 'http://localhost:3000'
: format({ : format({