Skip to content

Commit

Permalink
Merge pull request #131 from nwittwer/dev
Browse files Browse the repository at this point in the history
0.6.5
  • Loading branch information
nwittwer authored Aug 31, 2019
2 parents 832e3ad + 440785e commit f378504
Show file tree
Hide file tree
Showing 22 changed files with 488 additions and 301 deletions.
74 changes: 37 additions & 37 deletions .electron-vue/dev-client.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
// const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')

hotClient.subscribe(event => {
/**
* Reload browser when HTMLWebpackPlugin emits a new index.html
*
* Currently disabled until jantimon/html-webpack-plugin#680 is resolved.
* https://github.com/SimulatedGREG/electron-vue/issues/437
* https://github.com/jantimon/html-webpack-plugin/issues/680
*/
// if (event.action === 'reload') {
// window.location.reload()
// }
// hotClient.subscribe(event => {
// /**
// * Reload browser when HTMLWebpackPlugin emits a new index.html
// *
// * Currently disabled until jantimon/html-webpack-plugin#680 is resolved.
// * https://github.com/SimulatedGREG/electron-vue/issues/437
// * https://github.com/jantimon/html-webpack-plugin/issues/680
// */
// if (event.action === 'reload') {
// window.location.reload()
// }

/**
* Notify `mainWindow` when `main` process is compiling,
* giving notice for an expected reload of the `electron` process
*/
if (event.action === 'compiling') {
document.body.innerHTML += `
<style>
#dev-client {
background: #4fc08d;
border-radius: 4px;
bottom: 20px;
box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
color: #fff;
font-family: 'Source Sans Pro', sans-serif;
left: 20px;
padding: 8px 12px;
position: absolute;
}
</style>
// /**
// * Notify `mainWindow` when `main` process is compiling,
// * giving notice for an expected reload of the `electron` process
// */
// if (event.action === 'compiling') {
// document.body.innerHTML += `
// <style>
// #dev-client {
// background: #4fc08d;
// border-radius: 4px;
// bottom: 20px;
// box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
// color: #fff;
// font-family: 'Source Sans Pro', sans-serif;
// left: 20px;
// padding: 8px 12px;
// position: absolute;
// }
// </style>

<div id="dev-client">
Compiling Main Process...
</div>
`
}
})
// <div id="dev-client">
// Compiling Main Process...
// </div>
// `
// }
// })
50 changes: 29 additions & 21 deletions .electron-vue/dev-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const {
} = require('child_process')
const webpack = require('webpack')
const WebpackDevServer = require('webpack-dev-server')
const webpackHotMiddleware = require('webpack-hot-middleware')
// const webpackHotMiddleware = require('webpack-hot-middleware')

const mainConfig = require('./webpack.main.config')
const rendererConfig = require('./webpack.renderer.config')
Expand Down Expand Up @@ -46,15 +46,16 @@ function startRenderer() {
return new Promise((resolve, reject) => {
rendererConfig.entry.renderer = [path.join(__dirname, 'dev-client')].concat(rendererConfig.entry.renderer)
rendererConfig.mode = 'development'

const compiler = webpack(rendererConfig)
hotMiddleware = webpackHotMiddleware(compiler, {
log: false,
heartbeat: 2500,
// logLevel: 'debug'
})

// hotMiddleware = webpackHotMiddleware(compiler, {
// heartbeat: 2500,
// logLevel: 'debug',
// quiet: true
// })

// Original
// Webpack 3
// compiler.hooks.compilation.tap('compilation', compilation => {
// compilation.hooks.htmlWebpackPluginAfterEmit.tapAsync('html-webpack-plugin-after-emit', (data, cb) => {
// hotMiddleware.publish({
Expand All @@ -64,27 +65,34 @@ function startRenderer() {
// })
// })

// Webpack 4
compiler.hooks.compilation.tap('html-webpack-plugin-after-emit', () => {
hotMiddleware.publish({
action: 'reload'
});
});
// compiler.hooks.compilation.tap('compilation', (compilation) => {
// HtmlWebpackPlugin.getHooks(compilation).beforeEmit.tapAsync(
// 'html-webpack-plugin',
// (data, cb) => {
// hotMiddleware.publish({
// action: 'reload'
// });

// // Tell webpack to move on
// cb()
// }
// )
// })

compiler.hooks.done.tap('done', stats => {
logStats('Renderer', stats)
})

// Create a Webpack Dev Server
const server = new WebpackDevServer(
compiler, {
contentBase: path.join(__dirname, '../'),
quiet: true,
// logLevel: 'debug',
logLevel: 'debug',
hot: true,
port: 9080,
before(app, ctx) {
app.use(hotMiddleware)
ctx.middleware.waitUntilValid(() => {
resolve()
})
resolve()
}
}
)
Expand All @@ -101,9 +109,9 @@ function startMain() {

compiler.hooks.watchRun.tapAsync('watch-run', (compilation, done) => {
logStats('Main', chalk.white.bold('compiling...'))
hotMiddleware.publish({
action: 'compiling'
})
// hotMiddleware.publish({
// action: 'compiling'
// })
done()
})

Expand Down
12 changes: 1 addition & 11 deletions .electron-vue/webpack.web.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ let webConfig = {
test: /\.scss$/,
use: ['vue-style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.sass$/,
use: ['vue-style-loader', 'css-loader', 'sass-loader?indentedSyntax']
},
{
test: /\.less$/,
use: ['vue-style-loader', 'css-loader', 'less-loader']
},
{
test: /\.css$/,
use: ['vue-style-loader', 'css-loader']
Expand All @@ -64,9 +56,7 @@ let webConfig = {
options: {
extractCSS: true,
loaders: {
sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax=1',
scss: 'vue-style-loader!css-loader!sass-loader',
less: 'vue-style-loader!css-loader!less-loader'
scss: 'vue-style-loader!css-loader!sass-loader'
}
}
}
Expand Down
39 changes: 21 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "reflex",
"productName": "Reflex",
"description": "Make responsive websites without the guesswork.",
"version": "0.6.4",
"version": "0.6.5",
"author": "Nick Wittwer",
"license": "MIT",
"main": "./dist/electron/main.js",
Expand Down Expand Up @@ -74,12 +74,15 @@
},
"dependencies": {
"@simonwep/selection-js": "^1.2.0",
"babel-preset-minify": "^0.5.1",
"browser-sync": "^2.26.7",
"electron-debug": "^3.0.1",
"electron-is-dev": "^1.1.0",
"electron-log": "^3.0.7",
"electron-updater": "^4.1.2",
"is-electron": "^2.2.0",
"lodash.debounce": "^4.0.8",
"uuid": "^3.3.3",
"vue": "^2.6.10",
"vue-electron": "^1.0.6",
"vue-router": "^3.1.2",
Expand All @@ -93,49 +96,49 @@
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/runtime": "^7.5.5",
"@vue/cli": "^3.10.0",
"@vue/cli": "^3.11.0",
"@vue/test-utils": "^1.0.0-beta.29",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.2",
"babel-jest": "^24.8.0",
"babel-eslint": "^10.0.3",
"babel-jest": "^24.9.0",
"babel-loader": "^8.0.6",
"babel-minify-webpack-plugin": "^0.3.1",
"babel-plugin-require-context-hook": "^1.0.0",
"browser-sync-webpack-plugin": "^2.2.2",
"cfonts": "^2.4.4",
"cfonts": "^2.4.5",
"chalk": "^2.4.2",
"copy-webpack-plugin": "^5.0.4",
"cross-env": "^5.1.6",
"css-loader": "^3.2.0",
"del": "^5.0.0",
"del": "^5.1.0",
"devtron": "^1.4.0",
"electron": "^6.0.1",
"electron": "^6.0.4",
"electron-builder": "^21.2.0",
"electron-devtools-installer": "^2.2.4",
"eslint": "^6.1.0",
"eslint-config-standard": "^13.0.1",
"eslint": "^6.3.0",
"eslint-config-standard": "^14.1.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^2.2.1",
"eslint-loader": "^3.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-node": "^9.2.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-vue": "^5.2.3",
"file-loader": "^4.2.0",
"gulp": "^4.0.2",
"gulp-hub": "^4.2.0",
"gulp-notify": "^3.2.0",
"gulp-replace": "^1.0.0",
"html-webpack-plugin": "^3.2.0",
"jest": "^24.8.0",
"html-webpack-plugin": "^4.0.0-beta.8",
"jest": "^24.9.0",
"jest-vue-preprocessor": "^1.5.0",
"mini-css-extract-plugin": "^0.8.0",
"moment": "^2.24.0",
"multispinner": "^0.2.1",
"node-loader": "^0.6.0",
"node-sass": "^4.12.0",
"opn": "^6.0.0",
"sass-loader": "^7.2.0",
"sass-loader": "^8.0.0",
"style-loader": "^1.0.0",
"url-loader": "^2.1.0",
"vue-eslint-parser": "^6.0.4",
Expand All @@ -144,10 +147,10 @@
"vue-loader": "^15.7.1",
"vue-style-loader": "^4.1.0",
"vue-template-compiler": "^2.6.10",
"webpack": "^4.39.2",
"webpack-cli": "^3.3.6",
"webpack": "^4.39.3",
"webpack-cli": "^3.3.7",
"webpack-dev-server": "^3.8.0",
"webpack-hot-middleware": "^2.25.0",
"webpack-merge": "^4.1.3"
"webpack-merge": "^4.2.2"
}
}
Binary file modified screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
version
} from '../../package.json'
const log = require('electron-log')
const isDev = require('electron-is-dev')

// Set the version
app.getVersion = () => version
Expand All @@ -27,7 +28,7 @@ if (process.env.NODE_ENV !== 'development') {
}

let mainWindow
const winURL = process.env.NODE_ENV === 'development'
const winURL = isDev
? `http://localhost:9080`
: `file://${__dirname}/index.html`

Expand Down
Loading

0 comments on commit f378504

Please sign in to comment.