Skip to content

Commit f1e2346

Browse files
committed
Inital Commit
0 parents  commit f1e2346

File tree

148 files changed

+29778
-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.

148 files changed

+29778
-0
lines changed

.prettierrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
bracketSpacing: false,
3+
jsxBracketSameLine: true,
4+
singleQuote: true,
5+
trailingComma: 'all',
6+
arrowParens: 'avoid',
7+
semi: false
8+
}

.editorconfig

Lines changed: 12 additions & 0 deletions
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

Lines changed: 7 additions & 0 deletions
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/copy-plugin.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import fs from 'fs'
2+
import path from 'path';
3+
import webpackPaths from './webpack.paths';
4+
import CopyWebpackPlugin from 'copy-webpack-plugin'
5+
6+
const rendererCopyPattern = [{ from: path.resolve(webpackPaths.rootPath, 'public'), to: webpackPaths.distRendererPath }]
7+
8+
export const rendererCopyPlugins = [
9+
new CopyWebpackPlugin({
10+
patterns:rendererCopyPattern,
11+
})
12+
]
13+
14+
const mainCopyPattern = [
15+
{ from: path.resolve(webpackPaths.rootPath, 'README.md'), to: webpackPaths.distMainPath },
16+
{ from: path.resolve(webpackPaths.rootPath, 'inputs'), to: path.resolve(webpackPaths.distMainPath, 'inputs') },
17+
]
18+
19+
export const devMainCopyPlugins = [
20+
new CopyWebpackPlugin({
21+
patterns: [...mainCopyPattern],
22+
})
23+
]
24+
25+
26+
const headerGeneratorFiles = path.resolve(webpackPaths.rootPath, 'node_modules', 'header-generator', 'data_files')
27+
export const prodMainCopyPlugins = [
28+
new CopyWebpackPlugin({
29+
patterns: [...mainCopyPattern,
30+
...( fs.existsSync(headerGeneratorFiles) ? [{ from: headerGeneratorFiles, to: path.resolve(webpackPaths.distMainPath,) }] : []),
31+
],
32+
})
33+
]
34+
35+
36+
export const moduleRules = {
37+
rules: [
38+
{
39+
test: /\.svg$/,
40+
use: 'null-loader'
41+
},
42+
{
43+
test: /\.html$/,
44+
use: 'null-loader'
45+
},
46+
{
47+
test: /\.css$/,
48+
use: 'null-loader'
49+
},
50+
{
51+
test: /\.ttf$/,
52+
use: 'null-loader'
53+
},
54+
{
55+
test: /\.png$/,
56+
use: 'null-loader'
57+
},
58+
],
59+
}

.erb/configs/postcss.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const tailwindcss = require("tailwindcss");
2+
const autoprefixer = require("autoprefixer");
3+
4+
module.exports = {
5+
plugins: [tailwindcss, autoprefixer],
6+
};
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/**
2+
* Base webpack config used across other specific configs
3+
*/
4+
5+
import webpack from 'webpack';
6+
import TsconfigPathsPlugins from 'tsconfig-paths-webpack-plugin';
7+
import webpackPaths from './webpack.paths';
8+
import { dependencies as externals } from '../../release/app/package.json';
9+
10+
const configuration: webpack.Configuration = {
11+
externals: [...Object.keys(externals || {})],
12+
13+
stats: 'errors-only',
14+
15+
module: {
16+
rules: [
17+
{
18+
test: /\.[jt]sx?$/,
19+
exclude: /node_modules/,
20+
use: {
21+
loader: 'ts-loader',
22+
options: {
23+
// Remove this line to enable type checking in webpack builds
24+
transpileOnly: true,
25+
compilerOptions: {
26+
module: 'esnext',
27+
},
28+
},
29+
},
30+
},
31+
],
32+
},
33+
34+
output: {
35+
path: webpackPaths.srcPath,
36+
// https://github.com/webpack/webpack/issues/1114
37+
library: {
38+
type: 'commonjs2',
39+
},
40+
},
41+
42+
/**
43+
* Determine the array of extensions that should be used to resolve modules.
44+
*/
45+
resolve: {
46+
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
47+
modules: [webpackPaths.srcPath, 'node_modules'],
48+
// There is no need to add aliases here, the paths in tsconfig get mirrored
49+
plugins: [new TsconfigPathsPlugins()],
50+
},
51+
52+
plugins: [
53+
new webpack.EnvironmentPlugin({
54+
NODE_ENV: 'production',
55+
}),
56+
],
57+
};
58+
59+
export default configuration;
Lines changed: 3 additions & 0 deletions
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;
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/**
2+
* Webpack config for development electron main process
3+
*/
4+
5+
import path from 'path';
6+
import webpack from 'webpack';
7+
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
8+
import { merge } from 'webpack-merge';
9+
import checkNodeEnv from '../scripts/check-node-env';
10+
import baseConfig from './webpack.config.base';
11+
import webpackPaths from './webpack.paths';
12+
import { devMainCopyPlugins, moduleRules } from './copy-plugin'
13+
import { LogContentsPlugin } from './webpack.custom-plugins'
14+
15+
// When an ESLint server is running, we can't set the NODE_ENV so we'll check if it's
16+
// at the dev webpack config is not accidentally run in a production environment
17+
if (process.env.NODE_ENV === 'production') {
18+
checkNodeEnv('development');
19+
}
20+
const configuration: webpack.Configuration = {
21+
devtool: 'inline-source-map',
22+
23+
// module: {...moduleRules},
24+
25+
mode: 'development',
26+
27+
target: 'electron-main',
28+
29+
entry: {
30+
main: path.join(webpackPaths.srcMainPath, 'main.ts'),
31+
preload: path.join(webpackPaths.srcMainPath, 'preload.ts'),
32+
},
33+
34+
output: {
35+
path: webpackPaths.dllPath,
36+
filename: '[name].bundle.dev.js',
37+
library: {
38+
type: 'umd',
39+
},
40+
},
41+
42+
plugins: [
43+
...devMainCopyPlugins,
44+
new LogContentsPlugin(),
45+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
46+
// @ts-ignore
47+
new BundleAnalyzerPlugin({
48+
analyzerMode: process.env.ANALYZE === 'true' ? 'server' : 'disabled',
49+
analyzerPort: 8888,
50+
}),
51+
52+
new webpack.DefinePlugin({
53+
'process.type': '"browser"',
54+
}),
55+
],
56+
57+
/**
58+
* Disables webpack processing of __dirname and __filename.
59+
* If you run the bundle in node.js it falls back to these values of node.js.
60+
* https://github.com/webpack/webpack/issues/2010
61+
*/
62+
node: {
63+
__dirname: false,
64+
__filename: false,
65+
},
66+
};
67+
68+
export default merge(baseConfig, configuration);
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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+
import { prodMainCopyPlugins, moduleRules } from './copy-plugin'
15+
16+
checkNodeEnv('production');
17+
deleteSourceMaps();
18+
19+
const configuration: webpack.Configuration = {
20+
devtool: false,
21+
// module: {...moduleRules},
22+
mode: 'production',
23+
24+
target: 'electron-main',
25+
26+
entry: {
27+
main: path.join(webpackPaths.srcMainPath, 'main.ts'),
28+
preload: path.join(webpackPaths.srcMainPath, 'preload.ts'),
29+
},
30+
31+
output: {
32+
path: webpackPaths.distMainPath,
33+
filename: '[name].js',
34+
library: {
35+
type: 'umd',
36+
},
37+
},
38+
39+
optimization: {
40+
minimizer: [
41+
new TerserPlugin({
42+
parallel: true,
43+
}),
44+
],
45+
},
46+
47+
plugins: [
48+
...prodMainCopyPlugins,
49+
new BundleAnalyzerPlugin({
50+
analyzerMode: process.env.ANALYZE === 'true' ? 'server' : 'disabled',
51+
analyzerPort: 8888,
52+
}),
53+
54+
/**
55+
* Create global constants which can be configured at compile time.
56+
*
57+
* Useful for allowing different behaviour between development builds and
58+
* release builds
59+
*
60+
* NODE_ENV should be production so that modules do not perform certain
61+
* development checks
62+
*/
63+
// @ts-ignore
64+
new webpack.EnvironmentPlugin({
65+
NODE_ENV: 'production',
66+
DEBUG_PROD: false,
67+
START_MINIMIZED: false,
68+
}),
69+
70+
new webpack.DefinePlugin({
71+
'process.type': '"browser"',
72+
}),
73+
],
74+
75+
/**
76+
* Disables webpack processing of __dirname and __filename.
77+
* If you run the bundle in node.js it falls back to these values of node.js.
78+
* https://github.com/webpack/webpack/issues/2010
79+
*/
80+
node: {
81+
__dirname: false,
82+
__filename: false,
83+
},
84+
};
85+
86+
export default merge(baseConfig, configuration);
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import path from 'path';
2+
import webpack from 'webpack';
3+
import { merge } from 'webpack-merge';
4+
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
5+
import baseConfig from './webpack.config.base';
6+
import webpackPaths from './webpack.paths';
7+
import checkNodeEnv from '../scripts/check-node-env';
8+
9+
// When an ESLint server is running, we can't set the NODE_ENV so we'll check if it's
10+
// at the dev webpack config is not accidentally run in a production environment
11+
if (process.env.NODE_ENV === 'production') {
12+
checkNodeEnv('development');
13+
}
14+
15+
const configuration: webpack.Configuration = {
16+
devtool: false,
17+
18+
mode: 'development',
19+
20+
target: 'electron-preload',
21+
22+
entry: path.join(webpackPaths.srcMainPath, 'preload.ts'),
23+
24+
output: {
25+
path: webpackPaths.dllPath,
26+
filename: 'preload.js',
27+
library: {
28+
type: 'umd',
29+
},
30+
},
31+
32+
plugins: [
33+
new BundleAnalyzerPlugin({
34+
analyzerMode: process.env.ANALYZE === 'true' ? 'server' : 'disabled',
35+
}),
36+
37+
/**
38+
* Create global constants which can be configured at compile time.
39+
*
40+
* Useful for allowing different behaviour between development builds and
41+
* release builds
42+
*
43+
* NODE_ENV should be production so that modules do not perform certain
44+
* development checks
45+
*
46+
* By default, use 'development' as NODE_ENV. This can be overriden with
47+
* 'staging', for example, by changing the ENV variables in the npm scripts
48+
*/
49+
new webpack.EnvironmentPlugin({
50+
NODE_ENV: 'development',
51+
}),
52+
53+
new webpack.LoaderOptionsPlugin({
54+
debug: true,
55+
}),
56+
],
57+
58+
/**
59+
* Disables webpack processing of __dirname and __filename.
60+
* If you run the bundle in node.js it falls back to these values of node.js.
61+
* https://github.com/webpack/webpack/issues/2010
62+
*/
63+
node: {
64+
__dirname: false,
65+
__filename: false,
66+
},
67+
68+
watch: true,
69+
};
70+
71+
export default merge(baseConfig, configuration);

0 commit comments

Comments
 (0)