Skip to content

Commit

Permalink
Major Update to latest erb version with react 18
Browse files Browse the repository at this point in the history
  • Loading branch information
peace317 committed May 11, 2024
1 parent 6f71c4a commit d8d15ff
Show file tree
Hide file tree
Showing 127 changed files with 41,571 additions and 39,940 deletions.
24 changes: 12 additions & 12 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
14 changes: 7 additions & 7 deletions .erb/configs/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"rules": {
"no-console": "off",
"global-require": "off",
"import/no-dynamic-require": "off"
}
}
{
"rules": {
"no-console": "off",
"global-require": "off",
"import/no-dynamic-require": "off"
}
}
10 changes: 10 additions & 0 deletions .erb/configs/webpack.config.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
*/

import webpack from 'webpack';
import TsconfigPathsPlugins from 'tsconfig-paths-webpack-plugin';
import webpackPaths from './webpack.paths';
import { dependencies as externals } from '../../release/app/package.json';
import path from 'path';

const configuration: webpack.Configuration = {
externals: [...Object.keys(externals || {})],
Expand All @@ -21,6 +23,9 @@ const configuration: webpack.Configuration = {
options: {
// Remove this line to enable type checking in webpack builds
transpileOnly: true,
compilerOptions: {
module: 'esnext',
},
},
},
},
Expand All @@ -41,6 +46,11 @@ const configuration: webpack.Configuration = {
resolve: {
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
modules: [webpackPaths.srcPath, 'node_modules'],
// There is no need to add aliases here, the paths in tsconfig get mirrored
plugins: [new TsconfigPathsPlugins({baseUrl: path.join(__dirname, '../..')})],
alias: {
'@': path.join(__dirname, '../../src'),
}
},

plugins: [
Expand Down
17 changes: 9 additions & 8 deletions .erb/configs/webpack.config.main.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,8 @@ import deleteSourceMaps from '../scripts/delete-source-maps';
checkNodeEnv('production');
deleteSourceMaps();

const devtoolsConfig =
process.env.DEBUG_PROD === 'true'
? {
devtool: 'source-map',
}
: {};

const configuration: webpack.Configuration = {
...devtoolsConfig,
devtool: 'source-map',

mode: 'production',

Expand All @@ -37,6 +30,9 @@ const configuration: webpack.Configuration = {
output: {
path: webpackPaths.distMainPath,
filename: '[name].js',
library: {
type: 'umd',
},
},

optimization: {
Expand All @@ -50,6 +46,7 @@ const configuration: webpack.Configuration = {
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: process.env.ANALYZE === 'true' ? 'server' : 'disabled',
analyzerPort: 8888,
}),

/**
Expand All @@ -66,6 +63,10 @@ const configuration: webpack.Configuration = {
DEBUG_PROD: false,
START_MINIMIZED: false,
}),

new webpack.DefinePlugin({
'process.type': '"browser"',
}),
],

/**
Expand Down
3 changes: 3 additions & 0 deletions .erb/configs/webpack.config.preload.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ const configuration: webpack.Configuration = {
output: {
path: webpackPaths.dllPath,
filename: 'preload.js',
library: {
type: 'umd',
},
},

plugins: [
Expand Down
8 changes: 1 addition & 7 deletions .erb/configs/webpack.config.renderer.dev.dll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@ const configuration: webpack.Configuration = {

target: 'electron-renderer',

externals: [
'fsevents',
'crypto-browserify',
'primereact',
'primeflex',
'primeicons',
],
externals: ['fsevents', 'crypto-browserify'],

/**
* Use `module` from `webpack.config.renderer.dev.js`
Expand Down
42 changes: 33 additions & 9 deletions .erb/configs/webpack.config.renderer.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ if (process.env.NODE_ENV === 'production') {

const port = process.env.PORT || 1212;
const manifest = path.resolve(webpackPaths.dllPath, 'renderer.json');
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const requiredByDLLConfig = module.parent!.filename.includes(
'webpack.config.renderer.dev.dll'
);
const skipDLLs =
module.parent?.filename.includes('webpack.config.renderer.dev.dll') ||
module.parent?.filename.includes('webpack.config.eslint');

/**
* Warn if the DLL is not built
*/
if (
!requiredByDLLConfig &&
!skipDLLs &&
!(fs.existsSync(webpackPaths.dllPath) && fs.existsSync(manifest))
) {
console.log(
Expand Down Expand Up @@ -64,7 +63,7 @@ const configuration: webpack.Configuration = {
module: {
rules: [
{
test: /\.s?css$/,
test: /\.s?(c|a)ss$/,
use: [
'style-loader',
{
Expand All @@ -91,13 +90,32 @@ const configuration: webpack.Configuration = {
},
// Images
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
test: /\.(png|jpg|jpeg|gif)$/i,
type: 'asset/resource',
},
// SVG
{
test: /\.svg$/,
use: [
{
loader: '@svgr/webpack',
options: {
prettier: false,
svgo: false,
svgoConfig: {
plugins: [{ removeViewBox: false }],
},
titleProp: true,
ref: true,
},
},
'file-loader',
],
},
],
},
plugins: [
...(requiredByDLLConfig
...(skipDLLs
? []
: [
new webpack.DllReferencePlugin({
Expand Down Expand Up @@ -172,7 +190,13 @@ const configuration: webpack.Configuration = {
.on('error', (spawnError) => console.error(spawnError));

console.log('Starting Main Process...');
spawn('npm', ['run', 'start:main'], {
let args = ['run', 'start:main'];
if (process.env.MAIN_ARGS) {
args = args.concat(
['--', ...process.env.MAIN_ARGS.matchAll(/"[^"]+"|[^\s"]+/g)].flat()
);
}
spawn('npm', args, {
shell: true,
stdio: 'inherit',
})
Expand Down
Loading

0 comments on commit d8d15ff

Please sign in to comment.