Added (hot)dev modes.

This commit is contained in:
Kylart 2017-03-17 23:16:13 +01:00
parent 2d49cc2031
commit 1455f86b6f
3 changed files with 21 additions and 3 deletions

View File

@ -6,6 +6,11 @@
*
*/
if (process.env.NODE_ENV === 'development')
console.log('%cKawAnime is running in development mode.',
'color:green; ' +
'font-size:13px;')
const path = require('path')
window.Vue = require(path.join(__dirname, 'node_modules', 'vue', 'dist', 'vue.js'))

12
main.js
View File

@ -16,6 +16,11 @@ let mainWindow
let newsWindow
const BASE_PATH = os.userInfo().homedir
if (process.env.NODE_ENV === 'hotDevelopment')
require('electron-reload')(__dirname, {
electron: path.join(__dirname, 'node_modules', '.bin', 'electron')
})
function createWindow() {
// Create the directory to download files
const dir = path.join(BASE_PATH, '.KawAnime')
@ -61,7 +66,12 @@ function createWindow() {
// Some APIs can only be used after this event occurs.
app.on('ready', () => {
createWindow()
if (process.env.NODE_ENV !== 'production') require('vue-devtools').install()
// Dev tools
if (process.env.NODE_ENV !== 'production')
{
require('vue-devtools').install()
}
})
// Quit when all windows are closed.

View File

@ -5,6 +5,8 @@
"main": "main.js",
"scripts": {
"start": "electron .",
"dev": "NODE_ENV=development electron .",
"hotDev": "NODE_ENV=hotDevelopment electron .",
"pack": "build --dir",
"dist": "build -mwl",
"helpBuild": "echo 'https://github.com/electron-userland/electron-builder#cli-usage'"
@ -20,7 +22,9 @@
"license": "MIT",
"devDependencies": {
"electron": "^1.4.15",
"electron-builder": "^15.4.3"
"electron-builder": "^15.6.2",
"electron-reload": "^1.1.0",
"vue-devtools": "^3.0.8"
},
"dependencies": {
"find-remove": "^1.0.0",
@ -32,7 +36,6 @@
"parse-torrent": "^5.8.1",
"play-sound": "^1.1.1",
"request": "latest",
"vue-devtools": "^3.0.8",
"vue-material": "^0.7.1"
},
"build": {