Skip to content

Commit 320a9d6

Browse files
Dont bundle node_modules into the packaged app
1 parent a26fea1 commit 320a9d6

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

app/main/lib/tray.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,29 @@ import path from "path";
44
import packageJson from "../../../package.json";
55
import { Settings } from "../../types/settings";
66
import {
7-
checkIdle,
8-
checkInWorkingHours,
9-
createBreak,
10-
getBreakTime,
11-
startBreakNow
7+
checkIdle,
8+
checkInWorkingHours,
9+
createBreak,
10+
getBreakTime,
11+
startBreakNow,
1212
} from "./breaks";
1313
import {
14-
getDisableEndTime,
15-
getSettings,
16-
setDisableEndTime,
17-
setSettings
14+
getDisableEndTime,
15+
getSettings,
16+
setDisableEndTime,
17+
setSettings,
1818
} from "./store";
1919
import { createSettingsWindow } from "./windows";
2020

2121
let tray: Tray;
2222
let lastMinsLeft = 0;
2323

24+
const rootPath = path.dirname(app.getPath("exe"));
25+
const resourcesPath =
26+
process.platform === "darwin"
27+
? path.resolve(rootPath, "..", "Resources")
28+
: rootPath;
29+
2430
function checkDisableTimeout() {
2531
const disableEndTime = getDisableEndTime();
2632

@@ -55,20 +61,19 @@ function getDisableTimeRemaining(): string {
5561
export function buildTray(): void {
5662
if (!tray) {
5763
let imgPath;
64+
5865
if (process.platform === "darwin") {
5966
imgPath =
6067
process.env.NODE_ENV === "development"
6168
? "resources/tray/tray-IconTemplate.png"
62-
: path.join(
63-
process.resourcesPath,
64-
"app/resources/tray/tray-IconTemplate.png"
65-
);
69+
: path.join(resourcesPath, "tray", "tray-IconTemplate.png");
6670
} else {
6771
imgPath =
6872
process.env.NODE_ENV === "development"
6973
? "resources/tray/icon.png"
70-
: path.join(process.resourcesPath, "app/resources/tray/icon.png");
74+
: path.join(resourcesPath, "tray", "icon.png");
7175
}
76+
7277
tray = new Tray(imgPath);
7378

7479
// On windows, context menu will not show on left click by default

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "breaktimer",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"productName": "BreakTimer",
55
"description": "Manage periodic breaks",
66
"scripts": {
@@ -33,6 +33,7 @@
3333
"copyright": "Copyright © 2019 Thomas James Watson",
3434
"appId": "com.tomjwatson.breaktimer",
3535
"files": [
36+
"!node_modules",
3637
"app/renderer/dist/",
3738
"app/renderer/sounds/",
3839
"app/renderer/preload.js",
@@ -55,6 +56,12 @@
5556
]
5657
}
5758
],
59+
"extraResources": [
60+
{
61+
"from": "resources/tray",
62+
"to": "tray"
63+
}
64+
],
5865
"asar": true,
5966
"artifactName": "${productName}.${ext}",
6067
"mac": {

0 commit comments

Comments
 (0)