Add Dashboard
52
Dashboard/.dockerignore
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Dependency directory
|
||||||
|
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# OSX
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# flow-typed
|
||||||
|
flow-typed/npm/*
|
||||||
|
!flow-typed/npm/module_vx.x.x.js
|
||||||
|
|
||||||
|
# App packaged
|
||||||
|
release
|
||||||
|
app/main.prod.js
|
||||||
|
app/main.prod.js.map
|
||||||
|
app/renderer.prod.js
|
||||||
|
app/renderer.prod.js.map
|
||||||
|
app/style.css
|
||||||
|
app/style.css.map
|
||||||
|
dist
|
||||||
|
dll
|
||||||
|
main.js
|
||||||
|
main.js.map
|
||||||
|
|
||||||
|
.idea
|
||||||
|
npm-debug.log.*
|
||||||
|
.*.dockerfile
|
26
Dashboard/.flowconfig
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
[ignore]
|
||||||
|
<PROJECT_ROOT>/app/main.prod.js
|
||||||
|
<PROJECT_ROOT>/app/main.prod.js.map
|
||||||
|
<PROJECT_ROOT>/app/dist/.*
|
||||||
|
<PROJECT_ROOT>/resources/.*
|
||||||
|
<PROJECT_ROOT>/node_modules/webpack-cli
|
||||||
|
<PROJECT_ROOT>/release/.*
|
||||||
|
<PROJECT_ROOT>/dll/.*
|
||||||
|
<PROJECT_ROOT>/release/.*
|
||||||
|
<PROJECT_ROOT>/git/.*
|
||||||
|
|
||||||
|
[include]
|
||||||
|
|
||||||
|
[libs]
|
||||||
|
|
||||||
|
[options]
|
||||||
|
esproposal.class_static_fields=enable
|
||||||
|
esproposal.class_instance_fields=enable
|
||||||
|
esproposal.export_star_as=enable
|
||||||
|
module.name_mapper.extension='css' -> '<PROJECT_ROOT>/internals/flow/CSSModule.js.flow'
|
||||||
|
module.name_mapper.extension='styl' -> '<PROJECT_ROOT>/internals/flow/CSSModule.js.flow'
|
||||||
|
module.name_mapper.extension='scss' -> '<PROJECT_ROOT>/internals/flow/CSSModule.js.flow'
|
||||||
|
module.name_mapper.extension='png' -> '<PROJECT_ROOT>/internals/flow/WebpackAsset.js.flow'
|
||||||
|
module.name_mapper.extension='jpg' -> '<PROJECT_ROOT>/internals/flow/WebpackAsset.js.flow'
|
||||||
|
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe
|
||||||
|
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue
|
6
Dashboard/.gitattributes
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
* text eol=lf
|
||||||
|
*.png binary
|
||||||
|
*.jpg binary
|
||||||
|
*.jpeg binary
|
||||||
|
*.ico binary
|
||||||
|
*.icns binary
|
25
Dashboard/.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [10.x, 12.x, 14.x]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
- run: yarn
|
||||||
|
- run: yarn package
|
51
Dashboard/.gitignore
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Dependency directory
|
||||||
|
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# OSX
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# flow-typed
|
||||||
|
flow-typed/npm/*
|
||||||
|
!flow-typed/npm/module_vx.x.x.js
|
||||||
|
|
||||||
|
# App packaged
|
||||||
|
release
|
||||||
|
app/main.prod.js
|
||||||
|
app/main.prod.js.map
|
||||||
|
app/renderer.prod.js
|
||||||
|
app/renderer.prod.js.map
|
||||||
|
app/style.css
|
||||||
|
app/style.css.map
|
||||||
|
dist
|
||||||
|
dll
|
||||||
|
main.js
|
||||||
|
main.js.map
|
||||||
|
|
||||||
|
.idea
|
||||||
|
npm-debug.log.*
|
8
Dashboard/.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"dbaeumer.vscode-eslint",
|
||||||
|
"dzannotti.vscode-babel-coloring",
|
||||||
|
"EditorConfig.EditorConfig",
|
||||||
|
"flowtype.flow-for-vscode"
|
||||||
|
]
|
||||||
|
}
|
35
Dashboard/.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
".babelrc": "jsonc",
|
||||||
|
".eslintrc": "jsonc",
|
||||||
|
".prettierrc": "jsonc",
|
||||||
|
|
||||||
|
".stylelintrc": "json",
|
||||||
|
|
||||||
|
".dockerignore": "ignore",
|
||||||
|
".eslintignore": "ignore",
|
||||||
|
".flowconfig": "ignore"
|
||||||
|
},
|
||||||
|
|
||||||
|
"javascript.validate.enable": false,
|
||||||
|
"javascript.format.enable": false,
|
||||||
|
"typescript.validate.enable": false,
|
||||||
|
"typescript.format.enable": false,
|
||||||
|
|
||||||
|
"flow.useNPMPackagedFlow": true,
|
||||||
|
"search.exclude": {
|
||||||
|
".git": true,
|
||||||
|
".eslintcache": true,
|
||||||
|
"app/dist": true,
|
||||||
|
"app/main.prod.js": true,
|
||||||
|
"app/main.prod.js.map": true,
|
||||||
|
"bower_components": true,
|
||||||
|
"dll": true,
|
||||||
|
"flow-typed": true,
|
||||||
|
"release": true,
|
||||||
|
"node_modules": true,
|
||||||
|
"npm-debug.log.*": true,
|
||||||
|
"test/**/__snapshots__": true,
|
||||||
|
"yarn.lock": true
|
||||||
|
}
|
||||||
|
}
|
22
Dashboard/LICENSE
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015-present Electron React Boilerplate
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
1
Dashboard/app/actions/index.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
//ACTIONS
|
46
Dashboard/app/app.html
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>App name here</title>
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
if (!process.env.HOT) {
|
||||||
|
const link = document.createElement("link");
|
||||||
|
link.rel = "stylesheet";
|
||||||
|
link.href = "./dist/style.css";
|
||||||
|
// HACK: Writing the script path should be done with webpack
|
||||||
|
document.getElementsByTagName("head")[0].appendChild(link);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script>
|
||||||
|
{
|
||||||
|
const scripts = [];
|
||||||
|
|
||||||
|
// Dynamically insert the DLL script in development env in the
|
||||||
|
// renderer process
|
||||||
|
if (process.env.NODE_ENV === "development") {
|
||||||
|
scripts.push("../dll/renderer.dev.dll.js");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dynamically insert the bundled app script in the renderer process
|
||||||
|
const port = process.env.PORT || 1212;
|
||||||
|
scripts.push(
|
||||||
|
process.env.HOT
|
||||||
|
? "http://localhost:" + port + "/dist/renderer.dev.js"
|
||||||
|
: "./dist/renderer.prod.js"
|
||||||
|
);
|
||||||
|
|
||||||
|
document.write(
|
||||||
|
scripts
|
||||||
|
.map((script) => `<script defer src="${script}"><\/script>`)
|
||||||
|
.join("")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
11
Dashboard/app/components/Home.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import React, { Component } from "react";
|
||||||
|
|
||||||
|
const Home = () => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<h1>Start typing in components\Home.js</h1>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Home;
|
23
Dashboard/app/index.js
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import React, { Fragment } from "react";
|
||||||
|
import { render } from "react-dom";
|
||||||
|
import { Provider } from "react-redux";
|
||||||
|
import { createStore } from "redux";
|
||||||
|
import rootReducer from "./reducers";
|
||||||
|
import { AppContainer as ReactHotAppContainer } from "react-hot-loader";
|
||||||
|
import Home from "./components/Home";
|
||||||
|
|
||||||
|
const AppContainer = process.env.PLAIN_HMR ? Fragment : ReactHotAppContainer;
|
||||||
|
|
||||||
|
const store = createStore(
|
||||||
|
rootReducer,
|
||||||
|
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
|
||||||
|
);
|
||||||
|
|
||||||
|
render(
|
||||||
|
<AppContainer>
|
||||||
|
<Provider store={store}>
|
||||||
|
<Home />
|
||||||
|
</Provider>
|
||||||
|
</AppContainer>,
|
||||||
|
document.getElementById("root")
|
||||||
|
);
|
105
Dashboard/app/main.dev.js
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
/* eslint global-require: off */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This module executes inside of electron's main process. You can start
|
||||||
|
* electron renderer process from here and communicate with the other processes
|
||||||
|
* through IPC.
|
||||||
|
*
|
||||||
|
* When running `yarn build` or `yarn build-main`, this file is compiled to
|
||||||
|
* `./app/main.prod.js` using webpack. This gives us some performance wins.
|
||||||
|
*
|
||||||
|
* @flow
|
||||||
|
*/
|
||||||
|
import { app, BrowserWindow } from 'electron';
|
||||||
|
import { autoUpdater } from 'electron-updater';
|
||||||
|
import log from 'electron-log';
|
||||||
|
import MenuBuilder from './menu';
|
||||||
|
|
||||||
|
export default class AppUpdater {
|
||||||
|
constructor() {
|
||||||
|
log.transports.file.level = 'info';
|
||||||
|
autoUpdater.logger = log;
|
||||||
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let mainWindow = null;
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
const sourceMapSupport = require('source-map-support');
|
||||||
|
sourceMapSupport.install();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
process.env.NODE_ENV === 'development' ||
|
||||||
|
process.env.DEBUG_PROD === 'true'
|
||||||
|
) {
|
||||||
|
require('electron-debug')();
|
||||||
|
}
|
||||||
|
|
||||||
|
const installExtensions = async () => {
|
||||||
|
const installer = require('electron-devtools-installer');
|
||||||
|
const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
|
||||||
|
const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'];
|
||||||
|
|
||||||
|
return Promise.all(
|
||||||
|
extensions.map(name => installer.default(installer[name], forceDownload))
|
||||||
|
).catch(console.log);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add event listeners...
|
||||||
|
*/
|
||||||
|
|
||||||
|
app.on('window-all-closed', () => {
|
||||||
|
// Respect the OSX convention of having the application in memory even
|
||||||
|
// after all windows have been closed
|
||||||
|
if (process.platform !== 'darwin') {
|
||||||
|
app.quit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on('ready', async () => {
|
||||||
|
if (
|
||||||
|
process.env.NODE_ENV === 'development' ||
|
||||||
|
process.env.DEBUG_PROD === 'true'
|
||||||
|
) {
|
||||||
|
await installExtensions();
|
||||||
|
}
|
||||||
|
|
||||||
|
mainWindow = new BrowserWindow({
|
||||||
|
show: false,
|
||||||
|
width: 1024,
|
||||||
|
height: 728,
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mainWindow.loadURL(`file://${__dirname}/app.html`);
|
||||||
|
|
||||||
|
// @TODO: Use 'ready-to-show' event
|
||||||
|
// https://github.com/electron/electron/blob/master/docs/api/browser-window.md#using-ready-to-show-event
|
||||||
|
mainWindow.webContents.on('did-finish-load', () => {
|
||||||
|
if (!mainWindow) {
|
||||||
|
throw new Error('"mainWindow" is not defined');
|
||||||
|
}
|
||||||
|
if (process.env.START_MINIMIZED) {
|
||||||
|
mainWindow.minimize();
|
||||||
|
} else {
|
||||||
|
mainWindow.show();
|
||||||
|
mainWindow.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mainWindow.on('closed', () => {
|
||||||
|
mainWindow = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
const menuBuilder = new MenuBuilder(mainWindow);
|
||||||
|
menuBuilder.buildMenu();
|
||||||
|
|
||||||
|
// Remove this if your app does not use auto updates
|
||||||
|
// eslint-disable-next-line
|
||||||
|
new AppUpdater();
|
||||||
|
});
|
277
Dashboard/app/menu.js
Normal file
|
@ -0,0 +1,277 @@
|
||||||
|
// @flow
|
||||||
|
import { app, Menu, shell, BrowserWindow } from 'electron';
|
||||||
|
|
||||||
|
export default class MenuBuilder {
|
||||||
|
mainWindow: BrowserWindow;
|
||||||
|
|
||||||
|
constructor(mainWindow: BrowserWindow) {
|
||||||
|
this.mainWindow = mainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
buildMenu() {
|
||||||
|
if (
|
||||||
|
process.env.NODE_ENV === 'development' ||
|
||||||
|
process.env.DEBUG_PROD === 'true'
|
||||||
|
) {
|
||||||
|
this.setupDevelopmentEnvironment();
|
||||||
|
}
|
||||||
|
|
||||||
|
const template =
|
||||||
|
process.platform === 'darwin'
|
||||||
|
? this.buildDarwinTemplate()
|
||||||
|
: this.buildDefaultTemplate();
|
||||||
|
|
||||||
|
const menu = Menu.buildFromTemplate(template);
|
||||||
|
Menu.setApplicationMenu(menu);
|
||||||
|
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
setupDevelopmentEnvironment() {
|
||||||
|
this.mainWindow.openDevTools();
|
||||||
|
this.mainWindow.webContents.on('context-menu', (e, props) => {
|
||||||
|
const { x, y } = props;
|
||||||
|
|
||||||
|
Menu.buildFromTemplate([
|
||||||
|
{
|
||||||
|
label: 'Inspect element',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.inspectElement(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]).popup(this.mainWindow);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
buildDarwinTemplate() {
|
||||||
|
const subMenuAbout = {
|
||||||
|
label: 'Electron',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'About ElectronReact',
|
||||||
|
selector: 'orderFrontStandardAboutPanel:'
|
||||||
|
},
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Services', submenu: [] },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{
|
||||||
|
label: 'Hide ElectronReact',
|
||||||
|
accelerator: 'Command+H',
|
||||||
|
selector: 'hide:'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Hide Others',
|
||||||
|
accelerator: 'Command+Shift+H',
|
||||||
|
selector: 'hideOtherApplications:'
|
||||||
|
},
|
||||||
|
{ label: 'Show All', selector: 'unhideAllApplications:' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{
|
||||||
|
label: 'Quit',
|
||||||
|
accelerator: 'Command+Q',
|
||||||
|
click: () => {
|
||||||
|
app.quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
const subMenuEdit = {
|
||||||
|
label: 'Edit',
|
||||||
|
submenu: [
|
||||||
|
{ label: 'Undo', accelerator: 'Command+Z', selector: 'undo:' },
|
||||||
|
{ label: 'Redo', accelerator: 'Shift+Command+Z', selector: 'redo:' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Cut', accelerator: 'Command+X', selector: 'cut:' },
|
||||||
|
{ label: 'Copy', accelerator: 'Command+C', selector: 'copy:' },
|
||||||
|
{ label: 'Paste', accelerator: 'Command+V', selector: 'paste:' },
|
||||||
|
{
|
||||||
|
label: 'Select All',
|
||||||
|
accelerator: 'Command+A',
|
||||||
|
selector: 'selectAll:'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
const subMenuViewDev = {
|
||||||
|
label: 'View',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Reload',
|
||||||
|
accelerator: 'Command+R',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.webContents.reload();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Toggle Full Screen',
|
||||||
|
accelerator: 'Ctrl+Command+F',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.setFullScreen(!this.mainWindow.isFullScreen());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Toggle Developer Tools',
|
||||||
|
accelerator: 'Alt+Command+I',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.toggleDevTools();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
const subMenuViewProd = {
|
||||||
|
label: 'View',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Toggle Full Screen',
|
||||||
|
accelerator: 'Ctrl+Command+F',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.setFullScreen(!this.mainWindow.isFullScreen());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
const subMenuWindow = {
|
||||||
|
label: 'Window',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Minimize',
|
||||||
|
accelerator: 'Command+M',
|
||||||
|
selector: 'performMiniaturize:'
|
||||||
|
},
|
||||||
|
{ label: 'Close', accelerator: 'Command+W', selector: 'performClose:' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Bring All to Front', selector: 'arrangeInFront:' }
|
||||||
|
]
|
||||||
|
};
|
||||||
|
const subMenuHelp = {
|
||||||
|
label: 'Help',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Learn More',
|
||||||
|
click() {
|
||||||
|
shell.openExternal('http://electron.atom.io');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Documentation',
|
||||||
|
click() {
|
||||||
|
shell.openExternal(
|
||||||
|
'https://github.com/atom/electron/tree/master/docs#readme'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Community Discussions',
|
||||||
|
click() {
|
||||||
|
shell.openExternal('https://discuss.atom.io/c/electron');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Search Issues',
|
||||||
|
click() {
|
||||||
|
shell.openExternal('https://github.com/atom/electron/issues');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
const subMenuView =
|
||||||
|
process.env.NODE_ENV === 'development' ? subMenuViewDev : subMenuViewProd;
|
||||||
|
|
||||||
|
return [subMenuAbout, subMenuEdit, subMenuView, subMenuWindow, subMenuHelp];
|
||||||
|
}
|
||||||
|
|
||||||
|
buildDefaultTemplate() {
|
||||||
|
const templateDefault = [
|
||||||
|
{
|
||||||
|
label: '&File',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: '&Open',
|
||||||
|
accelerator: 'Ctrl+O'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '&Close',
|
||||||
|
accelerator: 'Ctrl+W',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '&View',
|
||||||
|
submenu:
|
||||||
|
process.env.NODE_ENV === 'development'
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
label: '&Reload',
|
||||||
|
accelerator: 'Ctrl+R',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.webContents.reload();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Toggle &Full Screen',
|
||||||
|
accelerator: 'F11',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.setFullScreen(
|
||||||
|
!this.mainWindow.isFullScreen()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Toggle &Developer Tools',
|
||||||
|
accelerator: 'Alt+Ctrl+I',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.toggleDevTools();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
{
|
||||||
|
label: 'Toggle &Full Screen',
|
||||||
|
accelerator: 'F11',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.setFullScreen(
|
||||||
|
!this.mainWindow.isFullScreen()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Help',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Learn More',
|
||||||
|
click() {
|
||||||
|
shell.openExternal('http://electron.atom.io');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Documentation',
|
||||||
|
click() {
|
||||||
|
shell.openExternal(
|
||||||
|
'https://github.com/atom/electron/tree/master/docs#readme'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Community Discussions',
|
||||||
|
click() {
|
||||||
|
shell.openExternal('https://discuss.atom.io/c/electron');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Search Issues',
|
||||||
|
click() {
|
||||||
|
shell.openExternal('https://github.com/atom/electron/issues');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
return templateDefault;
|
||||||
|
}
|
||||||
|
}
|
18
Dashboard/app/package.json
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"name": "electron-react-boilerplate",
|
||||||
|
"productName": "electron-react-boilerplate",
|
||||||
|
"version": "0.18.0",
|
||||||
|
"description": "Electron application boilerplate based on React, React Router, Webpack, React Hot Loader for rapid application development",
|
||||||
|
"main": "./main.prod.js",
|
||||||
|
"author": {
|
||||||
|
"name": "Electron React Boilerplate Maintainers",
|
||||||
|
"email": "electronreactboilerplate@gmail.com",
|
||||||
|
"url": "https://github.com/electron-react-boilerplate"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"electron-rebuild": "node -r ../internals/scripts/BabelRegister.js ../internals/scripts/ElectronRebuild.js",
|
||||||
|
"postinstall": "yarn electron-rebuild"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {}
|
||||||
|
}
|
6
Dashboard/app/reducers/index.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
//rootReducer
|
||||||
|
import { combineReducers } from "redux";
|
||||||
|
|
||||||
|
const rootReducer = combineReducers({});
|
||||||
|
|
||||||
|
export default rootReducer;
|
4
Dashboard/app/yarn.lock
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
66
Dashboard/babel.config.js
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
/* eslint global-require: off */
|
||||||
|
|
||||||
|
const developmentEnvironments = ['development', 'test'];
|
||||||
|
|
||||||
|
const developmentPlugins = [require('react-hot-loader/babel')];
|
||||||
|
|
||||||
|
const productionPlugins = [
|
||||||
|
require('babel-plugin-dev-expression'),
|
||||||
|
|
||||||
|
// babel-preset-react-optimize
|
||||||
|
require('@babel/plugin-transform-react-constant-elements'),
|
||||||
|
require('@babel/plugin-transform-react-inline-elements'),
|
||||||
|
require('babel-plugin-transform-react-remove-prop-types')
|
||||||
|
];
|
||||||
|
|
||||||
|
module.exports = api => {
|
||||||
|
// see docs about api at https://babeljs.io/docs/en/config-files#apicache
|
||||||
|
|
||||||
|
const development = api.env(developmentEnvironments);
|
||||||
|
|
||||||
|
return {
|
||||||
|
presets: [
|
||||||
|
[
|
||||||
|
require('@babel/preset-env'),
|
||||||
|
{
|
||||||
|
targets: { electron: require('electron/package.json').version }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
require('@babel/preset-flow'),
|
||||||
|
[require('@babel/preset-react'), { development }]
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
// Stage 0
|
||||||
|
require('@babel/plugin-proposal-function-bind'),
|
||||||
|
|
||||||
|
// Stage 1
|
||||||
|
require('@babel/plugin-proposal-export-default-from'),
|
||||||
|
require('@babel/plugin-proposal-logical-assignment-operators'),
|
||||||
|
[require('@babel/plugin-proposal-optional-chaining'), { loose: false }],
|
||||||
|
[
|
||||||
|
require('@babel/plugin-proposal-pipeline-operator'),
|
||||||
|
{ proposal: 'minimal' }
|
||||||
|
],
|
||||||
|
[
|
||||||
|
require('@babel/plugin-proposal-nullish-coalescing-operator'),
|
||||||
|
{ loose: false }
|
||||||
|
],
|
||||||
|
require('@babel/plugin-proposal-do-expressions'),
|
||||||
|
|
||||||
|
// Stage 2
|
||||||
|
[require('@babel/plugin-proposal-decorators'), { legacy: true }],
|
||||||
|
require('@babel/plugin-proposal-function-sent'),
|
||||||
|
require('@babel/plugin-proposal-export-namespace-from'),
|
||||||
|
require('@babel/plugin-proposal-numeric-separator'),
|
||||||
|
require('@babel/plugin-proposal-throw-expressions'),
|
||||||
|
|
||||||
|
// Stage 3
|
||||||
|
require('@babel/plugin-syntax-dynamic-import'),
|
||||||
|
require('@babel/plugin-syntax-import-meta'),
|
||||||
|
[require('@babel/plugin-proposal-class-properties'), { loose: true }],
|
||||||
|
require('@babel/plugin-proposal-json-strings'),
|
||||||
|
|
||||||
|
...(development ? developmentPlugins : productionPlugins)
|
||||||
|
]
|
||||||
|
};
|
||||||
|
};
|
75
Dashboard/configs/webpack.config.base.js
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/**
|
||||||
|
* Base webpack config used across other specific configs
|
||||||
|
*/
|
||||||
|
|
||||||
|
import path from 'path';
|
||||||
|
import webpack from 'webpack';
|
||||||
|
import fs from 'fs';
|
||||||
|
import { dependencies as externals } from '../app/package.json';
|
||||||
|
import { dependencies as possibleExternals } from '../package.json';
|
||||||
|
|
||||||
|
// Find all the dependencies without a `main` property and add them as webpack externals
|
||||||
|
function filterDepWithoutEntryPoints(dep: string): boolean {
|
||||||
|
// Return true if we want to add a dependency to externals
|
||||||
|
try {
|
||||||
|
// If the root of the dependency has an index.js, return true
|
||||||
|
if (
|
||||||
|
fs.existsSync(path.join(__dirname, '..', `node_modules/${dep}/index.js`))
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const pgkString = fs
|
||||||
|
.readFileSync(require.resolve(`${dep}/package`))
|
||||||
|
.toString();
|
||||||
|
const pkg = JSON.parse(pgkString);
|
||||||
|
const fields = ['main', 'module', 'jsnext:main', 'browser'];
|
||||||
|
return !fields.some(field => field in pkg);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
externals: [
|
||||||
|
...Object.keys(externals || {}),
|
||||||
|
...Object.keys(possibleExternals || {}).filter(filterDepWithoutEntryPoints)
|
||||||
|
],
|
||||||
|
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.jsx?$/,
|
||||||
|
exclude: /node_modules/,
|
||||||
|
use: {
|
||||||
|
loader: 'babel-loader',
|
||||||
|
options: {
|
||||||
|
cacheDirectory: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
output: {
|
||||||
|
path: path.join(__dirname, '..', 'app'),
|
||||||
|
// https://github.com/webpack/webpack/issues/1114
|
||||||
|
libraryTarget: 'commonjs2'
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the array of extensions that should be used to resolve modules.
|
||||||
|
*/
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.js', '.jsx', '.json'],
|
||||||
|
modules: [path.join(__dirname, '..', 'app'), 'node_modules']
|
||||||
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.EnvironmentPlugin({
|
||||||
|
NODE_ENV: 'production'
|
||||||
|
}),
|
||||||
|
|
||||||
|
new webpack.NamedModulesPlugin()
|
||||||
|
]
|
||||||
|
};
|
4
Dashboard/configs/webpack.config.eslint.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/* eslint import/no-unresolved: off, import/no-self-import: off */
|
||||||
|
require('@babel/register');
|
||||||
|
|
||||||
|
module.exports = require('./webpack.config.renderer.dev.babel').default;
|
73
Dashboard/configs/webpack.config.main.prod.babel.js
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
/**
|
||||||
|
* Webpack config for production electron main process
|
||||||
|
*/
|
||||||
|
|
||||||
|
import path from 'path';
|
||||||
|
import webpack from 'webpack';
|
||||||
|
import merge from 'webpack-merge';
|
||||||
|
import TerserPlugin from 'terser-webpack-plugin';
|
||||||
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
||||||
|
import baseConfig from './webpack.config.base';
|
||||||
|
import CheckNodeEnv from '../internals/scripts/CheckNodeEnv';
|
||||||
|
|
||||||
|
CheckNodeEnv('production');
|
||||||
|
|
||||||
|
export default merge.smart(baseConfig, {
|
||||||
|
devtool: 'source-map',
|
||||||
|
|
||||||
|
mode: 'production',
|
||||||
|
|
||||||
|
target: 'electron-main',
|
||||||
|
|
||||||
|
entry: './app/main.dev',
|
||||||
|
|
||||||
|
output: {
|
||||||
|
path: path.join(__dirname, '..'),
|
||||||
|
filename: './app/main.prod.js'
|
||||||
|
},
|
||||||
|
|
||||||
|
optimization: {
|
||||||
|
minimizer: process.env.E2E_BUILD
|
||||||
|
? []
|
||||||
|
: [
|
||||||
|
new TerserPlugin({
|
||||||
|
parallel: true,
|
||||||
|
sourceMap: true,
|
||||||
|
cache: true
|
||||||
|
})
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new BundleAnalyzerPlugin({
|
||||||
|
analyzerMode:
|
||||||
|
process.env.OPEN_ANALYZER === 'true' ? 'server' : 'disabled',
|
||||||
|
openAnalyzer: process.env.OPEN_ANALYZER === 'true'
|
||||||
|
}),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create global constants which can be configured at compile time.
|
||||||
|
*
|
||||||
|
* Useful for allowing different behaviour between development builds and
|
||||||
|
* release builds
|
||||||
|
*
|
||||||
|
* NODE_ENV should be production so that modules do not perform certain
|
||||||
|
* development checks
|
||||||
|
*/
|
||||||
|
new webpack.EnvironmentPlugin({
|
||||||
|
NODE_ENV: 'production',
|
||||||
|
DEBUG_PROD: false,
|
||||||
|
START_MINIMIZED: false
|
||||||
|
})
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables webpack processing of __dirname and __filename.
|
||||||
|
* If you run the bundle in node.js it falls back to these values of node.js.
|
||||||
|
* https://github.com/webpack/webpack/issues/2010
|
||||||
|
*/
|
||||||
|
node: {
|
||||||
|
__dirname: false,
|
||||||
|
__filename: false
|
||||||
|
}
|
||||||
|
});
|
279
Dashboard/configs/webpack.config.renderer.dev.babel.js
Normal file
|
@ -0,0 +1,279 @@
|
||||||
|
/* eslint global-require: off, import/no-dynamic-require: off */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build config for development electron renderer process that uses
|
||||||
|
* Hot-Module-Replacement
|
||||||
|
*
|
||||||
|
* https://webpack.js.org/concepts/hot-module-replacement/
|
||||||
|
*/
|
||||||
|
|
||||||
|
import path from 'path';
|
||||||
|
import fs from 'fs';
|
||||||
|
import webpack from 'webpack';
|
||||||
|
import chalk from 'chalk';
|
||||||
|
import merge from 'webpack-merge';
|
||||||
|
import { spawn, execSync } from 'child_process';
|
||||||
|
import baseConfig from './webpack.config.base';
|
||||||
|
import CheckNodeEnv from '../internals/scripts/CheckNodeEnv';
|
||||||
|
|
||||||
|
CheckNodeEnv('development');
|
||||||
|
|
||||||
|
const port = process.env.PORT || 1212;
|
||||||
|
const publicPath = `http://localhost:${port}/dist`;
|
||||||
|
const dll = path.join(__dirname, '..', 'dll');
|
||||||
|
const manifest = path.resolve(dll, 'renderer.json');
|
||||||
|
const requiredByDLLConfig = module.parent.filename.includes(
|
||||||
|
'webpack.config.renderer.dev.dll'
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Warn if the DLL is not built
|
||||||
|
*/
|
||||||
|
if (!requiredByDLLConfig && !(fs.existsSync(dll) && fs.existsSync(manifest))) {
|
||||||
|
console.log(
|
||||||
|
chalk.black.bgYellow.bold(
|
||||||
|
'The DLL files are missing. Sit back while we build them for you with "yarn build-dll"'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
execSync('yarn build-dll');
|
||||||
|
}
|
||||||
|
|
||||||
|
export default merge.smart(baseConfig, {
|
||||||
|
devtool: 'inline-source-map',
|
||||||
|
|
||||||
|
mode: 'development',
|
||||||
|
|
||||||
|
target: 'electron-renderer',
|
||||||
|
|
||||||
|
entry: [
|
||||||
|
...(process.env.PLAIN_HMR ? [] : ['react-hot-loader/patch']),
|
||||||
|
`webpack-dev-server/client?http://localhost:${port}/`,
|
||||||
|
'webpack/hot/only-dev-server',
|
||||||
|
require.resolve('../app/index')
|
||||||
|
],
|
||||||
|
|
||||||
|
output: {
|
||||||
|
publicPath: `http://localhost:${port}/dist/`,
|
||||||
|
filename: 'renderer.dev.js'
|
||||||
|
},
|
||||||
|
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.jsx?$/,
|
||||||
|
exclude: /node_modules/,
|
||||||
|
use: {
|
||||||
|
loader: 'babel-loader',
|
||||||
|
options: {
|
||||||
|
cacheDirectory: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.global\.css$/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'style-loader'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'css-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /^((?!\.global).)*\.css$/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'style-loader'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'css-loader',
|
||||||
|
options: {
|
||||||
|
modules: {
|
||||||
|
localIdentName: '[name]__[local]__[hash:base64:5]'
|
||||||
|
},
|
||||||
|
sourceMap: true,
|
||||||
|
importLoaders: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// SASS support - compile all .global.scss files and pipe it to style.css
|
||||||
|
{
|
||||||
|
test: /\.global\.(scss|sass)$/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'style-loader'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'css-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'sass-loader'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// SASS support - compile all other .scss files and pipe it to style.css
|
||||||
|
{
|
||||||
|
test: /^((?!\.global).)*\.(scss|sass)$/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'style-loader'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'css-loader',
|
||||||
|
options: {
|
||||||
|
modules: {
|
||||||
|
localIdentName: '[name]__[local]__[hash:base64:5]'
|
||||||
|
},
|
||||||
|
sourceMap: true,
|
||||||
|
importLoaders: 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'sass-loader'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// WOFF Font
|
||||||
|
{
|
||||||
|
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
|
use: {
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
limit: 10000,
|
||||||
|
mimetype: 'application/font-woff'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// WOFF2 Font
|
||||||
|
{
|
||||||
|
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
|
use: {
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
limit: 10000,
|
||||||
|
mimetype: 'application/font-woff'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// TTF Font
|
||||||
|
{
|
||||||
|
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
|
use: {
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
limit: 10000,
|
||||||
|
mimetype: 'application/octet-stream'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// EOT Font
|
||||||
|
{
|
||||||
|
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
|
use: 'file-loader'
|
||||||
|
},
|
||||||
|
// SVG Font
|
||||||
|
{
|
||||||
|
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
|
use: {
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
limit: 10000,
|
||||||
|
mimetype: 'image/svg+xml'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Common Image Formats
|
||||||
|
{
|
||||||
|
test: /\.(?:ico|gif|png|jpg|jpeg|webp)$/,
|
||||||
|
use: 'url-loader'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'react-dom': '@hot-loader/react-dom'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
requiredByDLLConfig
|
||||||
|
? null
|
||||||
|
: new webpack.DllReferencePlugin({
|
||||||
|
context: path.join(__dirname, '..', 'dll'),
|
||||||
|
manifest: require(manifest),
|
||||||
|
sourceType: 'var'
|
||||||
|
}),
|
||||||
|
|
||||||
|
new webpack.HotModuleReplacementPlugin({
|
||||||
|
multiStep: true
|
||||||
|
}),
|
||||||
|
|
||||||
|
new webpack.NoEmitOnErrorsPlugin(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create global constants which can be configured at compile time.
|
||||||
|
*
|
||||||
|
* Useful for allowing different behaviour between development builds and
|
||||||
|
* release builds
|
||||||
|
*
|
||||||
|
* NODE_ENV should be production so that modules do not perform certain
|
||||||
|
* development checks
|
||||||
|
*
|
||||||
|
* By default, use 'development' as NODE_ENV. This can be overriden with
|
||||||
|
* 'staging', for example, by changing the ENV variables in the npm scripts
|
||||||
|
*/
|
||||||
|
new webpack.EnvironmentPlugin({
|
||||||
|
NODE_ENV: 'development'
|
||||||
|
}),
|
||||||
|
|
||||||
|
new webpack.LoaderOptionsPlugin({
|
||||||
|
debug: true
|
||||||
|
})
|
||||||
|
],
|
||||||
|
|
||||||
|
node: {
|
||||||
|
__dirname: false,
|
||||||
|
__filename: false
|
||||||
|
},
|
||||||
|
|
||||||
|
devServer: {
|
||||||
|
port,
|
||||||
|
publicPath,
|
||||||
|
compress: true,
|
||||||
|
noInfo: true,
|
||||||
|
stats: 'errors-only',
|
||||||
|
inline: true,
|
||||||
|
lazy: false,
|
||||||
|
hot: true,
|
||||||
|
headers: { 'Access-Control-Allow-Origin': '*' },
|
||||||
|
contentBase: path.join(__dirname, 'dist'),
|
||||||
|
watchOptions: {
|
||||||
|
aggregateTimeout: 300,
|
||||||
|
ignored: /node_modules/,
|
||||||
|
poll: 100
|
||||||
|
},
|
||||||
|
historyApiFallback: {
|
||||||
|
verbose: true,
|
||||||
|
disableDotRule: false
|
||||||
|
},
|
||||||
|
before() {
|
||||||
|
if (process.env.START_HOT) {
|
||||||
|
console.log('Starting Main Process...');
|
||||||
|
spawn('npm', ['run', 'start-main-dev'], {
|
||||||
|
shell: true,
|
||||||
|
env: process.env,
|
||||||
|
stdio: 'inherit'
|
||||||
|
})
|
||||||
|
.on('close', code => process.exit(code))
|
||||||
|
.on('error', spawnError => console.error(spawnError));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
74
Dashboard/configs/webpack.config.renderer.dev.dll.babel.js
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
/* eslint global-require: off, import/no-dynamic-require: off */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the DLL for development electron renderer process
|
||||||
|
*/
|
||||||
|
|
||||||
|
import webpack from 'webpack';
|
||||||
|
import path from 'path';
|
||||||
|
import merge from 'webpack-merge';
|
||||||
|
import baseConfig from './webpack.config.base';
|
||||||
|
import { dependencies } from '../package.json';
|
||||||
|
import CheckNodeEnv from '../internals/scripts/CheckNodeEnv';
|
||||||
|
|
||||||
|
CheckNodeEnv('development');
|
||||||
|
|
||||||
|
const dist = path.join(__dirname, '..', 'dll');
|
||||||
|
|
||||||
|
export default merge.smart(baseConfig, {
|
||||||
|
context: path.join(__dirname, '..'),
|
||||||
|
|
||||||
|
devtool: 'eval',
|
||||||
|
|
||||||
|
mode: 'development',
|
||||||
|
|
||||||
|
target: 'electron-renderer',
|
||||||
|
|
||||||
|
externals: ['fsevents', 'crypto-browserify'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use `module` from `webpack.config.renderer.dev.js`
|
||||||
|
*/
|
||||||
|
module: require('./webpack.config.renderer.dev.babel').default.module,
|
||||||
|
|
||||||
|
entry: {
|
||||||
|
renderer: Object.keys(dependencies || {})
|
||||||
|
},
|
||||||
|
|
||||||
|
output: {
|
||||||
|
library: 'renderer',
|
||||||
|
path: dist,
|
||||||
|
filename: '[name].dev.dll.js',
|
||||||
|
libraryTarget: 'var'
|
||||||
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DllPlugin({
|
||||||
|
path: path.join(dist, '[name].json'),
|
||||||
|
name: '[name]'
|
||||||
|
}),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create global constants which can be configured at compile time.
|
||||||
|
*
|
||||||
|
* Useful for allowing different behaviour between development builds and
|
||||||
|
* release builds
|
||||||
|
*
|
||||||
|
* NODE_ENV should be production so that modules do not perform certain
|
||||||
|
* development checks
|
||||||
|
*/
|
||||||
|
new webpack.EnvironmentPlugin({
|
||||||
|
NODE_ENV: 'development'
|
||||||
|
}),
|
||||||
|
|
||||||
|
new webpack.LoaderOptionsPlugin({
|
||||||
|
debug: true,
|
||||||
|
options: {
|
||||||
|
context: path.join(__dirname, '..', 'app'),
|
||||||
|
output: {
|
||||||
|
path: path.join(__dirname, '..', 'dll')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
|
});
|
218
Dashboard/configs/webpack.config.renderer.prod.babel.js
Normal file
|
@ -0,0 +1,218 @@
|
||||||
|
/**
|
||||||
|
* Build config for electron renderer process
|
||||||
|
*/
|
||||||
|
|
||||||
|
import path from 'path';
|
||||||
|
import webpack from 'webpack';
|
||||||
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||||
|
import OptimizeCSSAssetsPlugin from 'optimize-css-assets-webpack-plugin';
|
||||||
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
||||||
|
import merge from 'webpack-merge';
|
||||||
|
import TerserPlugin from 'terser-webpack-plugin';
|
||||||
|
import baseConfig from './webpack.config.base';
|
||||||
|
import CheckNodeEnv from '../internals/scripts/CheckNodeEnv';
|
||||||
|
|
||||||
|
CheckNodeEnv('production');
|
||||||
|
|
||||||
|
export default merge.smart(baseConfig, {
|
||||||
|
devtool: 'source-map',
|
||||||
|
|
||||||
|
mode: 'production',
|
||||||
|
|
||||||
|
target: 'electron-renderer',
|
||||||
|
|
||||||
|
entry: path.join(__dirname, '..', 'app/index'),
|
||||||
|
|
||||||
|
output: {
|
||||||
|
path: path.join(__dirname, '..', 'app/dist'),
|
||||||
|
publicPath: './dist/',
|
||||||
|
filename: 'renderer.prod.js'
|
||||||
|
},
|
||||||
|
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
// Extract all .global.css to style.css as is
|
||||||
|
{
|
||||||
|
test: /\.global\.css$/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: MiniCssExtractPlugin.loader,
|
||||||
|
options: {
|
||||||
|
publicPath: './'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'css-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// Pipe other styles through css modules and append to style.css
|
||||||
|
{
|
||||||
|
test: /^((?!\.global).)*\.css$/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: MiniCssExtractPlugin.loader
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'css-loader',
|
||||||
|
options: {
|
||||||
|
modules: {
|
||||||
|
localIdentName: '[name]__[local]__[hash:base64:5]'
|
||||||
|
},
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// Add SASS support - compile all .global.scss files and pipe it to style.css
|
||||||
|
{
|
||||||
|
test: /\.global\.(scss|sass)$/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: MiniCssExtractPlugin.loader
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'css-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true,
|
||||||
|
importLoaders: 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'sass-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// Add SASS support - compile all other .scss files and pipe it to style.css
|
||||||
|
{
|
||||||
|
test: /^((?!\.global).)*\.(scss|sass)$/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: MiniCssExtractPlugin.loader
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'css-loader',
|
||||||
|
options: {
|
||||||
|
modules: {
|
||||||
|
localIdentName: '[name]__[local]__[hash:base64:5]'
|
||||||
|
},
|
||||||
|
importLoaders: 1,
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'sass-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// WOFF Font
|
||||||
|
{
|
||||||
|
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
|
use: {
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
limit: 10000,
|
||||||
|
mimetype: 'application/font-woff'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// WOFF2 Font
|
||||||
|
{
|
||||||
|
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
|
use: {
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
limit: 10000,
|
||||||
|
mimetype: 'application/font-woff'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// TTF Font
|
||||||
|
{
|
||||||
|
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
|
use: {
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
limit: 10000,
|
||||||
|
mimetype: 'application/octet-stream'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// EOT Font
|
||||||
|
{
|
||||||
|
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
|
use: 'file-loader'
|
||||||
|
},
|
||||||
|
// SVG Font
|
||||||
|
{
|
||||||
|
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
|
use: {
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
limit: 10000,
|
||||||
|
mimetype: 'image/svg+xml'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Common Image Formats
|
||||||
|
{
|
||||||
|
test: /\.(?:ico|gif|png|jpg|jpeg|webp)$/,
|
||||||
|
use: 'url-loader'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
optimization: {
|
||||||
|
minimizer: process.env.E2E_BUILD
|
||||||
|
? []
|
||||||
|
: [
|
||||||
|
new TerserPlugin({
|
||||||
|
parallel: true,
|
||||||
|
sourceMap: true,
|
||||||
|
cache: true
|
||||||
|
}),
|
||||||
|
new OptimizeCSSAssetsPlugin({
|
||||||
|
cssProcessorOptions: {
|
||||||
|
map: {
|
||||||
|
inline: false,
|
||||||
|
annotation: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
/**
|
||||||
|
* Create global constants which can be configured at compile time.
|
||||||
|
*
|
||||||
|
* Useful for allowing different behaviour between development builds and
|
||||||
|
* release builds
|
||||||
|
*
|
||||||
|
* NODE_ENV should be production so that modules do not perform certain
|
||||||
|
* development checks
|
||||||
|
*/
|
||||||
|
new webpack.EnvironmentPlugin({
|
||||||
|
NODE_ENV: 'production'
|
||||||
|
}),
|
||||||
|
|
||||||
|
new MiniCssExtractPlugin({
|
||||||
|
filename: 'style.css'
|
||||||
|
}),
|
||||||
|
|
||||||
|
new BundleAnalyzerPlugin({
|
||||||
|
analyzerMode:
|
||||||
|
process.env.OPEN_ANALYZER === 'true' ? 'server' : 'disabled',
|
||||||
|
openAnalyzer: process.env.OPEN_ANALYZER === 'true'
|
||||||
|
})
|
||||||
|
]
|
||||||
|
});
|
3
Dashboard/flow-typed/module_vx.x.x.js
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
declare module 'module' {
|
||||||
|
declare module.exports: any;
|
||||||
|
}
|
3
Dashboard/internals/flow/CSSModule.js.flow
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
declare export default { [key: string]: string }
|
2
Dashboard/internals/flow/WebpackAsset.js.flow
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
// @flow
|
||||||
|
declare export default string
|
1
Dashboard/internals/mocks/fileMock.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export default 'test-file-stub';
|
5
Dashboard/internals/scripts/BabelRegister.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
require('@babel/register')({
|
||||||
|
cwd: path.join(__dirname, '..', '..')
|
||||||
|
});
|
35
Dashboard/internals/scripts/CheckBuildsExist.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
// @flow
|
||||||
|
// Check if the renderer and main bundles are built
|
||||||
|
import path from 'path';
|
||||||
|
import chalk from 'chalk';
|
||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
|
function CheckBuildsExist() {
|
||||||
|
const mainPath = path.join(__dirname, '..', '..', 'app', 'main.prod.js');
|
||||||
|
const rendererPath = path.join(
|
||||||
|
__dirname,
|
||||||
|
'..',
|
||||||
|
'..',
|
||||||
|
'app',
|
||||||
|
'dist',
|
||||||
|
'renderer.prod.js'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!fs.existsSync(mainPath)) {
|
||||||
|
throw new Error(
|
||||||
|
chalk.whiteBright.bgRed.bold(
|
||||||
|
'The main process is not built yet. Build it by running "yarn build-main"'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fs.existsSync(rendererPath)) {
|
||||||
|
throw new Error(
|
||||||
|
chalk.whiteBright.bgRed.bold(
|
||||||
|
'The renderer process is not built yet. Build it by running "yarn build-renderer"'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckBuildsExist();
|
51
Dashboard/internals/scripts/CheckNativeDep.js
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
// @flow
|
||||||
|
import fs from 'fs';
|
||||||
|
import chalk from 'chalk';
|
||||||
|
import { execSync } from 'child_process';
|
||||||
|
import { dependencies } from '../../package';
|
||||||
|
|
||||||
|
(() => {
|
||||||
|
if (!dependencies) return;
|
||||||
|
const dependenciesKeys = Object.keys(dependencies);
|
||||||
|
const nativeDeps = fs
|
||||||
|
.readdirSync('node_modules')
|
||||||
|
.filter(folder => fs.existsSync(`node_modules/${folder}/binding.gyp`));
|
||||||
|
try {
|
||||||
|
// Find the reason for why the dependency is installed. If it is installed
|
||||||
|
// because of a devDependency then that is okay. Warn when it is installed
|
||||||
|
// because of a dependency
|
||||||
|
const { dependencies: dependenciesObject } = JSON.parse(
|
||||||
|
execSync(`npm ls ${nativeDeps.join(' ')} --json`).toString()
|
||||||
|
);
|
||||||
|
const rootDependencies = Object.keys(dependenciesObject);
|
||||||
|
const filteredRootDependencies = rootDependencies.filter(rootDependency =>
|
||||||
|
dependenciesKeys.includes(rootDependency)
|
||||||
|
);
|
||||||
|
if (filteredRootDependencies.length > 0) {
|
||||||
|
const plural = filteredRootDependencies.length > 1;
|
||||||
|
console.log(`
|
||||||
|
${chalk.whiteBright.bgYellow.bold(
|
||||||
|
'Webpack does not work with native dependencies.'
|
||||||
|
)}
|
||||||
|
${chalk.bold(filteredRootDependencies.join(', '))} ${
|
||||||
|
plural ? 'are native dependencies' : 'is a native dependency'
|
||||||
|
} and should be installed inside of the "./app" folder.
|
||||||
|
First uninstall the packages from "./package.json":
|
||||||
|
${chalk.whiteBright.bgGreen.bold('yarn remove your-package')}
|
||||||
|
${chalk.bold(
|
||||||
|
'Then, instead of installing the package to the root "./package.json":'
|
||||||
|
)}
|
||||||
|
${chalk.whiteBright.bgRed.bold('yarn add your-package')}
|
||||||
|
${chalk.bold('Install the package to "./app/package.json"')}
|
||||||
|
${chalk.whiteBright.bgGreen.bold('cd ./app && yarn add your-package')}
|
||||||
|
Read more about native dependencies at:
|
||||||
|
${chalk.bold(
|
||||||
|
'https://github.com/electron-react-boilerplate/electron-react-boilerplate/wiki/Module-Structure----Two-package.json-Structure'
|
||||||
|
)}
|
||||||
|
`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Native dependencies could not be checked');
|
||||||
|
}
|
||||||
|
})();
|
17
Dashboard/internals/scripts/CheckNodeEnv.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// @flow
|
||||||
|
import chalk from 'chalk';
|
||||||
|
|
||||||
|
export default function CheckNodeEnv(expectedEnv: string) {
|
||||||
|
if (!expectedEnv) {
|
||||||
|
throw new Error('"expectedEnv" not set');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV !== expectedEnv) {
|
||||||
|
console.log(
|
||||||
|
chalk.whiteBright.bgRed.bold(
|
||||||
|
`"process.env.NODE_ENV" must be "${expectedEnv}" to use this webpack config`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
process.exit(2);
|
||||||
|
}
|
||||||
|
}
|
19
Dashboard/internals/scripts/CheckPortInUse.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// @flow
|
||||||
|
import chalk from 'chalk';
|
||||||
|
import detectPort from 'detect-port';
|
||||||
|
|
||||||
|
(function CheckPortInUse() {
|
||||||
|
const port: string = process.env.PORT || '1212';
|
||||||
|
|
||||||
|
detectPort(port, (err: ?Error, availablePort: number) => {
|
||||||
|
if (port !== String(availablePort)) {
|
||||||
|
throw new Error(
|
||||||
|
chalk.whiteBright.bgRed.bold(
|
||||||
|
`Port "${port}" on "localhost" is already in use. Please use another port. ex: PORT=4343 yarn dev`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
7
Dashboard/internals/scripts/CheckYarn.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
if (!/yarn\.js$/.test(process.env.npm_execpath || '')) {
|
||||||
|
console.warn(
|
||||||
|
"\u001b[33mYou don't seem to be using yarn. This could produce unexpected results.\u001b[39m"
|
||||||
|
);
|
||||||
|
}
|
31
Dashboard/internals/scripts/ElectronRebuild.js
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
// @flow
|
||||||
|
import path from 'path';
|
||||||
|
import { execSync } from 'child_process';
|
||||||
|
import fs from 'fs';
|
||||||
|
import { dependencies } from '../../app/package';
|
||||||
|
|
||||||
|
(() => {
|
||||||
|
const nodeModulesPath = path.join(
|
||||||
|
__dirname,
|
||||||
|
'..',
|
||||||
|
'..',
|
||||||
|
'app',
|
||||||
|
'node_modules'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
Object.keys(dependencies || {}).length > 0 &&
|
||||||
|
fs.existsSync(nodeModulesPath)
|
||||||
|
) {
|
||||||
|
const electronRebuildCmd =
|
||||||
|
'../node_modules/.bin/electron-rebuild --parallel --force --types prod,dev,optional --module-dir .';
|
||||||
|
const cmd =
|
||||||
|
process.platform === 'win32'
|
||||||
|
? electronRebuildCmd.replace(/\//g, '\\')
|
||||||
|
: electronRebuildCmd;
|
||||||
|
execSync(cmd, {
|
||||||
|
cwd: path.join(__dirname, '..', '..', 'app'),
|
||||||
|
stdio: 'inherit'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
255
Dashboard/package.json
Normal file
|
@ -0,0 +1,255 @@
|
||||||
|
{
|
||||||
|
"name": "electron-react-boilerplate",
|
||||||
|
"productName": "AppNameHere",
|
||||||
|
"version": "0.18.0",
|
||||||
|
"description": "Electron application boilerplate based on React, React Router, Webpack, React Hot Loader for rapid application development",
|
||||||
|
"build": {
|
||||||
|
"productName": "AppNameHere",
|
||||||
|
"appId": "org.develar.AppNameHere",
|
||||||
|
"files": [
|
||||||
|
"dist/",
|
||||||
|
"node_modules/",
|
||||||
|
"app.html",
|
||||||
|
"main.prod.js",
|
||||||
|
"main.prod.js.map",
|
||||||
|
"package.json"
|
||||||
|
],
|
||||||
|
"dmg": {
|
||||||
|
"contents": [
|
||||||
|
{
|
||||||
|
"x": 130,
|
||||||
|
"y": 220
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 410,
|
||||||
|
"y": 220,
|
||||||
|
"type": "link",
|
||||||
|
"path": "/Applications"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"win": {
|
||||||
|
"target": [
|
||||||
|
"nsis",
|
||||||
|
"msi"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"linux": {
|
||||||
|
"target": [
|
||||||
|
"deb",
|
||||||
|
"rpm",
|
||||||
|
"AppImage"
|
||||||
|
],
|
||||||
|
"category": "Development"
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"buildResources": "resources",
|
||||||
|
"output": "release"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "concurrently \"yarn build-main\" \"yarn build-renderer\"",
|
||||||
|
"build-dll": "cross-env NODE_ENV=development webpack --config ./configs/webpack.config.renderer.dev.dll.babel.js --colors",
|
||||||
|
"build-e2e": "cross-env E2E_BUILD=true yarn build",
|
||||||
|
"build-main": "cross-env NODE_ENV=production webpack --config ./configs/webpack.config.main.prod.babel.js --colors",
|
||||||
|
"build-renderer": "cross-env NODE_ENV=production webpack --config ./configs/webpack.config.renderer.prod.babel.js --colors",
|
||||||
|
"dev": "cross-env START_HOT=1 node -r @babel/register ./internals/scripts/CheckPortInUse.js && cross-env START_HOT=1 yarn start-renderer-dev",
|
||||||
|
"electron-rebuild": "electron-rebuild --parallel --force --types prod,dev,optional --module-dir app",
|
||||||
|
"flow": "flow",
|
||||||
|
"flow-typed": "rimraf flow-typed/npm && flow-typed install --overwrite || true",
|
||||||
|
"lint": "cross-env NODE_ENV=development eslint --cache --format=pretty .",
|
||||||
|
"lint-fix": "yarn --silent lint --fix; exit 0",
|
||||||
|
"lint-styles": "stylelint --ignore-path .eslintignore '**/*.*(css|scss)' --syntax scss",
|
||||||
|
"lint-styles-fix": "yarn --silent lint-styles --fix; exit 0",
|
||||||
|
"package": "yarn build && electron-builder build --publish never",
|
||||||
|
"package-all": "yarn build && electron-builder build -mwl",
|
||||||
|
"package-ci": "yarn postinstall && yarn build && electron-builder --publish always",
|
||||||
|
"package-linux": "yarn build && electron-builder build --linux",
|
||||||
|
"package-win": "yarn build && electron-builder build --win --x64",
|
||||||
|
"postinstall": "node -r @babel/register internals/scripts/CheckNativeDep.js && yarn flow-typed && electron-builder install-app-deps && yarn build-dll && opencollective-postinstall",
|
||||||
|
"postlint-fix": "prettier --ignore-path .eslintignore --single-quote --write '**/*.{js,jsx,json,html,css,less,scss,yml}'",
|
||||||
|
"postlint-styles-fix": "prettier --ignore-path .eslintignore --single-quote --write '**/*.{css,scss}'",
|
||||||
|
"preinstall": "node ./internals/scripts/CheckYarn.js",
|
||||||
|
"prestart": "yarn build",
|
||||||
|
"start": "cross-env NODE_ENV=production electron ./app/main.prod.js",
|
||||||
|
"start-main-dev": "cross-env HOT=1 NODE_ENV=development electron -r @babel/register ./app/main.dev.js",
|
||||||
|
"start-renderer-dev": "cross-env NODE_ENV=development webpack-dev-server --config configs/webpack.config.renderer.dev.babel.js",
|
||||||
|
"test": "cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 jest",
|
||||||
|
"test-all": "yarn lint && yarn flow && yarn build && yarn test && yarn build-e2e && yarn test-e2e",
|
||||||
|
"test-e2e": "node -r @babel/register ./internals/scripts/CheckBuildsExist.js && cross-env NODE_ENV=test testcafe electron:./app ./test/e2e/HomePage.e2e.js",
|
||||||
|
"test-e2e-live": "node -r @babel/register ./internals/scripts/CheckBuildsExist.js && cross-env NODE_ENV=test testcafe-live electron:./app ./test/e2e/HomePage.e2e.js",
|
||||||
|
"test-watch": "yarn test --watch"
|
||||||
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"*.{js,jsx}": [
|
||||||
|
"cross-env NODE_ENV=development eslint --cache --format=pretty",
|
||||||
|
"git add"
|
||||||
|
],
|
||||||
|
"{*.json,.{babelrc,eslintrc,prettierrc,stylelintrc}}": [
|
||||||
|
"prettier --ignore-path .eslintignore --parser json --write",
|
||||||
|
"git add"
|
||||||
|
],
|
||||||
|
"*.{css,scss}": [
|
||||||
|
"stylelint --ignore-path .eslintignore --syntax scss --fix",
|
||||||
|
"prettier --ignore-path .eslintignore --single-quote --write",
|
||||||
|
"git add"
|
||||||
|
],
|
||||||
|
"*.{html,md,yml}": [
|
||||||
|
"prettier --ignore-path .eslintignore --single-quote --write",
|
||||||
|
"git add"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/GHOSCHT/electron-react-boilerplate.git"
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"name": "GHOSCHT",
|
||||||
|
"url": "https://github.com/GHOSCHT"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"jest": {
|
||||||
|
"testURL": "http://localhost/",
|
||||||
|
"moduleNameMapper": {
|
||||||
|
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/internals/mocks/fileMock.js",
|
||||||
|
"\\.(css|less|sass|scss)$": "identity-obj-proxy"
|
||||||
|
},
|
||||||
|
"moduleFileExtensions": [
|
||||||
|
"js",
|
||||||
|
"jsx",
|
||||||
|
"json"
|
||||||
|
],
|
||||||
|
"moduleDirectories": [
|
||||||
|
"node_modules",
|
||||||
|
"app/node_modules"
|
||||||
|
],
|
||||||
|
"transform": {
|
||||||
|
"^.+\\.jsx?$": "babel-jest"
|
||||||
|
},
|
||||||
|
"setupFiles": [
|
||||||
|
"./internals/scripts/CheckBuildsExist.js"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.7.2",
|
||||||
|
"@babel/plugin-proposal-class-properties": "^7.7.0",
|
||||||
|
"@babel/plugin-proposal-decorators": "^7.7.0",
|
||||||
|
"@babel/plugin-proposal-do-expressions": "^7.6.0",
|
||||||
|
"@babel/plugin-proposal-export-default-from": "^7.5.2",
|
||||||
|
"@babel/plugin-proposal-export-namespace-from": "^7.5.2",
|
||||||
|
"@babel/plugin-proposal-function-bind": "^7.2.0",
|
||||||
|
"@babel/plugin-proposal-function-sent": "^7.7.0",
|
||||||
|
"@babel/plugin-proposal-json-strings": "^7.2.0",
|
||||||
|
"@babel/plugin-proposal-logical-assignment-operators": "^7.2.0",
|
||||||
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.2.0",
|
||||||
|
"@babel/plugin-proposal-numeric-separator": "^7.2.0",
|
||||||
|
"@babel/plugin-proposal-optional-chaining": "^7.6.0",
|
||||||
|
"@babel/plugin-proposal-pipeline-operator": "^7.5.0",
|
||||||
|
"@babel/plugin-proposal-throw-expressions": "^7.2.0",
|
||||||
|
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
||||||
|
"@babel/plugin-syntax-import-meta": "^7.2.0",
|
||||||
|
"@babel/plugin-transform-react-constant-elements": "^7.6.3",
|
||||||
|
"@babel/plugin-transform-react-inline-elements": "^7.2.0",
|
||||||
|
"@babel/preset-env": "^7.7.1",
|
||||||
|
"@babel/preset-flow": "^7.0.0",
|
||||||
|
"@babel/preset-react": "^7.7.0",
|
||||||
|
"@babel/register": "^7.7.0",
|
||||||
|
"babel-core": "7.0.0-bridge.0",
|
||||||
|
"babel-eslint": "^10.0.3",
|
||||||
|
"babel-jest": "^24.9.0",
|
||||||
|
"babel-loader": "^8.0.5",
|
||||||
|
"babel-plugin-dev-expression": "^0.2.2",
|
||||||
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
||||||
|
"chalk": "^3.0.0",
|
||||||
|
"concurrently": "^5.0.0",
|
||||||
|
"cross-env": "^6.0.3",
|
||||||
|
"cross-spawn": "^7.0.1",
|
||||||
|
"css-loader": "^3.2.0",
|
||||||
|
"detect-port": "^1.3.0",
|
||||||
|
"electron": "7.2.4",
|
||||||
|
"electron-builder": "^22.1.0",
|
||||||
|
"electron-devtools-installer": "^2.2.4",
|
||||||
|
"electron-rebuild": "^1.8.2",
|
||||||
|
"enzyme": "^3.7.0",
|
||||||
|
"enzyme-adapter-react-16": "^1.7.0",
|
||||||
|
"enzyme-to-json": "^3.3.4",
|
||||||
|
"eslint": "^6.6.0",
|
||||||
|
"eslint-config-airbnb": "^18.0.1",
|
||||||
|
"eslint-config-erb": "^0.1.1",
|
||||||
|
"eslint-config-prettier": "^6.6.0",
|
||||||
|
"eslint-formatter-pretty": "^3.0.0",
|
||||||
|
"eslint-import-resolver-webpack": "^0.11.0",
|
||||||
|
"eslint-plugin-compat": "^3.3.0",
|
||||||
|
"eslint-plugin-flowtype": "^4.4.1",
|
||||||
|
"eslint-plugin-import": "^2.18.2",
|
||||||
|
"eslint-plugin-jest": "^23.0.4",
|
||||||
|
"eslint-plugin-jsx-a11y": "6.2.3",
|
||||||
|
"eslint-plugin-prettier": "^3.1.1",
|
||||||
|
"eslint-plugin-promise": "^4.2.1",
|
||||||
|
"eslint-plugin-react": "^7.16.0",
|
||||||
|
"eslint-plugin-testcafe": "^0.2.1",
|
||||||
|
"fbjs-scripts": "^1.2.0",
|
||||||
|
"file-loader": "^4.2.0",
|
||||||
|
"flow-bin": "^0.112.0",
|
||||||
|
"flow-runtime": "^0.17.0",
|
||||||
|
"flow-typed": "^2.6.2",
|
||||||
|
"identity-obj-proxy": "^3.0.0",
|
||||||
|
"jest": "^24.9.0",
|
||||||
|
"lint-staged": "^9.4.3",
|
||||||
|
"mini-css-extract-plugin": "^0.8.0",
|
||||||
|
"node-sass": "^4.13.0",
|
||||||
|
"opencollective-postinstall": "^2.0.2",
|
||||||
|
"optimize-css-assets-webpack-plugin": "^5.0.3",
|
||||||
|
"prettier": "^1.19.1",
|
||||||
|
"react-test-renderer": "^16.12.0",
|
||||||
|
"redux-logger": "^3.0.6",
|
||||||
|
"rimraf": "^3.0.0",
|
||||||
|
"sass-loader": "^8.0.0",
|
||||||
|
"sinon": "^7.5.0",
|
||||||
|
"spectron": "^9.0.0",
|
||||||
|
"style-loader": "^1.0.0",
|
||||||
|
"stylelint": "^12.0.0",
|
||||||
|
"stylelint-config-prettier": "^6.0.0",
|
||||||
|
"stylelint-config-standard": "^19.0.0",
|
||||||
|
"terser-webpack-plugin": "^2.2.1",
|
||||||
|
"testcafe": "^1.6.1",
|
||||||
|
"testcafe-browser-provider-electron": "^0.0.12",
|
||||||
|
"testcafe-live": "^0.1.4",
|
||||||
|
"testcafe-react-selectors": "^3.3.0",
|
||||||
|
"url-loader": "^2.2.0",
|
||||||
|
"webpack": "^4.41.2",
|
||||||
|
"webpack-bundle-analyzer": "^3.6.0",
|
||||||
|
"webpack-cli": "^3.3.10",
|
||||||
|
"webpack-dev-server": "^3.9.0",
|
||||||
|
"webpack-merge": "^4.2.2",
|
||||||
|
"yarn": "^1.19.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@fortawesome/fontawesome-free": "^5.11.2",
|
||||||
|
"@hot-loader/react-dom": "^16.11.0",
|
||||||
|
"connected-react-router": "^6.6.0",
|
||||||
|
"core-js": "3.4.1",
|
||||||
|
"devtron": "^1.4.0",
|
||||||
|
"electron-debug": "^3.0.1",
|
||||||
|
"electron-log": "^3.0.9",
|
||||||
|
"electron-updater": "^4.2.0",
|
||||||
|
"formik": "^2.1.4",
|
||||||
|
"history": "^4.10.1",
|
||||||
|
"react": "^16.12.0",
|
||||||
|
"react-dom": "^16.12.0",
|
||||||
|
"react-hot-loader": "^4.12.18",
|
||||||
|
"react-redux": "^7.1.3",
|
||||||
|
"react-router": "^5.1.2",
|
||||||
|
"react-router-dom": "^5.1.2",
|
||||||
|
"redux": "^4.0.4",
|
||||||
|
"redux-thunk": "^2.3.0",
|
||||||
|
"source-map-support": "^0.5.16",
|
||||||
|
"yup": "^0.29.1"
|
||||||
|
},
|
||||||
|
"devEngines": {
|
||||||
|
"node": ">=7.x",
|
||||||
|
"npm": ">=4.x",
|
||||||
|
"yarn": ">=0.21.3"
|
||||||
|
},
|
||||||
|
"browserslist": "electron 1.6"
|
||||||
|
}
|
BIN
Dashboard/resources/icon.icns
Normal file
BIN
Dashboard/resources/icon.ico
Normal file
After Width: | Height: | Size: 361 KiB |
BIN
Dashboard/resources/icon.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
Dashboard/resources/icons/1024x1024.png
Normal file
After Width: | Height: | Size: 156 KiB |
BIN
Dashboard/resources/icons/128x128.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
Dashboard/resources/icons/16x16.png
Normal file
After Width: | Height: | Size: 954 B |
BIN
Dashboard/resources/icons/24x24.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
Dashboard/resources/icons/256x256.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
Dashboard/resources/icons/32x32.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
Dashboard/resources/icons/48x48.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
Dashboard/resources/icons/512x512.png
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
Dashboard/resources/icons/64x64.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
Dashboard/resources/icons/96x96.png
Normal file
After Width: | Height: | Size: 12 KiB |