Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved to Electron #103

Merged
merged 47 commits into from
Feb 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
6b27673
Added eslint files
nwittwer Jan 29, 2019
04f8734
Updated babelrc
nwittwer Jan 29, 2019
5830687
Updated gitignore
nwittwer Jan 29, 2019
4dfe9fe
Added .electron-vue scripts
nwittwer Jan 29, 2019
aba93f8
Updated vscode debug script
nwittwer Jan 29, 2019
e63041d
Added icons placeholders
nwittwer Jan 29, 2019
514079d
Removed old JS files
nwittwer Jan 29, 2019
7e21b30
Moved assets/scss
nwittwer Jan 29, 2019
2582633
Main process scripts
nwittwer Jan 29, 2019
637e5ad
Added updated homepage template/renderer
nwittwer Jan 29, 2019
cdfe28f
Separated out Store into modules
nwittwer Jan 29, 2019
6c8a08c
Re-added assets
nwittwer Jan 29, 2019
9fb62c2
SCSS
nwittwer Jan 29, 2019
a921514
Components
nwittwer Jan 29, 2019
2712edc
Added Router
nwittwer Jan 29, 2019
b4c8405
Added MainView as primary view
nwittwer Jan 29, 2019
0b693de
Re-added utils
nwittwer Jan 29, 2019
7c745d0
gitkeep /static
nwittwer Jan 29, 2019
3f5559e
Move to single package.json
nwittwer Jan 29, 2019
17e2c53
Removed public folder
nwittwer Jan 29, 2019
bf2ea69
Added meta tags to index template
nwittwer Jan 29, 2019
d238fdc
Updated eslint-plugin-html to fix lint:fix task
nwittwer Jan 29, 2019
46c9328
lint:fix
nwittwer Jan 29, 2019
c1dd9dd
Removed old gulp tasks
nwittwer Jan 29, 2019
870d39f
Updated window height/width on launch
nwittwer Jan 29, 2019
56ee341
Updated example env
nwittwer Jan 29, 2019
42f7599
WIP simplified Gulp
nwittwer Jan 29, 2019
ac1e2d8
Updated icns
nwittwer Jan 29, 2019
621f93a
Capitalized "Reflex" on index
nwittwer Jan 29, 2019
32cafda
Removed other icons
nwittwer Jan 29, 2019
6337dee
Updated project name and id in build
nwittwer Jan 29, 2019
555d8cc
Added Gulp packages
nwittwer Jan 29, 2019
6488de3
Build for Windows
nwittwer Jan 29, 2019
cae9b68
Removed code signing from gulp task
nwittwer Jan 29, 2019
00892ee
Added WIP notes to build-app task
nwittwer Jan 29, 2019
0ff7303
Added icon for Windows (temporary)
nwittwer Jan 29, 2019
f0ebd83
Updated readme
nwittwer Jan 31, 2019
086b80a
WIP adding browser-sync
nwittwer Feb 1, 2019
fd04853
Most likely fixed browser-sync build issue
nwittwer Feb 1, 2019
e8b0d46
BrowserSync working!
nwittwer Feb 1, 2019
18bc9ee
Lint:fix
nwittwer Feb 1, 2019
57a7e16
Updated sync file
nwittwer Feb 1, 2019
00f74f6
Added Vue lint fixing
nwittwer Feb 1, 2019
98e4bbd
Lint:fix
nwittwer Feb 1, 2019
e6e795e
Updated launch.json
nwittwer Feb 1, 2019
79ced50
Removed unnecessary ipcMain use
nwittwer Feb 1, 2019
f93b5c2
Added "Fit to Screen" menu item
nwittwer Feb 1, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 39 additions & 11 deletions .babelrc
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,13 +1,41 @@
{
"presets": [
["env", { "modules": false }]
],
{
"comments": false,
"env": {
"test": {
"presets": [
["env", { "targets": { "node": "current" }}]
]
}
}
"env": {
"main": {
"presets": [
["env", {
"targets": {
"node": 7
}
}],
"stage-0"
]
},
"renderer": {
"presets": [
["env", {
"modules": false
}],
"stage-0"
]
},
"web": {
"presets": [
["env", {
"modules": false
}],
"stage-0"
]
},
"test": {
"presets": [
["env", {
"targets": {
"node": "current"
}
}]
]
}
},
"plugins": ["transform-runtime"]
}
132 changes: 132 additions & 0 deletions .electron-vue/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
'use strict'

process.env.NODE_ENV = 'production'

const { say } = require('cfonts')
const chalk = require('chalk')
const del = require('del')
const { spawn } = require('child_process')
const webpack = require('webpack')
const Multispinner = require('multispinner')


const mainConfig = require('./webpack.main.config')
const rendererConfig = require('./webpack.renderer.config')
const webConfig = require('./webpack.web.config')

const doneLog = chalk.bgGreen.white(' DONE ') + ' '
const errorLog = chalk.bgRed.white(' ERROR ') + ' '
const okayLog = chalk.bgBlue.white(' OKAY ') + ' '
const isCI = process.env.CI || false

if (process.env.BUILD_TARGET === 'clean') clean()
else if (process.env.BUILD_TARGET === 'web') web()
else build()

function clean () {
del.sync(['build/*', '!build/icons', '!build/icons/icon.*'])
console.log(`\n${doneLog}\n`)
process.exit()
}

function build () {
greeting()

del.sync(['dist/electron/*', '!.gitkeep'])

const tasks = ['main', 'renderer']
const m = new Multispinner(tasks, {
preText: 'building',
postText: 'process'
})

let results = ''

m.on('success', () => {
process.stdout.write('\x1B[2J\x1B[0f')
console.log(`\n\n${results}`)
console.log(`${okayLog}take it away ${chalk.yellow('`electron-builder`')}\n`)
process.exit()
})

pack(mainConfig).then(result => {
results += result + '\n\n'
m.success('main')
}).catch(err => {
m.error('main')
console.log(`\n ${errorLog}failed to build main process`)
console.error(`\n${err}\n`)
process.exit(1)
})

pack(rendererConfig).then(result => {
results += result + '\n\n'
m.success('renderer')
}).catch(err => {
m.error('renderer')
console.log(`\n ${errorLog}failed to build renderer process`)
console.error(`\n${err}\n`)
process.exit(1)
})
}

function pack (config) {
return new Promise((resolve, reject) => {
config.mode = 'production'
webpack(config, (err, stats) => {
if (err) reject(err.stack || err)
else if (stats.hasErrors()) {
let err = ''

stats.toString({
chunks: false,
colors: true
})
.split(/\r?\n/)
.forEach(line => {
err += ` ${line}\n`
})

reject(err)
} else {
resolve(stats.toString({
chunks: false,
colors: true
}))
}
})
})
}

function web () {
del.sync(['dist/web/*', '!.gitkeep'])
webConfig.mode = 'production'
webpack(webConfig, (err, stats) => {
if (err || stats.hasErrors()) console.log(err)

console.log(stats.toString({
chunks: false,
colors: true
}))

process.exit()
})
}

function greeting () {
const cols = process.stdout.columns
let text = ''

if (cols > 85) text = 'lets-build'
else if (cols > 60) text = 'lets-|build'
else text = false

if (text && !isCI) {
say(text, {
colors: ['yellow'],
font: 'simple3d',
space: false
})
} else console.log(chalk.yellow.bold('\n lets-build'))
console.log()
}
40 changes: 40 additions & 0 deletions .electron-vue/dev-client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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()
// }

/**
* 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>
`
}
})
Loading