From f320fded71708119d67ab94acc7eef6866605e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathis=20Dr=C3=B6ge?= Date: Sat, 3 Feb 2024 21:56:19 +0100 Subject: [PATCH] General repo cleanup (#3420) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Move electron-builder config into separate file * Actually exclude yarn lock file from GitHub diffs "-diff" only tells Git to treat the file as binary, which was not my intention with the original change * Remove unused ESLint config section This isn't used, since we have a proper config file (.eslintrc) * Include JS files in ESLint * Move `scripts` above `dependencies` This is just for readability’s sake. I'd argue that adding/modifying scripts happens more often than manually modifying our dependency list * Rename `.eslintrc` -> `.eslintrc.json` * Add more Webstorm config files to the repo This adds: - ESLint and Prettier config - A scope for the `src` directory - Git commit lines being limited to 80 characters * Remove comment from ESLint's tsconfig Comments aren't valid JSON --- .eslintignore | 2 + .eslintrc => .eslintrc.json | 0 .gitattributes | 2 +- .idea/inspectionProfiles/Project_Default.xml | 6 + .idea/prettier.xml | 3 +- .idea/scopes/Source_Code.xml | 3 + .idea/vcs.xml | 5 +- electron-builder.yml | 94 ++++++++++ package.json | 175 +++---------------- tsconfig.eslint.json | 3 +- 10 files changed, 139 insertions(+), 154 deletions(-) rename .eslintrc => .eslintrc.json (100%) create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/scopes/Source_Code.xml create mode 100644 electron-builder.yml diff --git a/.eslintignore b/.eslintignore index 359335e5f1..9e691040eb 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,5 @@ sign/** flatpak-build/** playwright-report/** +build/**/* +dist/**/* diff --git a/.eslintrc b/.eslintrc.json similarity index 100% rename from .eslintrc rename to .eslintrc.json diff --git a/.gitattributes b/.gitattributes index bf1a0c8740..1afcec494d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -yarn.lock -diff \ No newline at end of file +yarn.lock linguist-generated=true diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000000..03d9549ea8 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/prettier.xml b/.idea/prettier.xml index b0ab31a954..78546c3d7d 100644 --- a/.idea/prettier.xml +++ b/.idea/prettier.xml @@ -1,6 +1,7 @@ + - \ No newline at end of file + diff --git a/.idea/scopes/Source_Code.xml b/.idea/scopes/Source_Code.xml new file mode 100644 index 0000000000..421352179e --- /dev/null +++ b/.idea/scopes/Source_Code.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 3e19a6f0fd..869d84622a 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,7 +2,10 @@ - + + + diff --git a/electron-builder.yml b/electron-builder.yml new file mode 100644 index 0000000000..6ab663ea93 --- /dev/null +++ b/electron-builder.yml @@ -0,0 +1,94 @@ +appId: com.heroicgameslauncher.hgl +productName: Heroic +afterSign: sign/afterSign.js +afterPack: sign/afterPack.js +files: + - build/**/* + - node_modules/**/* + - '!build/bin/*' + - build/bin/legendary.LICENSE + +asarUnpack: + - build/icon.png + - build/icon.icns + - build/win_icon.ico + - build/icon-dark.png + - build/icon-light.png + - build/webviewPreload.js + +electronDownload: + mirror: https://github.com/castlabs/electron-releases/releases/download/v + +protocols: + - name: heroic + schemes: + - heroic + +win: + artifactName: ${productName}-${version}-Setup-${arch}.${ext} + icon: build/win_icon.ico + asarUnpack: + - build/bin/win32/legendary.exe + - build/bin/win32/gogdl.exe + - build/bin/win32/nile.exe + files: build/bin/win32/* + +portable: + artifactName: ${productName}-${version}-Portable-${arch}.${ext} + +mac: + artifactName: ${productName}-${version}-macOS-${arch}.${ext} + category: public.app-category.games + icon: build/icon.icns + entitlements: build/entitlements.mac.plist + entitlementsInherit: build/entitlements.mac.plist + extendInfo: + com.apple.security.cs.allow-jit: true + asarUnpack: + - build/bin/darwin/legendary + - build/bin/darwin/gogdl + - build/bin/darwin/nile + files: + - build/bin/darwin/* + +dmg: + background: public/dmg.png + window: + width: 600 + height: 500 + contents: + - x: 10 + y: 215 + type: file + - x: 420 + y: 215 + type: link + path: /Applications + +linux: + category: Game + icon: build/icon.icns + description: An Open Source Launcher for GOG and Epic Games + desktop: + Name: Heroic Games Launcher + Comment[de]: Ein Open Source Spielelauncher for GOG und Epic Games + asarUnpack: + - build/bin/linux/legendary + - build/bin/linux/gogdl + - build/bin/linux/nile + - build/bin/linux/vulkan-helper + files: + - build/bin/linux/* + +snap: + base: core20 + confinement: strict + grade: stable + category: Games + synopsis: An Open Source Launcher for GOG Amazon and Epic Games + description: Heroic is an Open Source Games Launcher. Right now it supports launching games from the Epic Games Store using Legendary Amazon Games using Nile and GOG Games using our custom implementations Nile and gogdl. + publish: + provider: snapStore + channels: + - edge + repo: heroic diff --git a/package.json b/package.json index 44655abf1e..692e25f53b 100644 --- a/package.json +++ b/package.json @@ -21,122 +21,32 @@ "engines": { "node": ">= 16" }, - "build": { - "appId": "com.heroicgameslauncher.hgl", - "productName": "Heroic", - "afterSign": "sign/afterSign.js", - "afterPack": "sign/afterPack.js", - "files": [ - "build/**/*", - "node_modules/**/*", - "!build/bin/*", - "build/bin/legendary.LICENSE" - ], - "asarUnpack": [ - "build/icon.png", - "build/icon.icns", - "build/win_icon.ico", - "build/icon-dark.png", - "build/icon-light.png", - "build/webviewPreload.js" - ], - "electronDownload": { - "mirror": "https://github.com/castlabs/electron-releases/releases/download/v" - }, - "protocols": [ - { - "name": "heroic", - "schemes": [ - "heroic" - ] - } - ], - "win": { - "artifactName": "${productName}-${version}-Setup-${arch}.${ext}", - "icon": "build/win_icon.ico", - "asarUnpack": [ - "build/bin/win32/legendary.exe", - "build/bin/win32/gogdl.exe", - "build/bin/win32/nile.exe" - ], - "files": [ - "build/bin/win32/*" - ] - }, - "portable": { - "artifactName": "${productName}-${version}-Portable-${arch}.${ext}" - }, - "mac": { - "artifactName": "${productName}-${version}-macOS-${arch}.${ext}", - "category": "public.app-category.games", - "icon": "build/icon.icns", - "entitlements": "build/entitlements.mac.plist", - "entitlementsInherit": "build/entitlements.mac.plist", - "extendInfo": { - "com.apple.security.cs.allow-jit": true - }, - "asarUnpack": [ - "build/bin/darwin/legendary", - "build/bin/darwin/gogdl", - "build/bin/darwin/nile" - ], - "files": [ - "build/bin/darwin/*" - ] - }, - "dmg": { - "background": "public/dmg.png", - "window": { - "width": "600", - "height": "500" - }, - "contents": [ - { - "x": 10, - "y": 215, - "type": "file" - }, - { - "x": 420, - "y": 215, - "type": "link", - "path": "/Applications" - } - ] - }, - "linux": { - "category": "Game", - "icon": "build/icon.icns", - "description": "An Open Source Launcher for GOG and Epic Games", - "desktop": { - "Name": "Heroic Games Launcher", - "Comment[de]": "Ein Open Source Spielelauncher for GOG und Epic Games" - }, - "asarUnpack": [ - "build/bin/linux/legendary", - "build/bin/linux/gogdl", - "build/bin/linux/nile", - "build/bin/linux/vulkan-helper" - ], - "files": [ - "build/bin/linux/*" - ] - }, - "snap": { - "base": "core20", - "confinement": "strict", - "grade": "stable", - "category": "Games", - "synopsis": "An Open Source Launcher for GOG, Amazon and Epic Games", - "description": "Heroic is an Open Source Games Launcher. Right now it supports launching games from the Epic Games Store using Legendary, Amazon Games using Nile and GOG Games using our custom implementations Nile and gogdl.", - "publish": { - "provider": "snapStore", - "channels": [ - "edge" - ], - "repo": "heroic" - } - } + "scripts": { + "start": "vite", + "codecheck": "tsc --noEmit", + "find-deadcode": "ts-prune --error", + "test": "jest", + "test-watch": "jest --watch --maxWorkers=25%", + "test:ci": "jest --runInBand --silent", + "test:e2e": "vite build && cross-env CI=e2e xvfb-maybe -- playwright test", + "release:linux": "vite build && electron-builder -p always --linux deb AppImage rpm pacman tar.xz snap", + "release:mac": "vite build && electron-builder -p always --mac --x64 --arm64", + "release:win": "vite build && electron-builder -p always --win portable --x64", + "release:updateFlathub:ci": "tsc flathub/update-flathub.ts --skipLibCheck --target es2015 --moduleResolution node --module commonjs && node flathub/update-flathub.js", + "sign:win": "vite build && electron-builder -p never --win nsis --x64", + "dist:linux": "vite build && electron-builder --linux", + "dist:mac": "export CSC_IDENTITY_AUTO_DISCOVERY=false && vite build && electron-builder --mac", + "dist:win": "vite build && electron-builder --win", + "dist:flatpak": "yarn dist:linux appimage && yarn flatpak:prepare && yarn flatpak:build", + "lint": "eslint --cache --ext .tsx,ts .", + "lint-fix": "eslint --fix --ext .tsx,ts ./src", + "flatpak:build": "cd flatpak-build && flatpak-builder build com.heroicgameslauncher.hgl.yml --install --force-clean --user", + "flatpak:prepare": "node ./flatpak/prepareFlatpak.js", + "flatpak:prepare-release": "node ./flatpak/prepareFlatpak.js release", + "i18n": "i18next --silent", + "prepare": "husky install", + "prettier": "prettier --check .", + "prettier-fix": "prettier --write ." }, "dependencies": { "@emotion/react": "11.10.6", @@ -193,39 +103,6 @@ "xvfb-maybe": "^0.2.1", "zod": "3.22.3" }, - "scripts": { - "start": "vite", - "codecheck": "tsc --noEmit", - "find-deadcode": "ts-prune --error", - "test": "jest", - "test-watch": "jest --watch --maxWorkers=25%", - "test:ci": "jest --runInBand --silent", - "test:e2e": "vite build && cross-env CI=e2e xvfb-maybe -- playwright test", - "release:linux": "vite build && electron-builder -p always --linux deb AppImage rpm pacman tar.xz snap", - "release:mac": "vite build && electron-builder -p always --mac --x64 --arm64", - "release:win": "vite build && electron-builder -p always --win portable --x64", - "release:updateFlathub:ci": "tsc flathub/update-flathub.ts --skipLibCheck --target es2015 --moduleResolution node --module commonjs && node flathub/update-flathub.js", - "sign:win": "vite build && electron-builder -p never --win nsis --x64", - "dist:linux": "vite build && electron-builder --linux", - "dist:mac": "export CSC_IDENTITY_AUTO_DISCOVERY=false && vite build && electron-builder --mac", - "dist:win": "vite build && electron-builder --win", - "dist:flatpak": "yarn dist:linux appimage && yarn flatpak:prepare && yarn flatpak:build", - "lint": "eslint --cache -c .eslintrc --ext .tsx,ts .", - "lint-fix": "eslint --fix -c .eslintrc --ext .tsx,ts ./src", - "flatpak:build": "cd flatpak-build && flatpak-builder build com.heroicgameslauncher.hgl.yml --install --force-clean --user", - "flatpak:prepare": "node ./flatpak/prepareFlatpak.js", - "flatpak:prepare-release": "node ./flatpak/prepareFlatpak.js release", - "i18n": "i18next --silent", - "prepare": "husky install", - "prettier": "prettier --check .", - "prettier-fix": "prettier --write ." - }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ] - }, "devDependencies": { "@electron/notarize": "^2.1.0", "@playwright/test": "1.39.0", diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index ebbd01cf94..4af46af947 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -1,6 +1,5 @@ { - // extend your base config so you don't have to redefine your compilerOptions "extends": "./tsconfig.json", - "include": ["**/*.ts", "**/*.tsx"], + "include": ["**/*.ts", "**/*.tsx", "**/*.js"], "exclude": [] }