Skip to content

Commit 4e1d052

Browse files
committed
fixed issues in build and bumped package.json file to 2.0.2
1 parent d2fddb0 commit 4e1d052

File tree

10 files changed

+48
-19
lines changed

10 files changed

+48
-19
lines changed

.erb/configs/webpack.config.main.dev.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ const configuration = {
2828
filename: '[name].dev.js',
2929
},
3030

31+
module: {
32+
rules: [
33+
// Images
34+
{
35+
test: /\.(png|svg|jpg|jpeg|gif)$/i,
36+
type: 'asset/resource',
37+
},
38+
],
39+
},
40+
3141
plugins: [
3242
/**
3343
* Create global constants which can be configured at compile time.

.erb/configs/webpack.config.main.prod.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ const configuration = {
3737
output: {
3838
path: webpackPaths.distMainPath,
3939
filename: '[name].prod.js',
40+
clean: true
41+
},
42+
43+
module: {
44+
rules: [
45+
// Images
46+
{
47+
test: /\.(png|svg|jpg|jpeg|gif)$/i,
48+
type: 'asset/resource',
49+
generator: {
50+
filename: '[name][ext]'
51+
}
52+
},
53+
],
4054
},
4155

4256
optimization: {

.erb/configs/webpack.config.renderer.prod.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const configuration = {
4949
path: path.join(webpackPaths.distRendererPath, './'),
5050
publicPath: path.join(webpackPaths.distRendererPath, './'),
5151
filename: '[name].renderer.prod.js',
52+
clean: true
5253
// library: {
5354
// type: 'umd',
5455
// },

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
npm run build
8181
npm --prefix ./release/app install @electron-forge/cli -D
8282
npm --prefix ./release/app install @electron-forge/plugin-auto-unpack-natives -D
83-
cd ./release/app && npx electron-forge import && npx electron-forge make
83+
cd ./release/app && npx electron-forge import && cp ../../forge.config.template.js ./forge.config.js && npx electron-forge make
8484
8585
- name: 'Upload Ubuntu Artifacts'
8686
uses: actions/upload-artifact@v2

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ cd ./release/app
113113
npx electron-forge import
114114
```
115115

116+
```commandline
117+
cp ../../forge.config.template.js ./forge.config.js
118+
```
119+
116120
### Build Executable
117121

118122
1. After running the command above, electron forge modifies your project (mostly release/app/package.json) to the format it accepts while building an executable. run the command below while still in the release/app/ directory to build an executable for your local machine (be patient, this can take a while).
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ module.exports = {
22
packagerConfig: {
33
asar: true,
44
},
5-
plugins: [['@electron-forge/plugin-auto-unpack-natives']],
5+
plugins: [{name: '@electron-forge/plugin-auto-unpack-natives', config: {}}],
66
makers: [
77
{
88
name: '@electron-forge/maker-squirrel',
99
config: {
10-
name: 'ui_client',
10+
name: 'ui-client',
1111
},
1212
},
1313
{
@@ -17,13 +17,13 @@ module.exports = {
1717
{
1818
name: '@electron-forge/maker-deb',
1919
config: {
20-
icon: '../../assets/icon.png',
20+
icon: './dist/main/icon.png',
2121
},
2222
},
2323
{
2424
name: '@electron-forge/maker-rpm',
2525
config: {
26-
icon: '../../assets/icon.png',
26+
icon: './dist/main/icon.png',
2727
},
2828
},
2929
],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ui-client",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "The Bug Hunter's Workbench",
55
"repository": {
66
"type": "git",

release/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ui-client",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "The Bug Hunter's Workbench",
55
"repository": {
66
"type": "git",

src/main/utils.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@ import { createRequire } from 'module';
66

77
export const require = createRequire(import.meta.url);
88

9-
export const isDev =
10-
process.env.NODE_ENV === 'development' ||
9+
export const isDev = () => process.env.NODE_ENV === 'development' ||
1110
process.env.DEBUG_PROD === 'true' ||
1211
!app.isPackaged;
1312

1413
export const getDirName = url => path.dirname(new URL(url).pathname);
1514

16-
const RESOURCES_PATH = isDev
17-
? path.join(getDirName(import.meta.url), '../../assets')
18-
: path.join(process.resourcesPath, 'assets');
15+
// const resourcesPath = () => isDev()
16+
// ? path.resolve(getDirName(import.meta.url), '..','..','assets')
17+
// : path.join(process.resourcesPath, 'assets');
1918

20-
export const getAssetPath = (...paths) => path.join(RESOURCES_PATH, ...paths);
19+
// export const getAssetPath = (...paths) => path.join(resourcesPath(), ...paths);
2120

22-
const getFullPath = filename =>
21+
const getFullPath = filename => isDev() ?
2322
path.resolve(
2423
getDirName(import.meta.url),
2524
'..',
@@ -29,7 +28,7 @@ const getFullPath = filename =>
2928
'dist',
3029
'renderer',
3130
filename,
32-
);
31+
) : path.join(process.resourcesPath, 'app.asar/dist/renderer', filename);
3332

3433
export const resolveHtmlPath = htmlFileName =>
3534
`file://${getFullPath(htmlFileName)}`;

src/main/window.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { BrowserWindow, shell } from 'electron';
22
import { getWindowPosition } from './config';
33
import { updateWindowInfo, openDevTools } from './ipcMain'; // eslint-disable-line no-unused-vars
4-
import { require, isDev, getAssetPath, resolveHtmlPath } from './utils';
4+
import { require, isDev, resolveHtmlPath } from './utils';
5+
import ui_icon from '../../assets/icon.png';
56

67
const installExtensions = async () => {
78
const installer = require('electron-devtools-installer');
@@ -16,12 +17,12 @@ const installExtensions = async () => {
1617

1718
// eslint-disable-next-line no-unused-vars
1819
const devSetup = async () => {
19-
if (process.env.NODE_ENV === 'production' && isDev) {
20+
if (process.env.NODE_ENV === 'production' && isDev()) {
2021
const sourceMapSupport = require('source-map-support');
2122
sourceMapSupport.install();
2223
}
2324

24-
if (isDev) {
25+
if (isDev()) {
2526
const debug = require('electron-debug');
2627
debug();
2728
await installExtensions();
@@ -39,7 +40,7 @@ export const createWindow = async () => {
3940
const window = new BrowserWindow({
4041
title: 'CPG UI Client',
4142
// titleBarStyle: 'hiddenInset',
42-
icon: getAssetPath('icon.png'),
43+
icon: ui_icon,
4344
frame: true,
4445
// transparent: isMac,
4546
acceptFirstMouse: true,

0 commit comments

Comments
 (0)