rebuiltron 6.0.3 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,7 +9,7 @@ A tool made to easily build an offline **React/Electron** app using webpack.
9
9
  The idea behind Rebuiltron was to migrate one of my project initially created with the deprecated [CRA](https://create-react-app.dev/) to a maintained tool configured with Electron in mind. As such, it has been developed using [react-scripts](https://github.com/facebook/create-react-app/tree/main/packages/react-scripts) as a base, but heavily edited and stripped of a lot of features.
10
10
 
11
11
  > [!IMPORTANT]
12
- > Since I made Rebuiltron specifically for one of my own projects, I only kept in the configuration what *this* project needed and nothing more. Except for the entry points and some basic options, **Rebuiltron doesn't offer many configurable options**. If you are looking to create a new Electron/React app, or even migrating an existing CRA app, you should probably look for a more generic tool.
12
+ > Since I made Rebuiltron specifically for one of my own projects, I only kept in the configuration what *this* project needed and nothing more. For this reason, **Rebuiltron doesn't offer many configurable options**. If you are looking to create a new Electron/React app, or even migrating an existing CRA app, you should probably look for a more generic tool.
13
13
 
14
14
 
15
15
  ## Features
@@ -23,7 +23,7 @@ Rebuiltron uses webpack with [SWC](https://swc.rs/) to compile JavaScript instea
23
23
  - Support for ES6 imports on all processes
24
24
 
25
25
  > [!WARNING]
26
- > Rebuiltron **doesn't support**: TypeScript, Flow, CSS Modules, ESM, Jest, and proxying.
26
+ > Rebuiltron **doesn't support**: TypeScript, Flow, CSS Modules, ESM, and proxying.
27
27
 
28
28
 
29
29
  ## Installation
@@ -96,6 +96,7 @@ At the root of your project, create a `rebuiltron.config.js` file.
96
96
  | `renderers` | `object` | ✓ | Renderer entries. It takes the name of the entries as keys and their paths as values. All paths must be relative. |
97
97
  | `preloads` | `object` | ✓ | Preload entries. It takes the name of the entries as keys and their paths as values. All paths must be relative. |
98
98
  | `srcAlias` | `string` | ✗ | Custom [alias](https://webpack.js.org/configuration/resolve/#resolvealias) to the `src` folder.
99
+ | `excludeInProduction` | `string[]` | ✗ | List of modules to exclude in the production bundle.
99
100
  | `sassOptions` | `object` | ✗ | Custom SASS options for [`sass-loader`](https://github.com/webpack-contrib/sass-loader). |
100
101
  | `sassOptions.additionalData` | `object` | ✗* | Configuration of [`additionalData`](https://webpack.js.org/loaders/sass-loader/#additionaldata). |
101
102
  | `sassOptions.additionalData.data` | `string` | ✗* | Data to prepend to SASS files. |
@@ -121,7 +122,10 @@ module.exports = {
121
122
  data: "@use \"styles/settings\" as *;",
122
123
  exclude: /^src\\styles\\.*/
123
124
  }
124
- }
125
+ },
126
+ excludeInProduction: [
127
+ "electron-devtools-installer"
128
+ ]
125
129
  };
126
130
  ```
127
131
 
@@ -1,15 +1,17 @@
1
1
  const { createHash } = require("crypto");
2
2
 
3
3
  const CaseSensitivePathsPlugin = require("case-sensitive-paths-webpack-plugin");
4
- const TerserPlugin = require("terser-webpack-plugin");
4
+ const { isEmpty } = require("lodash");
5
5
  const ModuleNotFoundPlugin = require("react-dev-utils/ModuleNotFoundPlugin");
6
+ const TerserPlugin = require("terser-webpack-plugin");
7
+ const { IgnorePlugin } = require("webpack");
6
8
 
7
- const paths = require("../helpers/paths");
8
9
  const { isEnvDevelopment, isEnvProduction } = require("../helpers/environment");
10
+ const paths = require("../helpers/paths");
9
11
  const { emptyOr } = require("../helpers/utils");
10
12
 
11
13
 
12
- const { srcAlias } = require(paths.appConfig);
14
+ const { srcAlias, excludeInProduction } = require(paths.appConfig);
13
15
 
14
16
 
15
17
  module.exports = {
@@ -68,8 +70,17 @@ module.exports = {
68
70
  strictExportPresence: true
69
71
  },
70
72
  plugins: [
71
- ...emptyOr(isEnvDevelopment, [new CaseSensitivePathsPlugin()]), // Detects case errors in import paths
72
- new ModuleNotFoundPlugin(paths.appPath) // Gives some necessary context to module not found errors
73
+ ...emptyOr(isEnvDevelopment, [
74
+ new CaseSensitivePathsPlugin()
75
+ ]),
76
+ ...emptyOr(isEnvProduction && !isEmpty(excludeInProduction), [
77
+ new IgnorePlugin({
78
+ checkResource(resource) {
79
+ return excludeInProduction.includes(resource);
80
+ }
81
+ })
82
+ ]),
83
+ new ModuleNotFoundPlugin(paths.appPath)
73
84
  ],
74
- performance: false // Performance processing is already handled via `FileSizeReporter`
85
+ performance: false // Already handled via `FileSizeReporter`
75
86
  };
@@ -1,7 +1,8 @@
1
1
  const paths = require("../helpers/paths");
2
+ const javascriptLoaders = require("../loaders/javascript");
2
3
  const rebuiltronConfig = require("../rebuiltronConfig");
4
+
3
5
  const baseConfig = require("./base");
4
- const javascriptLoaders = require("../loaders/javascript");
5
6
 
6
7
 
7
8
  const { main } = require(paths.appConfig);
@@ -1,9 +1,10 @@
1
1
  const { mapKeys } = require("lodash");
2
2
 
3
3
  const paths = require("../helpers/paths");
4
+ const javascriptLoaders = require("../loaders/javascript");
4
5
  const rebuiltronConfig = require("../rebuiltronConfig");
6
+
5
7
  const baseConfig = require("./base");
6
- const javascriptLoaders = require("../loaders/javascript");
7
8
 
8
9
 
9
10
  const { preloads } = require(paths.appConfig);
@@ -1,21 +1,22 @@
1
1
  const path = require("path");
2
2
 
3
- const HtmlWebpackPlugin = require("html-webpack-plugin");
4
- const CopyPlugin = require("copy-webpack-plugin");
5
- const MiniCssExtractPlugin = require("mini-css-extract-plugin");
6
- const InlineChunkHtmlPlugin = require("react-dev-utils/InlineChunkHtmlPlugin");
7
3
  const ReactRefreshWebpackPlugin = require("@pmmmwh/react-refresh-webpack-plugin");
4
+ const CopyPlugin = require("copy-webpack-plugin");
8
5
  const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
6
+ const HtmlWebpackPlugin = require("html-webpack-plugin");
9
7
  const { keys } = require("lodash");
8
+ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
9
+ const InlineChunkHtmlPlugin = require("react-dev-utils/InlineChunkHtmlPlugin");
10
10
 
11
- const paths = require("../helpers/paths");
12
11
  const { isEnvProduction, isEnvDevelopment, shouldUseSourceMap } = require("../helpers/environment");
12
+ const paths = require("../helpers/paths");
13
13
  const { emptyOr } = require("../helpers/utils");
14
- const rebuiltronConfig = require("../rebuiltronConfig");
15
- const baseConfig = require("./base");
16
14
  const imageLoaders = require("../loaders/images");
17
- const styleLoaders = require("../loaders/style");
18
15
  const javascriptLoaders = require("../loaders/javascript");
16
+ const styleLoaders = require("../loaders/style");
17
+ const rebuiltronConfig = require("../rebuiltronConfig");
18
+
19
+ const baseConfig = require("./base");
19
20
 
20
21
 
21
22
  const { renderers } = require(paths.appConfig);
@@ -0,0 +1,9 @@
1
+ const arklintConfig = require("eslint-config-arklint");
2
+ const { importConfig, jsdocConfig } = require("eslint-config-arklint/extensions");
3
+
4
+
5
+ module.exports = [
6
+ ...arklintConfig,
7
+ ...importConfig,
8
+ ...jsdocConfig
9
+ ];
package/helpers/paths.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const rebuiltronConfig = require("../rebuiltronConfig.js");
2
+
2
3
  const { isEnvDevelopment } = require("./environment.js");
3
4
  const { resolveApp } = require("./utils.js");
4
5
 
package/helpers/utils.js CHANGED
@@ -1,13 +1,13 @@
1
1
  /* eslint-disable jsdoc/valid-types, jsdoc/match-description */
2
2
 
3
- const path = require("path");
4
3
  const fs = require("fs");
4
+ const path = require("path");
5
5
 
6
- const { isArray } = require("lodash");
7
6
  const { bold, red, green, yellow } = require("chalk");
7
+ const { isArray } = require("lodash");
8
8
 
9
- const spinnies = require("./spinnies");
10
9
  const { COMPILATION_STATES } = require("./constants");
10
+ const spinnies = require("./spinnies");
11
11
 
12
12
 
13
13
  /**
@@ -1,5 +1,7 @@
1
- const paths = require("../helpers/paths");
1
+ const path = require("path");
2
+
2
3
  const { shouldUseSourceMap, isEnvProduction } = require("../helpers/environment");
4
+ const paths = require("../helpers/paths");
3
5
 
4
6
 
5
7
  module.exports = [
@@ -10,6 +12,16 @@ module.exports = [
10
12
  loader: require.resolve("swc-loader"),
11
13
  options: {
12
14
  jsc: {
15
+ experimental: {
16
+ plugins: [
17
+ ["@swc/plugin-transform-imports", {
18
+ lodash: {
19
+ transform: "lodash/{{member}}"
20
+ }
21
+ }]
22
+ ],
23
+ cacheRoot: path.join(paths.appWebpackCache, "swc")
24
+ },
13
25
  parser: {
14
26
  syntax: "ecmascript",
15
27
  jsx: true,
package/loaders/style.js CHANGED
@@ -2,8 +2,8 @@ const path = require("path");
2
2
 
3
3
  const MiniCssExtractPlugin = require("mini-css-extract-plugin");
4
4
 
5
- const paths = require("../helpers/paths");
6
5
  const { shouldUseSourceMap, isEnvDevelopment, isEnvProduction } = require("../helpers/environment");
6
+ const paths = require("../helpers/paths");
7
7
  const { emptyOr } = require("../helpers/utils");
8
8
  const rebuiltronConfig = require("../rebuiltronConfig");
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rebuiltron",
3
- "version": "6.0.3",
3
+ "version": "6.2.0",
4
4
  "author": "Arkellys",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -10,38 +10,39 @@
10
10
  "lint": "eslint ."
11
11
  },
12
12
  "devDependencies": {
13
- "eslint": "^8.57.0",
14
- "eslint-config-arklint": "^1.11.0"
13
+ "eslint": "^9.14.0",
14
+ "eslint-config-arklint": "^3.3.0"
15
15
  },
16
16
  "dependencies": {
17
17
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
18
18
  "@svgr/webpack": "^8.1.0",
19
- "@swc/core": "^1.7.26",
20
- "browserslist": "^4.23.3",
19
+ "@swc/core": "^1.7.42",
20
+ "@swc/plugin-transform-imports": "^4.0.0",
21
+ "browserslist": "^4.24.2",
21
22
  "case-sensitive-paths-webpack-plugin": "^2.4.0",
22
23
  "copy-webpack-plugin": "^12.0.2",
23
24
  "css-loader": "^7.1.2",
24
25
  "css-minimizer-webpack-plugin": "^7.0.0",
25
26
  "detect-port": "^1.6.1",
26
27
  "fs-extra": "^11.2.0",
27
- "html-webpack-plugin": "^5.6.0",
28
+ "html-webpack-plugin": "^5.6.3",
28
29
  "lodash": "^4.17.21",
29
- "mini-css-extract-plugin": "^2.9.1",
30
+ "mini-css-extract-plugin": "^2.9.2",
30
31
  "postcss": "^8.4.47",
31
32
  "postcss-flexbugs-fixes": "^5.0.2",
32
33
  "postcss-loader": "^8.1.1",
33
- "postcss-normalize": "^13.0.0",
34
- "postcss-preset-env": "^10.0.3",
34
+ "postcss-normalize": "^13.0.1",
35
+ "postcss-preset-env": "^10.0.9",
35
36
  "react-dev-utils": "^12.0.1",
36
37
  "react-refresh": "^0.14.2",
37
38
  "resolve-url-loader": "^5.0.0",
38
- "sass-loader": "^16.0.1",
39
+ "sass-loader": "^16.0.3",
39
40
  "source-map-loader": "^5.0.0",
40
41
  "spinnies": "^0.5.1",
41
42
  "style-loader": "^4.0.0",
42
43
  "swc-loader": "^0.2.6",
43
44
  "terser-webpack-plugin": "^5.3.10",
44
- "webpack": "^5.94.0",
45
+ "webpack": "^5.96.1",
45
46
  "webpack-dev-server": "^5.1.0"
46
47
  },
47
48
  "peerDependencies": {
package/scripts/build.js CHANGED
@@ -5,10 +5,10 @@ process.env.NODE_ENV = "production";
5
5
  const fsExtra = require("fs-extra");
6
6
  const { measureFileSizesBeforeBuild, printFileSizesAfterBuild } = require("react-dev-utils/FileSizeReporter");
7
7
 
8
- const buildApp = require("../tasks/buildApp");
9
- const checkSetup = require("../tasks/checkSetup");
10
8
  const paths = require("../helpers/paths");
11
9
  const { exitProcessWithError } = require("../helpers/utils");
10
+ const buildApp = require("../tasks/buildApp");
11
+ const checkSetup = require("../tasks/checkSetup");
12
12
 
13
13
 
14
14
  process.on("unhandledRejection", exitProcessWithError);
package/scripts/start.js CHANGED
@@ -2,12 +2,12 @@ process.env.BABEL_ENV = "development";
2
2
  process.env.NODE_ENV = "development";
3
3
 
4
4
 
5
+ const { exitProcessWithError, clearConsole } = require("../helpers/utils");
5
6
  const checkSetup = require("../tasks/checkSetup");
6
- const startDevServer = require("../tasks/startDevServer");
7
7
  const compileMain = require("../tasks/compileMain");
8
- const watchPreloads = require("../tasks/watchPreloads");
8
+ const startDevServer = require("../tasks/startDevServer");
9
9
  const startElectron = require("../tasks/startElectron");
10
- const { exitProcessWithError, clearConsole } = require("../helpers/utils");
10
+ const watchPreloads = require("../tasks/watchPreloads");
11
11
 
12
12
 
13
13
  process.on("unhandledRejection", exitProcessWithError);
package/tasks/buildApp.js CHANGED
@@ -1,9 +1,9 @@
1
1
  const webpack = require("webpack");
2
2
 
3
- const webpackConfig = require("../webpack.config");
3
+ const { COMPILATION_STATES } = require("../helpers/constants");
4
4
  const spinnies = require("../helpers/spinnies");
5
5
  const { logStats, getCompilationText, clearConsole } = require("../helpers/utils");
6
- const { COMPILATION_STATES } = require("../helpers/constants");
6
+ const webpackConfig = require("../webpack.config");
7
7
 
8
8
 
9
9
  /**
@@ -3,8 +3,9 @@ const fs = require("fs");
3
3
  const detect = require("detect-port");
4
4
 
5
5
  const { isEnvProduction } = require("../helpers/environment");
6
- const rebuiltronConfig = require("../rebuiltronConfig");
7
6
  const { resolveApp } = require("../helpers/utils");
7
+ const rebuiltronConfig = require("../rebuiltronConfig");
8
+
8
9
 
9
10
  /**
10
11
  * @type {Promise<number>}
@@ -1,9 +1,9 @@
1
1
  const webpack = require("webpack");
2
2
 
3
- const webpackConfig = require("../webpack.config");
3
+ const { COMPILATION_ASSETS, COMPILATION_STATES } = require("../helpers/constants");
4
4
  const spinnies = require("../helpers/spinnies");
5
5
  const { getCompilationText, logStats } = require("../helpers/utils");
6
- const { COMPILATION_ASSETS, COMPILATION_STATES } = require("../helpers/constants");
6
+ const webpackConfig = require("../webpack.config");
7
7
 
8
8
 
9
9
  /**
@@ -1,12 +1,13 @@
1
+ const { bold } = require("chalk");
1
2
  const webpack = require("webpack");
2
3
  const WebpackDevServer = require("webpack-dev-server");
3
- const { bold } = require("chalk");
4
4
 
5
- const webpackConfig = require("../webpack.config");
6
- const devServerConfig = require("../webpackDevServer.config");
5
+ const { COMPILATION_ASSETS, COMPILATION_STATES } = require("../helpers/constants");
7
6
  const spinnies = require("../helpers/spinnies");
8
7
  const { getCompilationText, logStats, clearConsole } = require("../helpers/utils");
9
- const { COMPILATION_ASSETS, COMPILATION_STATES } = require("../helpers/constants");
8
+ const webpackConfig = require("../webpack.config");
9
+ const devServerConfig = require("../webpackDevServer.config");
10
+
10
11
 
11
12
  /**
12
13
  * Starts the development server.
@@ -1,6 +1,6 @@
1
1
  const { spawn } = require("child_process");
2
- const path = require("path");
3
2
  const fs = require("fs");
3
+ const path = require("path");
4
4
 
5
5
  const { bold } = require("chalk");
6
6
 
@@ -1,9 +1,9 @@
1
1
  const webpack = require("webpack");
2
2
 
3
- const webpackConfig = require("../webpack.config");
3
+ const { COMPILATION_ASSETS, COMPILATION_STATES } = require("../helpers/constants");
4
4
  const spinnies = require("../helpers/spinnies");
5
5
  const { logStats, getCompilationText, clearConsole } = require("../helpers/utils");
6
- const { COMPILATION_ASSETS, COMPILATION_STATES } = require("../helpers/constants");
6
+ const webpackConfig = require("../webpack.config");
7
7
 
8
8
 
9
9
  /**
package/webpack.config.js CHANGED
@@ -1,6 +1,6 @@
1
- const rendererConfig = require("./configurations/renderers");
2
- const preloadConfig = require("./configurations/preloads");
3
1
  const mainConfig = require("./configurations/main");
2
+ const preloadConfig = require("./configurations/preloads");
3
+ const rendererConfig = require("./configurations/renderers");
4
4
 
5
5
 
6
6
  module.exports = {