Skip to content

Commit 946d98b

Browse files
committed
initial commit
0 parents  commit 946d98b

File tree

220 files changed

+48536
-0
lines changed

Some content is hidden

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

220 files changed

+48536
-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.ts

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

.erb/configs/webpack.config.eslint.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/* eslint import/no-unresolved: off, import/no-self-import: off */
2+
3+
module.exports = require("./webpack.config.renderer.dev").default;
+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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 webpackPaths from "./webpack.paths";
12+
import checkNodeEnv from "../scripts/check-node-env";
13+
import deleteSourceMaps from "../scripts/delete-source-maps";
14+
15+
checkNodeEnv("production");
16+
deleteSourceMaps();
17+
18+
const devtoolsConfig =
19+
process.env.DEBUG_PROD === "true"
20+
? {
21+
devtool: "source-map",
22+
}
23+
: {};
24+
25+
export default merge(baseConfig, {
26+
...devtoolsConfig,
27+
28+
mode: "production",
29+
30+
target: "electron-main",
31+
32+
entry: {
33+
main: path.join(webpackPaths.srcMainPath, "main.ts"),
34+
preload: path.join(webpackPaths.srcMainPath, "preload.js"),
35+
},
36+
37+
output: {
38+
path: webpackPaths.distMainPath,
39+
filename: "[name].js",
40+
},
41+
42+
optimization: {
43+
minimizer: [
44+
new TerserPlugin({
45+
parallel: true,
46+
}),
47+
],
48+
},
49+
50+
plugins: [
51+
new BundleAnalyzerPlugin({
52+
analyzerMode:
53+
process.env.OPEN_ANALYZER === "true" ? "server" : "disabled",
54+
openAnalyzer: process.env.OPEN_ANALYZER === "true",
55+
}),
56+
57+
/**
58+
* Create global constants which can be configured at compile time.
59+
*
60+
* Useful for allowing different behaviour between development builds and
61+
* release builds
62+
*
63+
* NODE_ENV should be production so that modules do not perform certain
64+
* development checks
65+
*/
66+
new webpack.EnvironmentPlugin({
67+
NODE_ENV: "production",
68+
DEBUG_PROD: false,
69+
START_MINIMIZED: false,
70+
}),
71+
],
72+
73+
/**
74+
* Disables webpack processing of __dirname and __filename.
75+
* If you run the bundle in node.js it falls back to these values of node.js.
76+
* https://github.com/webpack/webpack/issues/2010
77+
*/
78+
node: {
79+
__dirname: false,
80+
__filename: false,
81+
},
82+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/**
2+
* Builds the DLL for development electron renderer process
3+
*/
4+
5+
import webpack from "webpack";
6+
import path from "path";
7+
import { merge } from "webpack-merge";
8+
import baseConfig from "./webpack.config.base";
9+
import webpackPaths from "./webpack.paths";
10+
import { dependencies } from "../../package.json";
11+
import checkNodeEnv from "../scripts/check-node-env";
12+
13+
checkNodeEnv("development");
14+
15+
const dist = webpackPaths.dllPath;
16+
17+
export default merge(baseConfig, {
18+
context: webpackPaths.rootPath,
19+
20+
devtool: "eval",
21+
22+
mode: "development",
23+
24+
target: "electron-renderer",
25+
26+
externals: ["fsevents", "crypto-browserify"],
27+
28+
/**
29+
* Use `module` from `webpack.config.renderer.dev.js`
30+
*/
31+
module: require("./webpack.config.renderer.dev").default.module,
32+
33+
entry: {
34+
renderer: Object.keys(dependencies || {}),
35+
},
36+
37+
output: {
38+
path: dist,
39+
filename: "[name].dev.dll.js",
40+
library: {
41+
name: "renderer",
42+
type: "var",
43+
},
44+
},
45+
46+
plugins: [
47+
new webpack.DllPlugin({
48+
path: path.join(dist, "[name].json"),
49+
name: "[name]",
50+
}),
51+
52+
/**
53+
* Create global constants which can be configured at compile time.
54+
*
55+
* Useful for allowing different behaviour between development builds and
56+
* release builds
57+
*
58+
* NODE_ENV should be production so that modules do not perform certain
59+
* development checks
60+
*/
61+
new webpack.EnvironmentPlugin({
62+
NODE_ENV: "development",
63+
}),
64+
65+
new webpack.LoaderOptionsPlugin({
66+
debug: true,
67+
options: {
68+
context: webpackPaths.srcPath,
69+
output: {
70+
path: webpackPaths.dllPath,
71+
},
72+
},
73+
}),
74+
],
75+
});

0 commit comments

Comments
 (0)