Update to 5.x

This commit is contained in:
Leon 2021-04-25 16:00:56 +02:00
parent 131a40fdf1
commit cd7f0df9c8
2 changed files with 61 additions and 17 deletions

View file

@ -1,14 +1,14 @@
# Maintainer: leonekmi <usingarchbtw@leonekmi.fr>
pkgname=karaokemugen
pkgver=4.1.18
pkgrel=2
pkgver=5.0.33
pkgrel=1
pkgdesc="Karaoke playlist manager/player app used in parties or events."
arch=('any')
arch=('x86_64')
url="https://mugen.karaokes.moe/"
license=('MIT')
groups=()
depends=('mpv' 'ffmpeg' 'postgresql' 'electron')
makedepends=('git' 'npm' 'typescript' 'yarn' 'nodejs>=12' 'python2')
depends=('mpv' 'ffmpeg' 'postgresql' 'electron11')
makedepends=('git' 'npm' 'typescript' 'yarn' 'nodejs>=12' 'python2' 'patch')
optdepends=('sudo: for using karaokemugen-install script')
provides=()
conflicts=()
@ -16,25 +16,32 @@ replaces=()
backup=()
options=()
install=${pkgname}.install
source=('karaokemugen::git+https://lab.shelter.moe/karaokemugen/karaokemugen-app.git#tag=v4.1.18'
source=('karaokemugen::git+https://lab.shelter.moe/karaokemugen/karaokemugen-app.git#tag=v5.0.33'
'karaokemugen-lib::git+https://lab.shelter.moe/karaokemugen/lib.git'
'karaokemugen-avatars::git+https://lab.shelter.moe/karaokemugen/medias/guest-avatars.git'
'install.sh'
'run.sh'
'icon256.png'
'karaokemugen.desktop')
'karaokemugen.desktop'
'appPath.patch')
noextract=()
md5sums=('SKIP'
'SKIP'
'412f93c38e0d79eb2d98cce3afd2a194'
'SKIP'
'4ad5390b139dc5b5e78e6eef8411e90b'
'0d0d432f35c56a962f9d386f391c6036'
'5e9a33a42fef7572b7e0fa504c586f32'
'10561eed906a5efeed427f90501b4f49')
'10561eed906a5efeed427f90501b4f49'
'1c331f8ccc9b3157ac0d9af4b559dd69')
prepare() {
cd "$srcdir/${pkgname}"
git submodule init
git config submodule.src/lib.url $srcdir/${pkgname}-lib
git config submodule.assets/guestAvatars.url $srcdir/${pkgname}-avatars
git submodule update
# Apply appPath patch
patch "$srcdir/${pkgname}/src/index.ts" "$srcdir/appPath.patch"
}
build() {
@ -45,18 +52,15 @@ build() {
export XDG_CACHE_HOME="$srcdir/$pkgname-cache"
export npm_config_devdir="$srcdir/$pkgname-npm-dev"
export npm_config_cache="$srcdir/$pkgname-npm-cache"
yarn global add electron-builder
yarn install
yarn installFrontend
yarn installSystemPanel
yarn add --dev electron-builder
yarn installkmfrontend
# Build and package with electron-builder
export NODE_ENV='production'
electronDist=$(dirname $(realpath $(which electron)))
electronVer=$(electron --version | tail -c +2)
electronVer=$(electron11 --version | tail -c +2)
yarn build
yarn buildFrontend
yarn buildSystemPanel
"$(yarn global dir)/node_modules/.bin/electron-builder" --linux --x64 -c.electronDist=$electronDist -c.electronVersion=$electronVer --dir
yarn buildkmfrontend
yarn electron-builder --linux --x64 -c.electronDist=/usr/lib/electron11 -c.electronVersion=$electronVer --dir
}
package() {

40
appPath.patch Normal file
View file

@ -0,0 +1,40 @@
Index: src/index.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/index.ts b/src/index.ts
--- a/src/index.ts (revision 34a92a6909d715ac95609eb4047e9b94a2de8152)
+++ b/src/index.ts (revision 33ae1fd1580e7ac890c400d7514953a07c3c7eca)
@@ -5,7 +5,7 @@
import {copy, mkdirpSync, remove} from 'fs-extra';
import i18n from 'i18next';
import cloneDeep from 'lodash.clonedeep';
-import {resolve} from 'path';
+import {dirname,resolve} from 'path';
import {getPortPromise} from 'portfinder';
import {createInterface} from 'readline';
@@ -85,12 +85,18 @@
: resolve(app.getAppPath(), '../../');
resourcePath = process.resourcesPath;
} else {
- // Starting Electron from source folder
- appPath = app.getAppPath();
- resourcePath = appPath;
+ if (app.getAppPath().endsWith('.asar')) {
+ // Starting Electron from an asar directly (electron /path/to/app.asar)
+ appPath = dirname(app.getAppPath());
+ resourcePath = appPath;
+ } else {
+ // Starting Electron from source folder
+ appPath = app.getAppPath();
+ resourcePath = appPath;
+ }
}
} else {
- // No Electron start, so in git mode
+ // Non-electron environments (ts-node, node)
appPath = process.cwd();
resourcePath = appPath;
}