Skip to content

Commit b838d69

Browse files
committed
Init repo
0 parents  commit b838d69

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+18325
-0
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.erb/configs/.eslintrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"rules": {
3+
"no-console": "off",
4+
"global-require": "off",
5+
"import/no-dynamic-require": "off"
6+
}
7+
}

.erb/configs/webpack.config.base.js

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
* Base webpack config used across other specific configs
3+
*/
4+
5+
import path from 'path';
6+
import webpack from 'webpack';
7+
import { dependencies as externals } from '../../src/package.json';
8+
9+
export default {
10+
externals: [...Object.keys(externals || {})],
11+
12+
module: {
13+
rules: [
14+
{
15+
test: /\.tsx?$/,
16+
exclude: /node_modules/,
17+
use: {
18+
loader: 'babel-loader',
19+
options: {
20+
cacheDirectory: true,
21+
},
22+
},
23+
},
24+
],
25+
},
26+
27+
output: {
28+
path: path.join(__dirname, '../../src'),
29+
// https://github.com/webpack/webpack/issues/1114
30+
libraryTarget: 'commonjs2',
31+
},
32+
33+
/**
34+
* Determine the array of extensions that should be used to resolve modules.
35+
*/
36+
resolve: {
37+
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
38+
modules: [path.join(__dirname, '../../src'), 'node_modules'],
39+
},
40+
41+
plugins: [
42+
new webpack.EnvironmentPlugin({
43+
NODE_ENV: 'production',
44+
}),
45+
],
46+
};

.erb/configs/webpack.config.eslint.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* eslint import/no-unresolved: off, import/no-self-import: off */
2+
require('@babel/register');
3+
4+
module.exports = require('./webpack.config.renderer.dev.babel').default;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/**
2+
* Webpack config for production electron main process
3+
*/
4+
5+
import path from 'path';
6+
import webpack from 'webpack';
7+
import { merge } from 'webpack-merge';
8+
import TerserPlugin from 'terser-webpack-plugin';
9+
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
10+
import baseConfig from './webpack.config.base';
11+
import CheckNodeEnv from '../scripts/CheckNodeEnv';
12+
import DeleteSourceMaps from '../scripts/DeleteSourceMaps';
13+
14+
CheckNodeEnv('production');
15+
DeleteSourceMaps();
16+
17+
const devtoolsConfig = process.env.DEBUG_PROD === 'true' ? {
18+
devtool: 'source-map'
19+
} : {};
20+
21+
export default merge(baseConfig, {
22+
...devtoolsConfig,
23+
24+
mode: 'production',
25+
26+
target: 'electron-main',
27+
28+
entry: './src/main.dev.ts',
29+
30+
output: {
31+
path: path.join(__dirname, '../../'),
32+
filename: './src/main.prod.js',
33+
},
34+
35+
optimization: {
36+
minimizer: [
37+
new TerserPlugin({
38+
parallel: true,
39+
}),
40+
]
41+
},
42+
43+
plugins: [
44+
new BundleAnalyzerPlugin({
45+
analyzerMode:
46+
process.env.OPEN_ANALYZER === 'true' ? 'server' : 'disabled',
47+
openAnalyzer: process.env.OPEN_ANALYZER === 'true',
48+
}),
49+
50+
/**
51+
* Create global constants which can be configured at compile time.
52+
*
53+
* Useful for allowing different behaviour between development builds and
54+
* release builds
55+
*
56+
* NODE_ENV should be production so that modules do not perform certain
57+
* development checks
58+
*/
59+
new webpack.EnvironmentPlugin({
60+
NODE_ENV: 'production',
61+
DEBUG_PROD: false,
62+
START_MINIMIZED: false,
63+
}),
64+
],
65+
66+
/**
67+
* Disables webpack processing of __dirname and __filename.
68+
* If you run the bundle in node.js it falls back to these values of node.js.
69+
* https://github.com/webpack/webpack/issues/2010
70+
*/
71+
node: {
72+
__dirname: false,
73+
__filename: false,
74+
},
75+
});

0 commit comments

Comments
 (0)