mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2024-12-22 21:52:31 -05:00
🎉 initial commit
This commit is contained in:
commit
4f2531e10c
6 changed files with 5468 additions and 0 deletions
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
.DS_Store
|
||||||
|
dist/
|
||||||
|
node_modules/
|
||||||
|
thumbs.db
|
||||||
|
!.gitkeep
|
21
package.json
Normal file
21
package.json
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"name": "electron-webpack-quick-start",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"main": "index.js",
|
||||||
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "electron-webpack dev",
|
||||||
|
"compile": "electron-webpack",
|
||||||
|
"dist": "yarn compile && electron-builder",
|
||||||
|
"dist:dir": "yarn dist -- --dir -c.compression=store -c.mac.identity=null"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"source-map-support": "^0.4.16"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"electron": "^1.7.5",
|
||||||
|
"electron-builder": "^19.26.0",
|
||||||
|
"electron-webpack": "^1.1.0",
|
||||||
|
"webpack": "^3.5.5"
|
||||||
|
}
|
||||||
|
}
|
27
src/index.ejs
Normal file
27
src/index.ejs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<!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>
|
36
src/main/index.js
Normal file
36
src/main/index.js
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
import { app, BrowserWindow } from 'electron'
|
||||||
|
|
||||||
|
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||||
|
|
||||||
|
let mainWindow
|
||||||
|
|
||||||
|
function createMainWindow () {
|
||||||
|
let win = new BrowserWindow()
|
||||||
|
let url = isDevelopment
|
||||||
|
? 'http://localhost:9080'
|
||||||
|
: `file://${__dirname}/index.html`
|
||||||
|
|
||||||
|
if (isDevelopment) win.webContents.openDevTools()
|
||||||
|
|
||||||
|
win.loadURL(url)
|
||||||
|
|
||||||
|
win.on('closed', () => {
|
||||||
|
mainWindow = null
|
||||||
|
})
|
||||||
|
|
||||||
|
return win
|
||||||
|
}
|
||||||
|
|
||||||
|
app.on('window-all-closed', () => {
|
||||||
|
if (process.platform !== 'darwin') app.quit()
|
||||||
|
})
|
||||||
|
|
||||||
|
app.on('activate', () => {
|
||||||
|
if (mainWindow === null) mainWindow = createMainWindow()
|
||||||
|
})
|
||||||
|
|
||||||
|
app.on('ready', () => {
|
||||||
|
mainWindow = createMainWindow()
|
||||||
|
})
|
4
src/renderer/index.js
Normal file
4
src/renderer/index.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
document.getElementById('node').innerText = process.versions.node
|
||||||
|
document.getElementById('chrome').innerText = process.versions.chrome
|
||||||
|
document.getElementById('electron').innerText = process.versions.electron
|
||||||
|
document.getElementById('electron-webpack').innerText = require('electron-webpack/package.json').version
|
Loading…
Reference in a new issue