Skip to content

Commit a5db684

Browse files
Nocccerweblateapokolokynthosisflavioislimadpanter
authored
[Tech] Add ts-prune to find dead code (#2210)
* [i18n] Updated Translations (#2076) * Update translation files Updated by "Squash Git commits" hook in Weblate. Co-authored-by: Hosted Weblate <[email protected]> Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/gamepage/ Translation: Heroic Games Launcher/GamePage * Update translation files Updated by "Squash Git commits" hook in Weblate. Co-authored-by: Hosted Weblate <[email protected]> Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/gamepage/ Translation: Heroic Games Launcher/GamePage * Translated using Weblate (French) Currently translated at 100.0% (401 of 401 strings) Update translation files Updated by "Squash Git commits" hook in Weblate. Co-authored-by: Hosted Weblate <[email protected]> Co-authored-by: John Donne <[email protected]> Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/gamepage/ Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/globals/fr/ Translation: Heroic Games Launcher/GamePage Translation: Heroic Games Launcher/Globals * Update translation files Updated by "Squash Git commits" hook in Weblate. Co-authored-by: Hosted Weblate <[email protected]> Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/gamepage/ Translation: Heroic Games Launcher/GamePage * Update translation files Updated by "Squash Git commits" hook in Weblate. Co-authored-by: Hosted Weblate <[email protected]> Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/gamepage/ Translation: Heroic Games Launcher/GamePage * Update translation files Updated by "Squash Git commits" hook in Weblate. Co-authored-by: Hosted Weblate <[email protected]> Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/gamepage/ Translation: Heroic Games Launcher/GamePage * Update translation files Updated by "Squash Git commits" hook in Weblate. Co-authored-by: Hosted Weblate <[email protected]> Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/gamepage/ Translation: Heroic Games Launcher/GamePage * Update translation files Updated by "Squash Git commits" hook in Weblate. Translation: Heroic Games Launcher/Globals Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/globals/ Co-authored-by: John Donne <[email protected]> * [Fix] Beta 3 Fixes + some small improvements (#2079) * fix: hide wine options on macOS * fix: playing status not changing correctly * fix: download progress color * fix: wine-manager reload button * fix: launch win sideloaded games on macOS * fix: isGameAvailable for sideloaded games * fix: dont show wine tools on windows and mac * feat: game not available status * feat: improved not available check on game page * i18n: updated keys * fix: dont show update button when not available * fix: gamecard not available classes * fix: getInstallInfo error when json parse fails * other: fade in card animation * chore: heroic version hover * fix: reload gamecard on status changes * fix: proper pass platform when importing epic games * i18n: updated keys * fix: compute saves path for windows games on macOS * fix: gamecard status not updating after import * feat: proper show not supported games * fix: codecheck * fix: Hiding a game doesn't remove it from the list unless re-rendered #2078 * fix: showing as not available after uninstall * fix: typo * fix: hide runexe for native games on sideload * fix: hide wine options for native games * fix: show refreshing icon when refreshing library * fix: pr comments * chore: renamed import * fix: remove install info for unsuported games * fix: dont fetch changelog if already saw it * fix: installing native macOS games for GOG * chore: removed audioFix settings and component * [Revert] Revert #2075 (#2090) * chore: updated version * chore: readme update * fix: GameList Header columns * fix: uninstalled status on game list * fix: platform filter on macOS * chore: accurate macOS info * fix: gog error message when apiData is null * [Other] Update icons with better quality ones (#2096) * other: updated tray icons and added OS logic * chore: log * [i18n] Updated Translations (#2088) * Translated using Weblate (Swedish) Currently translated at 100.0% (402 of 402 strings) Update translation files Updated by "Squash Git commits" hook in Weblate. Co-authored-by: Hosted Weblate <[email protected]> Co-authored-by: dpanter <[email protected]> Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/gamepage/ Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/globals/sv/ Translation: Heroic Games Launcher/GamePage Translation: Heroic Games Launcher/Globals * Update translation files Updated by "Squash Git commits" hook in Weblate. Co-authored-by: Hosted Weblate <[email protected]> Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/gamepage/ Translation: Heroic Games Launcher/GamePage * Update translation files Updated by "Squash Git commits" hook in Weblate. Co-authored-by: Hosted Weblate <[email protected]> Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/gamepage/ Translation: Heroic Games Launcher/GamePage * Update translation files Updated by "Squash Git commits" hook in Weblate. Co-authored-by: Hosted Weblate <[email protected]> Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/gamepage/ Translation: Heroic Games Launcher/GamePage * Update translation files Updated by "Squash Git commits" hook in Weblate. Co-authored-by: Hosted Weblate <[email protected]> Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/gamepage/ Translation: Heroic Games Launcher/GamePage * Update translation files Updated by "Squash Git commits" hook in Weblate. Co-authored-by: Hosted Weblate <[email protected]> Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/gamepage/ Translation: Heroic Games Launcher/GamePage * Update translation files Updated by "Squash Git commits" hook in Weblate. Co-authored-by: Hosted Weblate <[email protected]> Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/gamepage/ Translation: Heroic Games Launcher/GamePage * Update translation files Updated by "Squash Git commits" hook in Weblate. Translation: Heroic Games Launcher/Globals Translate-URL: https://hosted.weblate.org/projects/heroic-games-launcher/globals/ Co-authored-by: dpanter <[email protected]> * [Feature/Wine] Add DXVK Framerate Limit Toggle (#2068) * [Feature] Add DXVK FPS Limit toggle Checkbox to enable/disable DXVK FPS and a text field to input enter FPS cap value * Run prettier * Fix function not used error * Show for macOS Crossover and Linux Wine games * Add !nativeGame * Add ts-prune * yarn i18n * Merge clean up * Remove clearFinished * Merge fixes * yarn i18n * Review suggestions * Only uncomment moveInstall * Debug workflow * Remove debug * Debug workflow * Remove debug * Dont export ProtonVerb * prettier-fix * Remove moveInstall for sideload apps * Add find-deadcode to linter workflow * review fixes Co-authored-by: Weblate (bot) <[email protected]> Co-authored-by: John Donne <[email protected]> Co-authored-by: Flávio F Lima <[email protected]> Co-authored-by: dpanter <[email protected]> Co-authored-by: Rishabh Moharir <[email protected]>
1 parent cdcd16f commit a5db684

File tree

42 files changed

+336
-394
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+336
-394
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ jobs:
1919
run: yarn lint
2020
- name: Prettier code.
2121
run: yarn prettier
22+
- name: Find dead code
23+
run: yarn find-deadcode

.ts-prunerc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ignore": "src/common/typedefs"
3+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,13 @@
164164
"source-map-support": "^0.5.21",
165165
"steam-shortcut-editor": "^3.1.1",
166166
"systeminformation": "^5.15.0",
167+
"ts-prune": "^0.10.3",
167168
"tslib": "^2.4.0"
168169
},
169170
"scripts": {
170171
"start": "vite",
171172
"codecheck": "tsc --noEmit",
173+
"find-deadcode": "ts-prune --error",
172174
"test": "jest",
173175
"test-watch": "jest --watch --maxWorkers=25%",
174176
"test:ci": "jest --runInBand --silent",

src/backend/__mocks__/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ constants.configStore = {
88

99
constants.currentLogFile = 'current.log'
1010
constants.lastLogFile = 'last.log'
11+
constants.isSteamDeckGameMode = false
1112

1213
module.exports = constants
1314
export {}

src/backend/__mocks__/electron.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ const app = {
1818
// app override
1919
getPath: jest.fn().mockImplementation((path: string) => {
2020
return join(appBasePath, path)
21-
})
21+
}),
22+
getVersion: jest.fn()
2223
}
2324

2425
class Notification {

src/backend/__mocks__/i18next.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@ const t = (key: string) => {
22
return key
33
}
44

5-
export default { t }
5+
const i18next = {
6+
t: t
7+
}
8+
9+
export { i18next as default, t }

src/backend/__mocks__/utils.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/backend/__tests__/constants.test.ts

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { fixAsarPath, getShell } from '../constants'
1+
import { fixAsarPath } from '../constants'
22

33
jest.mock('../logger/logfile')
44

@@ -26,34 +26,52 @@ describe('Constants - getShell', () => {
2626
return original_os
2727
}
2828

29-
test('get enviroment SHELL for unix os', () => {
29+
async function getShell(): Promise<string> {
30+
jest.resetModules()
31+
return await import('../constants').then((module) => {
32+
return module.execOptions.shell
33+
})
34+
}
35+
36+
test('get shell for linux', async () => {
3037
// override platform
3138
const originalPlatform = overrideProcessPlatform('linux')
3239

33-
const shell = getShell()
40+
const shell = await getShell()
3441
expect(shell).toBe('/bin/bash')
3542

3643
// get back to original platform
3744
overrideProcessPlatform(originalPlatform)
3845
})
3946

40-
test('get default shell for unix os', () => {
47+
test('get shell for windows', async () => {
4148
// override platform
42-
const originalPlatform = overrideProcessPlatform('linux')
49+
const originalPlatform = overrideProcessPlatform('win32')
4350

44-
const shell = getShell()
45-
expect(shell).toBe('/bin/bash')
51+
const shell = await getShell()
52+
expect(shell).toBe('powershell.exe')
4653

4754
// get back to original platform
4855
overrideProcessPlatform(originalPlatform)
4956
})
5057

51-
test('get powershell windows', () => {
58+
test('get shell for mac', async () => {
5259
// override platform
53-
const originalPlatform = overrideProcessPlatform('win32')
60+
const originalPlatform = overrideProcessPlatform('darwin')
5461

55-
const shell = getShell()
56-
expect(shell).toBe('powershell.exe')
62+
const shell = await getShell()
63+
expect(shell).toBe('/bin/zsh')
64+
65+
// get back to original platform
66+
overrideProcessPlatform(originalPlatform)
67+
})
68+
69+
test('get default shell for unix os', async () => {
70+
// override platform
71+
const originalPlatform = overrideProcessPlatform('linux')
72+
73+
const shell = await getShell()
74+
expect(shell).toBe('/bin/bash')
5775

5876
// get back to original platform
5977
overrideProcessPlatform(originalPlatform)

src/backend/__tests__/main_window.test.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
createMainWindow,
3-
setMainWindow,
4-
sendFrontendMessage
5-
} from '../main_window'
1+
import { createMainWindow, sendFrontendMessage } from '../main_window'
62
import { BrowserWindow, Display, screen } from 'electron'
73
import { configStore } from '../constants'
84

@@ -13,7 +9,6 @@ describe('main_window', () => {
139
describe('if no main window', () => {
1410
beforeAll(() => {
1511
BrowserWindow['setAllWindows']([])
16-
setMainWindow(null)
1712
})
1813

1914
it('returns false', () => {
@@ -30,7 +25,6 @@ describe('main_window', () => {
3025

3126
// stub windows
3227
beforeAll(() => {
33-
setMainWindow(null)
3428
BrowserWindow['setAllWindows']([window])
3529
})
3630

@@ -41,7 +35,6 @@ describe('main_window', () => {
4135

4236
// cleanup stubs
4337
afterAll(() => {
44-
setMainWindow(null)
4538
BrowserWindow['setAllWindows']([])
4639
})
4740

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"test_data": {
3+
"data": [
4+
{
5+
"html_url": "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/releases/tag/v2.6.0-beta.1",
6+
"id": 100,
7+
"tag_name": "v2.6.0-beta.1",
8+
"name": "2.6.0 Beta",
9+
"prerelease": true,
10+
"published_at": "2022-13-14T10:53:29Z",
11+
"body": "2.6.0 Beta Release"
12+
},
13+
{
14+
"html_url": "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/releases/tag/v2.5.2",
15+
"id": 200,
16+
"tag_name": "v2.5.2",
17+
"name": "2.5.2 HOTFIX #2",
18+
"prerelease": false,
19+
"published_at": "2022-12-14T10:53:29Z",
20+
"body": "2.5.2 HOTFIX #2 Release"
21+
},
22+
{
23+
"html_url": "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/releases/tag/v2.5.0-beta.3",
24+
"id": 300,
25+
"tag_name": "v2.5.0-beta.3",
26+
"name": "2.5.0 Beta",
27+
"prerelease": true,
28+
"published_at": "2022-11-14T10:53:29Z",
29+
"body": "2.5.0 Beta Release"
30+
},
31+
{
32+
"html_url": "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/releases/tag/v2.5.0",
33+
"id": 400,
34+
"tag_name": "v2.5.0",
35+
"name": "2.5.0",
36+
"prerelease": false,
37+
"published_at": "2022-10-14T10:53:29Z",
38+
"body": "2.5.0 Release"
39+
}
40+
]
41+
}
42+
}

0 commit comments

Comments
 (0)