mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-21 23:43:15 +01:00
feat: init electron
This commit is contained in:
parent
d089cee5d6
commit
7b3808f27b
21
index.html
Normal file
21
index.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
|
||||
<title>grafnode!</title>
|
||||
<style>
|
||||
html { font-family: sans-serif; background: #2B2E3B; color: #9FEAF9; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Hello Electron!</h1>
|
||||
<p>Build cross-platform desktop apps with JavaScript, HTML, and CSS</p>
|
||||
|
||||
<script>
|
||||
require('./renderer.js')
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
44
main.js
Normal file
44
main.js
Normal file
@ -0,0 +1,44 @@
|
||||
// Modules
|
||||
const {app, BrowserWindow} = require('electron')
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the JavaScript object is garbage collected.
|
||||
let mainWindow
|
||||
|
||||
// Create a new BrowserWindow when `app` is ready
|
||||
function createWindow () {
|
||||
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1000, height: 800,
|
||||
webPreferences: {
|
||||
// Disable 'contextIsolation' to allow 'nodeIntegration'
|
||||
// 'contextIsolation' defaults to "true" as from Electron v12
|
||||
contextIsolation: false,
|
||||
nodeIntegration: true
|
||||
}
|
||||
})
|
||||
|
||||
// Load index.html into the new BrowserWindow
|
||||
mainWindow.loadFile('index.html')
|
||||
|
||||
// Open DevTools - Remove for PRODUCTION!
|
||||
// mainWindow.webContents.openDevTools();
|
||||
|
||||
// Listen for window being closed
|
||||
mainWindow.on('closed', () => {
|
||||
mainWindow = null
|
||||
})
|
||||
}
|
||||
|
||||
// Electron `app` is ready
|
||||
app.on('ready', createWindow)
|
||||
|
||||
// Quit when all windows are closed - (Not macOS - Darwin)
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') app.quit()
|
||||
})
|
||||
|
||||
// When app icon is clicked and app is running, (macOS) recreate the BrowserWindow
|
||||
app.on('activate', () => {
|
||||
if (mainWindow === null) createWindow()
|
||||
})
|
52937
package-lock.json
generated
52937
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,11 @@
|
||||
"packages/grafnode-components",
|
||||
"packages/grafnode-www"
|
||||
],
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"start": "electron .",
|
||||
"watch": "nodemon --exec electron ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.16.0",
|
||||
"@babel/plugin-transform-spread": "^7.16.7",
|
||||
@ -13,11 +18,13 @@
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"babel-loader": "^8.2.3",
|
||||
"css-loader": "^6.5.1",
|
||||
"electron": "^17.1.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"html-loader": "^3.0.1",
|
||||
"html-webpack-plugin": "^5.5.0",
|
||||
"lerna": "^4.0.0",
|
||||
"mini-css-extract-plugin": "^2.4.5",
|
||||
"nodemon": "^2.0.15",
|
||||
"style-loader": "^3.3.1",
|
||||
"webpack": "^5.64.4",
|
||||
"webpack-cli": "^4.9.1"
|
||||
|
Loading…
Reference in New Issue
Block a user