Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Jun 14, 2019
0 parents commit 5b91dd0
Show file tree
Hide file tree
Showing 8 changed files with 7,584 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .compilerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"env": {
"development": {
"application/javascript": {
"presets": [
["env", { "targets": { "electron": "1.6.0" } }],
"react"
],
"plugins": ["transform-async-to-generator", "transform-es2015-classes", "react-hot-loader/babel"],
"sourceMaps": "inline"
}
},
"production": {
"application/javascript": {
"presets": [
["env", { "targets": { "electron": "1.6.0" } }],
"react"
],
"plugins": ["transform-async-to-generator", "transform-es2015-classes"],
"sourceMaps": "none"
}
}
}
}
10 changes: 10 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "eslint-config-airbnb",
"rules": {
"import/extensions": 0,
"import/no-extraneous-dependencies": 0,
"import/no-unresolved": [2, { "ignore": ["electron"] }],
"linebreak-style": 0,
"react/prefer-stateless-function": 0
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
out
.eslintcache
70 changes: 70 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"name": "solminer",
"productName": "solminer",
"version": "1.0.0",
"description": "My Electron application description",
"main": "src/index.js",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "eslint --cache --color --ext .jsx,.js src"
},
"keywords": [],
"author": "mvines",
"license": "MIT",
"config": {
"forge": {
"make_targets": {
"win32": [
"squirrel"
],
"darwin": [
"zip"
],
"linux": [
"deb",
"rpm"
]
},
"electronPackagerConfig": {
"packageManager": "yarn"
},
"electronWinstallerConfig": {
"name": "solminer"
},
"electronInstallerDebian": {},
"electronInstallerRedhat": {},
"github_repository": {
"owner": "",
"name": ""
},
"windowsStoreConfig": {
"packageName": "",
"name": "solminer"
}
}
},
"dependencies": {
"electron-compile": "^6.4.4",
"electron-devtools-installer": "^2.1.0",
"electron-squirrel-startup": "^1.0.0",
"react": "^15.4.1",
"react-dom": "^15.4.1",
"react-hot-loader": "^3.0.0-beta.6"
},
"devDependencies": {
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-plugin-transform-es2015-classes": "^6.24.1",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"electron-forge": "^5.2.4",
"electron-prebuilt-compile": "4.0.0",
"eslint": "^3",
"eslint-config-airbnb": "^15",
"eslint-plugin-import": "^2",
"eslint-plugin-jsx-a11y": "^5",
"eslint-plugin-react": "^7"
}
}
9 changes: 9 additions & 0 deletions src/app.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';

export default class App extends React.Component {
render() {
return (<div>
<h2>Welcome to React!</h2>
</div>);
}
}
25 changes: 25 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
</head>
<body style="overflow: hidden; background-color: rgba(0,0,0,0); margin: 0" >
<div id="App"></div>
</body>

<script type="text/jsx">
import React from 'react';
import ReactDOM from 'react-dom';
import {AppContainer} from 'react-hot-loader';

const render = () => {
const App = require('./app').default;
ReactDOM.render(<AppContainer><App /></AppContainer>, document.getElementById('App'));
}

render();
if (module.hot) {
module.hot.accept(render);
}
</script>
</html>
61 changes: 61 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { app, BrowserWindow } from 'electron';
import installExtension, { REACT_DEVELOPER_TOOLS } from 'electron-devtools-installer';
import { enableLiveReload } from 'electron-compile';

// 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;

const isDevMode = process.execPath.match(/[\\/]electron/);

if (isDevMode) enableLiveReload({ strategy: 'react-hmr' });

const createWindow = async () => {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
});

// and load the index.html of the app.
mainWindow.loadURL(`file://${__dirname}/index.html`);

// Open the DevTools.
if (isDevMode) {
await installExtension(REACT_DEVELOPER_TOOLS);
mainWindow.webContents.openDevTools();
}

// Emitted when the window is closed.
mainWindow.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
};

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow);

// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
});

app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow();
}
});

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and import them here.
Loading

0 comments on commit 5b91dd0

Please sign in to comment.