Skip to content

Commit

Permalink
Refurbish app
Browse files Browse the repository at this point in the history
  • Loading branch information
NickHatBoecker committed May 8, 2021
1 parent 2ad4abb commit 06f709a
Show file tree
Hide file tree
Showing 37 changed files with 9,860 additions and 14,266 deletions.
16 changes: 16 additions & 0 deletions .electron-vue/build.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const path = require('path')

/**
* `electron-packager` options
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-electron-packager.html
*/
module.exports = {
arch: 'x64',
asar: true,
dir: path.join(__dirname, '../'),
icon: path.join(__dirname, '../build/icons/icon'),
ignore: /(^\/(src|test|\.[a-z]+|README|yarn|static|dist\/web))|\.gitkeep/,
out: path.join(__dirname, '../build'),
overwrite: true,
platform: process.env.BUILD_TARGET || 'all'
}
97 changes: 60 additions & 37 deletions .electron-vue/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ process.env.NODE_ENV = 'production'
const { say } = require('cfonts')
const chalk = require('chalk')
const del = require('del')
const { spawn } = require('child_process')
const packager = require('electron-packager')
const webpack = require('webpack')
const Multispinner = require('multispinner')

const Listr = require('listr')

const buildConfig = require('./build.config')
const mainConfig = require('./webpack.main.config')
const rendererConfig = require('./webpack.renderer.config')
const webConfig = require('./webpack.web.config')
Expand All @@ -29,45 +29,56 @@ function clean () {
process.exit()
}

function build () {
async 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)
})
const tasks = new Listr(
[
{
title: 'building master process',
task: async () => {
await pack(mainConfig)
.then(result => {
results += result + '\n\n'
})
.catch(err => {
console.log(`\n ${errorLog}failed to build main process`)
console.error(`\n${err}\n`)
})
}
},
{
title: 'building renderer process',
task: async () => {
await pack(rendererConfig)
.then(result => {
results += result + '\n\n'
})
.catch(err => {
console.log(`\n ${errorLog}failed to build renderer process`)
console.error(`\n${err}\n`)
})
}
}
],
{ concurrent: 2 }
)

await tasks
.run()
.then(() => {
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()
})
.catch(err => {
process.exit(1)
})
}

function pack (config) {
Expand Down Expand Up @@ -98,6 +109,18 @@ function pack (config) {
})
}

function bundleApp () {
buildConfig.mode = 'production'
packager(buildConfig, (err, appPaths) => {
if (err) {
console.log(`\n${errorLog}${chalk.yellow('`electron-packager`')} says...\n`)
console.log(err + '\n')
} else {
console.log(`\n${doneLog}\n`)
}
})
}

function web () {
del.sync(['dist/web/*', '!.gitkeep'])
webConfig.mode = 'production'
Expand Down Expand Up @@ -129,4 +152,4 @@ function greeting () {
})
} else console.log(chalk.yellow.bold('\n lets-build'))
console.log()
}
}
3 changes: 2 additions & 1 deletion .electron-vue/dev-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ function startRenderer () {
{
contentBase: path.join(__dirname, '../'),
quiet: true,
hot: true,
before (app, ctx) {
app.use(hotMiddleware)
// app.use(hotMiddleware)
ctx.middleware.waitUntilValid(() => {
resolve()
})
Expand Down
4 changes: 2 additions & 2 deletions .electron-vue/webpack.main.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const path = require('path')
const { dependencies } = require('../package.json')
const webpack = require('webpack')

const BabiliWebpackPlugin = require('babili-webpack-plugin')
const MinifyPlugin = require("babel-minify-webpack-plugin")

let mainConfig = {
entry: {
Expand Down Expand Up @@ -73,7 +73,7 @@ if (process.env.NODE_ENV !== 'production') {
*/
if (process.env.NODE_ENV === 'production') {
mainConfig.plugins.push(
new BabiliWebpackPlugin(),
new MinifyPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
})
Expand Down
20 changes: 16 additions & 4 deletions .electron-vue/webpack.renderer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const path = require('path')
const { dependencies } = require('../package.json')
const webpack = require('webpack')

const BabiliWebpackPlugin = require('babili-webpack-plugin')
const MinifyPlugin = require("babel-minify-webpack-plugin")
const CopyWebpackPlugin = require('copy-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
Expand All @@ -19,7 +19,7 @@ const { VueLoaderPlugin } = require('vue-loader')
* that provide pure *.vue files that need compiling
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals
*/
let whiteListedModules = ['vue', 'vuetify']
let whiteListedModules = ['vue', 'bootstrap-vue']

let rendererConfig = {
devtool: '#cheap-module-eval-source-map',
Expand Down Expand Up @@ -125,6 +125,18 @@ let rendererConfig = {
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.resolve(__dirname, '../src/index.ejs'),
templateParameters(compilation, assets, options) {
return {
compilation: compilation,
webpack: compilation.getStats().toJson(),
webpackConfig: compilation.options,
htmlWebpackPlugin: {
files: assets,
options: options,
},
process,
};
},
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
Expand All @@ -134,7 +146,6 @@ let rendererConfig = {
? path.resolve(__dirname, '../node_modules')
: false
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin()
],
output: {
Expand All @@ -157,6 +168,7 @@ let rendererConfig = {
*/
if (process.env.NODE_ENV !== 'production') {
rendererConfig.plugins.push(
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
'__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
})
Expand All @@ -170,7 +182,7 @@ if (process.env.NODE_ENV === 'production') {
rendererConfig.devtool = ''

rendererConfig.plugins.push(
new BabiliWebpackPlugin(),
new MinifyPlugin(),
new CopyWebpackPlugin([
{
from: path.join(__dirname, '../static'),
Expand Down
16 changes: 14 additions & 2 deletions .electron-vue/webpack.web.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ process.env.BABEL_ENV = 'web'
const path = require('path')
const webpack = require('webpack')

const BabiliWebpackPlugin = require('babili-webpack-plugin')
const MinifyPlugin = require("babel-minify-webpack-plugin")
const CopyWebpackPlugin = require('copy-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
Expand Down Expand Up @@ -97,6 +97,18 @@ let webConfig = {
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.resolve(__dirname, '../src/index.ejs'),
templateParameters(compilation, assets, options) {
return {
compilation: compilation,
webpack: compilation.getStats().toJson(),
webpackConfig: compilation.options,
htmlWebpackPlugin: {
files: assets,
options: options,
},
process,
};
},
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
Expand Down Expand Up @@ -131,7 +143,7 @@ if (process.env.NODE_ENV === 'production') {
webConfig.devtool = ''

webConfig.plugins.push(
new BabiliWebpackPlugin(),
new MinifyPlugin(),
new CopyWebpackPlugin([
{
from: path.join(__dirname, '../static'),
Expand Down
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
**/*
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = {
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,

"indent": ["error", 4]
'indent': ['error', 4],
'comma-dangle': ['error', 'always-multiline'],
}
}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
.DS_Store
dist/*
dist/electron/*
dist/web/*
build/*
!build/icons
node_modules/
npm-debug.log
npm-debug.log.*
thumbs.db
!.gitkeep
src/renderer/data/*
deploy-it-darwin-x64/*
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# Deploy-it!
# deploy-it

> An electron-vue app to deploy your projects with a click of a button.
> An electron-vue app to deploy your projects with a click of a button on MacOS.
<img src="https://github.com/theskyliner/deploy-it/raw/master/screenshots/2.jpg" width="100%">
**ATTENTION**: This was only tested on MacOS.

#### Build Setup

``` bash
# install dependencies
npm install
yarn

# serve with hot reload at localhost:9080
npm run dev
yarn dev

# build electron application for production
npm run build
# build electron application for MacOS
yarn run build:macos

# lint all JS/Vue component files in `src/`
npm run lint

```

#### Projects.json
#### Projects.json example

```json
[
Expand All @@ -41,4 +41,4 @@ npm run lint

---

This project was generated with [electron-vue](https://github.com/SimulatedGREG/electron-vue)@[8fae476](https://github.com/SimulatedGREG/electron-vue/tree/8fae4763e9d225d3691b627e83b9e09b56f6c935) using [vue-cli](https://github.com/vuejs/vue-cli). Documentation about the original structure can be found [here](https://simulatedgreg.gitbooks.io/electron-vue/content/index.html).
This project was generated with [electron-vue](https://github.com/SimulatedGREG/electron-vue)@[8d4ed60](https://github.com/SimulatedGREG/electron-vue/tree/8d4ed607d65300381a8f47d97923eb07832b1a9a) using [vue-cli](https://github.com/vuejs/vue-cli). Documentation about the original structure can be found [here](https://simulatedgreg.gitbooks.io/electron-vue/content/index.html).
Loading

0 comments on commit 06f709a

Please sign in to comment.