Skip to content

Commit

Permalink
add build and package script
Browse files Browse the repository at this point in the history
  • Loading branch information
trazyn committed Aug 23, 2017
1 parent 5683629 commit ef2f6f3
Show file tree
Hide file tree
Showing 50 changed files with 146,906 additions and 1,231 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ project.xcworkspace
# Android/IntelliJ
#
build/
release/
.idea
.gradle
local.properties
Expand Down
48 changes: 48 additions & 0 deletions config/webpack.config.electron.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

import webpack from 'webpack';
import config from './index';
import baseConfig from './webpack.config.base';

export default {

...baseConfig,

devtool: 'source-map',

entry: [
'babel-polyfill',
`./main.js`,
],

output: {
path: config.dist,
filename: 'main.js'
},

plugins: [
// Minify the output
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
}),

// NODE_ENV should be production so that modules do not perform certain development checks
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
],

// https://github.com/chentsulin/webpack-target-electron-renderer#how-this-module-works
target: 'electron-main',

/**
* Disables webpack processing of __dirname and __filename.
* If you run the bundle in node.js it falls back to these values of node.js.
* https://github.com/webpack/webpack/issues/2010
*/
node: {
__dirname: false,
__filename: false
}
};
64 changes: 64 additions & 0 deletions config/webpack.config.production.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

import path from 'path';
import webpack from 'webpack';
import config from './index';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import baseConfig from './webpack.config.base';

export default {

...baseConfig,

devtool: 'cheap-module-source-map',

entry: [
'babel-polyfill',
`${config.client}/app.js`,
],

output: {
path: config.dist,
filename: 'app.[hash].js'
},

plugins: [
// https://webpack.github.io/docs/list-of-plugins.html#occurrenceorderplugin
// https://github.com/webpack/webpack/issues/864
new webpack.optimize.OccurrenceOrderPlugin(),

// NODE_ENV should be production so that modules do not perform certain development checks
new webpack.DefinePlugin({
DEBUG: false,
'process.env.NODE_ENV': JSON.stringify('production')
}),

new CopyWebpackPlugin([
{
from: `${config.assets}/fonts/**/*`,
to: `${config.dist}/src`,
},
{
from: `${config.assets}/images/**/*`,
to: config.dist,
},
{
from: path.resolve(__dirname, '../package.json'),
to: config.dist,
},
]),

new HtmlWebpackPlugin({
filename: `${config.dist}/src/index.html`,
template: './src/index.html',
inject: 'body',
hash: true,
minify: {
collapseWhitespace: true
}
})
],

// https://github.com/chentsulin/webpack-target-electron-renderer#how-this-module-works
target: 'electron-renderer'
};
Loading

0 comments on commit ef2f6f3

Please sign in to comment.