From 9d4a38dd6192775d7502d630ff87c9dc0e0736c0 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sat, 11 May 2019 22:55:51 +0200 Subject: [PATCH] move app files --- .gitignore | 2 +- package.json | 14 ++++++++------ src/{ => app}/App.css | 0 src/{ => app}/App.jsx | 0 src/{ => app}/components/Account.jsx | 0 src/{ => app}/components/Animations.js | 0 src/{ => app}/components/Balance.css | 0 src/{ => app}/components/Balance.jsx | 0 src/{ => app}/components/Spinner.css | 0 src/{ => app}/components/Spinner.jsx | 0 src/{ => app}/components/Ticker.css | 0 src/{ => app}/components/Ticker.jsx | 0 src/{ => app}/components/Titlebar.css | 0 src/{ => app}/components/Titlebar.jsx | 0 src/{ => app}/components/Total.jsx | 2 +- src/{ => app}/components/Welcome.css | 0 src/{ => app}/components/Welcome.jsx | 0 config.js => src/app/config.js | 0 src/{ => app}/images/cog.svg | 0 src/{ => app}/images/icon.icns | Bin src/{ => app}/images/icon.ico | Bin src/{ => app}/images/icon1024.png | Bin src/{ => app}/images/rocket.svg | 0 src/{ => app}/index.js | 1 - src/{ => app}/screens/Home.css | 0 src/{ => app}/screens/Home.jsx | 0 src/{ => app}/screens/Preferences.css | 0 src/{ => app}/screens/Preferences.jsx | 0 src/{ => app}/store/AppProvider.jsx | 2 +- src/{ => app}/store/createContext.jsx | 0 src/{ => app}/util/fetch.js | 0 src/{ => app}/util/moneyFormatter.js | 0 src/{ => app}/util/openUrl.js | 0 src/main.js | 2 +- src/menu.js | 2 +- webpack.build.config.js | 14 -------------- webpack.common.config.js | 7 ++++--- webpack.dev.config.js | 4 +++- 38 files changed, 20 insertions(+), 30 deletions(-) rename src/{ => app}/App.css (100%) rename src/{ => app}/App.jsx (100%) rename src/{ => app}/components/Account.jsx (100%) rename src/{ => app}/components/Animations.js (100%) rename src/{ => app}/components/Balance.css (100%) rename src/{ => app}/components/Balance.jsx (100%) rename src/{ => app}/components/Spinner.css (100%) rename src/{ => app}/components/Spinner.jsx (100%) rename src/{ => app}/components/Ticker.css (100%) rename src/{ => app}/components/Ticker.jsx (100%) rename src/{ => app}/components/Titlebar.css (100%) rename src/{ => app}/components/Titlebar.jsx (100%) rename src/{ => app}/components/Total.jsx (96%) rename src/{ => app}/components/Welcome.css (100%) rename src/{ => app}/components/Welcome.jsx (100%) rename config.js => src/app/config.js (100%) rename src/{ => app}/images/cog.svg (100%) rename src/{ => app}/images/icon.icns (100%) rename src/{ => app}/images/icon.ico (100%) rename src/{ => app}/images/icon1024.png (100%) rename src/{ => app}/images/rocket.svg (100%) rename src/{ => app}/index.js (99%) rename src/{ => app}/screens/Home.css (100%) rename src/{ => app}/screens/Home.jsx (100%) rename src/{ => app}/screens/Preferences.css (100%) rename src/{ => app}/screens/Preferences.jsx (100%) rename src/{ => app}/store/AppProvider.jsx (99%) rename src/{ => app}/store/createContext.jsx (100%) rename src/{ => app}/util/fetch.js (100%) rename src/{ => app}/util/moneyFormatter.js (100%) rename src/{ => app}/util/openUrl.js (100%) delete mode 100644 webpack.build.config.js diff --git a/.gitignore b/.gitignore index a5cb2d2..03f0caf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ node_modules yarn.lock package-lock.json -builds +build dist diff --git a/package.json b/package.json index d8d7121..dc16487 100644 --- a/package.json +++ b/package.json @@ -7,12 +7,13 @@ "scripts": { "test": "eslint ./src/**/*.{js,jsx} && stylelint ./src/**/*.css", "start": "webpack-dev-server --hot --host 0.0.0.0 --config=./webpack.dev.config.js", - "build": "webpack --config webpack.build.config.js && npm run package", - "package": "npm run package:mac && npm run package:win && npm run package:linux && open ./builds", - "package:mac": "electron-packager . --overwrite --asar --platform=darwin --arch=x64 --icon=src/images/icon.icns --prune --out=./builds", - "package:linux": "electron-packager . --overwrite --asar --platform=linux --arch=x64 --icon=src/images/iconset/icon1024.png --prune --out=./builds", - "package:win": "electron-packager . --overwrite --asar --platform=win32 --arch=ia32 --icon=src/images/icon.ico --prune --out=./builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Ocean\"", - "create-installer-mac": "electron-installer-dmg ./builds/Ocean-darwin-x64/Ocean.app Ocean --out=./builds --overwrite --icon=src/images/icon.icns" + "build": "webpack --mode production --config webpack.common.config.js", + "package": "npm-run-all --parallel package:mac package:win package:linux && open ./dist", + "package:mac": "electron-packager . --overwrite --asar --platform=darwin --arch=x64 --icon=src/app/images/icon.icns --prune --out=./dist", + "package:linux": "electron-packager . --overwrite --asar --platform=linux --arch=x64 --icon=src/app/images/iconset/icon1024.png --prune --out=./dist", + "package:win": "electron-packager . --overwrite --asar --platform=win32 --arch=ia32 --icon=src/app/images/icon.ico --prune --out=./dist --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Ocean\"", + "create-installer-mac": "electron-installer-dmg ./dist/Ocean-darwin-x64/Ocean.app Ocean --out=./dist --overwrite --icon=src/app/images/icon.icns", + "dist": "npm run build && npm run package" }, "repository": "https://github.com/kremalicious/ocean-balance.git", "author": "Matthias Kretschmann", @@ -48,6 +49,7 @@ "eslint-plugin-react": "^7.13.0", "file-loader": "^3.0.1", "html-webpack-plugin": "^3.2.0", + "npm-run-all": "^4.1.5", "prettier": "^1.17.0", "prettier-stylelint": "^0.4.2", "style-loader": "^0.23.1", diff --git a/src/App.css b/src/app/App.css similarity index 100% rename from src/App.css rename to src/app/App.css diff --git a/src/App.jsx b/src/app/App.jsx similarity index 100% rename from src/App.jsx rename to src/app/App.jsx diff --git a/src/components/Account.jsx b/src/app/components/Account.jsx similarity index 100% rename from src/components/Account.jsx rename to src/app/components/Account.jsx diff --git a/src/components/Animations.js b/src/app/components/Animations.js similarity index 100% rename from src/components/Animations.js rename to src/app/components/Animations.js diff --git a/src/components/Balance.css b/src/app/components/Balance.css similarity index 100% rename from src/components/Balance.css rename to src/app/components/Balance.css diff --git a/src/components/Balance.jsx b/src/app/components/Balance.jsx similarity index 100% rename from src/components/Balance.jsx rename to src/app/components/Balance.jsx diff --git a/src/components/Spinner.css b/src/app/components/Spinner.css similarity index 100% rename from src/components/Spinner.css rename to src/app/components/Spinner.css diff --git a/src/components/Spinner.jsx b/src/app/components/Spinner.jsx similarity index 100% rename from src/components/Spinner.jsx rename to src/app/components/Spinner.jsx diff --git a/src/components/Ticker.css b/src/app/components/Ticker.css similarity index 100% rename from src/components/Ticker.css rename to src/app/components/Ticker.css diff --git a/src/components/Ticker.jsx b/src/app/components/Ticker.jsx similarity index 100% rename from src/components/Ticker.jsx rename to src/app/components/Ticker.jsx diff --git a/src/components/Titlebar.css b/src/app/components/Titlebar.css similarity index 100% rename from src/components/Titlebar.css rename to src/app/components/Titlebar.css diff --git a/src/components/Titlebar.jsx b/src/app/components/Titlebar.jsx similarity index 100% rename from src/components/Titlebar.jsx rename to src/app/components/Titlebar.jsx diff --git a/src/components/Total.jsx b/src/app/components/Total.jsx similarity index 96% rename from src/components/Total.jsx rename to src/app/components/Total.jsx index 3430ed6..b9016c4 100644 --- a/src/components/Total.jsx +++ b/src/app/components/Total.jsx @@ -1,7 +1,7 @@ import React, { PureComponent } from 'react' import { AppContext } from '../store/createContext' import Balance from './Balance' -import { prices } from '../../config' +import { prices } from '../config' const calculateTotalBalance = (accounts, currency) => { const balanceTotalArray = [] diff --git a/src/components/Welcome.css b/src/app/components/Welcome.css similarity index 100% rename from src/components/Welcome.css rename to src/app/components/Welcome.css diff --git a/src/components/Welcome.jsx b/src/app/components/Welcome.jsx similarity index 100% rename from src/components/Welcome.jsx rename to src/app/components/Welcome.jsx diff --git a/config.js b/src/app/config.js similarity index 100% rename from config.js rename to src/app/config.js diff --git a/src/images/cog.svg b/src/app/images/cog.svg similarity index 100% rename from src/images/cog.svg rename to src/app/images/cog.svg diff --git a/src/images/icon.icns b/src/app/images/icon.icns similarity index 100% rename from src/images/icon.icns rename to src/app/images/icon.icns diff --git a/src/images/icon.ico b/src/app/images/icon.ico similarity index 100% rename from src/images/icon.ico rename to src/app/images/icon.ico diff --git a/src/images/icon1024.png b/src/app/images/icon1024.png similarity index 100% rename from src/images/icon1024.png rename to src/app/images/icon1024.png diff --git a/src/images/rocket.svg b/src/app/images/rocket.svg similarity index 100% rename from src/images/rocket.svg rename to src/app/images/rocket.svg diff --git a/src/index.js b/src/app/index.js similarity index 99% rename from src/index.js rename to src/app/index.js index 181b021..4911bcf 100644 --- a/src/index.js +++ b/src/app/index.js @@ -1,6 +1,5 @@ import React from 'react' import { render } from 'react-dom' - import App from './App' document.body.style.backgroundColor = '#141414' diff --git a/src/screens/Home.css b/src/app/screens/Home.css similarity index 100% rename from src/screens/Home.css rename to src/app/screens/Home.css diff --git a/src/screens/Home.jsx b/src/app/screens/Home.jsx similarity index 100% rename from src/screens/Home.jsx rename to src/app/screens/Home.jsx diff --git a/src/screens/Preferences.css b/src/app/screens/Preferences.css similarity index 100% rename from src/screens/Preferences.css rename to src/app/screens/Preferences.css diff --git a/src/screens/Preferences.jsx b/src/app/screens/Preferences.jsx similarity index 100% rename from src/screens/Preferences.jsx rename to src/app/screens/Preferences.jsx diff --git a/src/store/AppProvider.jsx b/src/app/store/AppProvider.jsx similarity index 99% rename from src/store/AppProvider.jsx rename to src/app/store/AppProvider.jsx index 1fe78c5..f83be32 100644 --- a/src/store/AppProvider.jsx +++ b/src/app/store/AppProvider.jsx @@ -4,7 +4,7 @@ import ms from 'ms' import Store from 'electron-store' import { AppContext } from './createContext' import fetchData from '../util/fetch' -import { refreshInterval, prices, oceanTokenContract } from '../../config' +import { refreshInterval, prices, oceanTokenContract } from '../config' export default class AppProvider extends PureComponent { static propTypes = { diff --git a/src/store/createContext.jsx b/src/app/store/createContext.jsx similarity index 100% rename from src/store/createContext.jsx rename to src/app/store/createContext.jsx diff --git a/src/util/fetch.js b/src/app/util/fetch.js similarity index 100% rename from src/util/fetch.js rename to src/app/util/fetch.js diff --git a/src/util/moneyFormatter.js b/src/app/util/moneyFormatter.js similarity index 100% rename from src/util/moneyFormatter.js rename to src/app/util/moneyFormatter.js diff --git a/src/util/openUrl.js b/src/app/util/openUrl.js similarity index 100% rename from src/util/openUrl.js rename to src/app/util/openUrl.js diff --git a/src/main.js b/src/main.js index 1684f8f..1c1998b 100644 --- a/src/main.js +++ b/src/main.js @@ -40,7 +40,7 @@ const createWindow = async () => { mainWindow.loadURL( isDev ? 'http://localhost:8080' - : `file://${path.join(__dirname, '../dist/index.html')}` + : `file://${path.join(__dirname, '../build/index.html')}` ) if (isDev) { diff --git a/src/menu.js b/src/menu.js index 9b6e157..6f3b053 100644 --- a/src/menu.js +++ b/src/menu.js @@ -1,5 +1,5 @@ const { app, Menu } = require('electron') -const { openUrl } = require('./util/openUrl') +const { openUrl } = require('./app/util/openUrl') const template = [ { diff --git a/webpack.build.config.js b/webpack.build.config.js deleted file mode 100644 index 6d0f4af..0000000 --- a/webpack.build.config.js +++ /dev/null @@ -1,14 +0,0 @@ -const common = require('./webpack.common.config') - -module.exports = Object.assign({}, common, { - mode: 'production', - output: { - publicPath: './' - }, - stats: { - colors: true, - children: false, - chunks: false, - modules: false - } -}) diff --git a/webpack.common.config.js b/webpack.common.config.js index 5216959..14dcfaa 100644 --- a/webpack.common.config.js +++ b/webpack.common.config.js @@ -5,10 +5,11 @@ const HtmlWebpackPlugin = require('html-webpack-plugin') const defaultInclude = [path.resolve(__dirname, 'src')] module.exports = { - entry: path.resolve(__dirname, 'src') + '/index.js', + entry: path.resolve(__dirname, 'src') + '/app/index.js', output: { - path: path.resolve(__dirname, 'dist'), - filename: 'bundle.js' + path: path.resolve(__dirname, 'build'), + filename: 'bundle.js', + publicPath: './' }, module: { rules: [ diff --git a/webpack.dev.config.js b/webpack.dev.config.js index a54bce8..bd1fe60 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -5,11 +5,13 @@ const { spawn } = require('child_process') module.exports = Object.assign({}, common, { mode: 'development', output: { + path: path.resolve(__dirname, 'build'), + filename: 'bundle.js', publicPath: '/' }, devtool: 'cheap-source-map', devServer: { - contentBase: path.resolve(__dirname, 'dist'), + contentBase: path.resolve(__dirname, 'build'), stats: 'minimal', before: () => { spawn('electron', ['.'], {