Skip to content

Commit

Permalink
Introduce electron-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Rokt33r committed Dec 10, 2019
1 parent e61732b commit 0c4ede0
Show file tree
Hide file tree
Showing 10 changed files with 5,095 additions and 400 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Thumbs.db
compiled/*
dist/*
.cache
electron-dist/*
54 changes: 54 additions & 0 deletions app/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
const electron = require('electron')
const path = require('path')
// import { format as formatUrl } from 'url'

const { app, BrowserWindow } = electron
const isDevelopment = process.env.NODE_ENV !== 'production'

// global reference to mainWindow (necessary to prevent window from being garbage collected)
let mainWindow

function createMainWindow() {
const window = new BrowserWindow({
webPreferences: { nodeIntegration: true }
})

window.loadFile(path.join(__dirname, '../dist/index.html'))

// if (isDevelopment) {
// } else {
// window.loadURL(`http://localhost:3000/app`)
// // window.loadURL(
// // formatUrl({
// // pathname: path.join(__dirname, 'index.html'),
// // protocol: 'file',
// // slashes: true
// // })
// // )
// }

window.on('closed', () => {
mainWindow = null
})
return window
}

// quit application when all windows are closed
app.on('window-all-closed', () => {
// on macOS it is common for applications to stay open until the user explicitly quits
if (process.platform !== 'darwin') {
app.quit()
}
})

app.on('activate', () => {
// on macOS it is common to re-create a window even after all windows have been closed
if (mainWindow === null) {
mainWindow = createMainWindow()
}
})

// create main BrowserWindow when electron is ready
app.on('ready', () => {
mainWindow = createMainWindow()
})
5 changes: 5 additions & 0 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "boostnote",
"productName": "Boost Note",
"version": "0.1.0"
}
21 changes: 10 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id='root'></div>
<script src='/bundle.js'></script>
</body>
</html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<div id="root"></div>
</body>
</html>
Loading

0 comments on commit 0c4ede0

Please sign in to comment.