mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2024-12-23 06:02:30 -05:00
update .gitignore, remove index.ejs, add code comments to main process
This commit is contained in:
parent
4f2531e10c
commit
3a5914f703
5 changed files with 23 additions and 33 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,4 +2,3 @@
|
||||||
dist/
|
dist/
|
||||||
node_modules/
|
node_modules/
|
||||||
thumbs.db
|
thumbs.db
|
||||||
!.gitkeep
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "electron-webpack-quick-start",
|
"name": "electron-webpack-quick-start",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"main": "index.js",
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "electron-webpack dev",
|
"dev": "electron-webpack dev",
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<% if (htmlWebpackPlugin.options.nodeModules) { %>
|
|
||||||
<!-- Add `node_modules/` to global paths so `require` works properly in development -->
|
|
||||||
<script>
|
|
||||||
require('module').globalPaths.push('<%= htmlWebpackPlugin.options.nodeModules.replace(/\\/g, '\\\\') %>')
|
|
||||||
</script>
|
|
||||||
<% } %>
|
|
||||||
<!-- Set `__static` path to static files in production -->
|
|
||||||
<script>
|
|
||||||
if (process.env.NODE_ENV !== 'development') window.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Hello World!</h1>
|
|
||||||
<p>
|
|
||||||
You are using Node.js <span id="node"></span>,
|
|
||||||
Chromium <span id="chrome"></span>,
|
|
||||||
Electron <span id="electron"></span>,
|
|
||||||
and <code>electron-webpack</code> <span id="electron-webpack"></span>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<!-- webpack builds are automatically injected -->
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -4,10 +4,17 @@ import { app, BrowserWindow } from 'electron'
|
||||||
|
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||||
|
|
||||||
|
// Global reference to mainWindow
|
||||||
|
// Neccessary to prevent win from being garbage collected
|
||||||
let mainWindow
|
let mainWindow
|
||||||
|
|
||||||
function createMainWindow () {
|
function createMainWindow () {
|
||||||
|
// Construct new BrowserWindow
|
||||||
let win = new BrowserWindow()
|
let win = new BrowserWindow()
|
||||||
|
|
||||||
|
// Set url for `win`
|
||||||
|
// points to `webpack-dev-server` in development
|
||||||
|
// points to `index.html` in production
|
||||||
let url = isDevelopment
|
let url = isDevelopment
|
||||||
? 'http://localhost:9080'
|
? 'http://localhost:9080'
|
||||||
: `file://${__dirname}/index.html`
|
: `file://${__dirname}/index.html`
|
||||||
|
@ -23,14 +30,20 @@ function createMainWindow () {
|
||||||
return win
|
return win
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Quit application when all windows are closed
|
||||||
app.on('window-all-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()
|
if (process.platform !== 'darwin') app.quit()
|
||||||
})
|
})
|
||||||
|
|
||||||
app.on('activate', () => {
|
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()
|
if (mainWindow === null) mainWindow = createMainWindow()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Create main BrowserWindow when electron is ready
|
||||||
app.on('ready', () => {
|
app.on('ready', () => {
|
||||||
mainWindow = createMainWindow()
|
mainWindow = createMainWindow()
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
document.getElementById('node').innerText = process.versions.node
|
// Initial landing page
|
||||||
document.getElementById('chrome').innerText = process.versions.chrome
|
document.write(`
|
||||||
document.getElementById('electron').innerText = process.versions.electron
|
<h1>Hello world!</h1>
|
||||||
document.getElementById('electron-webpack').innerText = require('electron-webpack/package.json').version
|
<p>
|
||||||
|
You are using Node.js ${process.versions.node},
|
||||||
|
Chromium ${process.versions.chrome},
|
||||||
|
Electron ${process.versions.electron},
|
||||||
|
and <code>electron-webpack</code> ${require('electron-webpack/package.json').version}.
|
||||||
|
</p>
|
||||||
|
`)
|
||||||
|
|
Loading…
Reference in a new issue