mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
Fix various build issues (#1942)
* remove dynamic import for platform features * increase node memory limit on macOS build * fix invalid dynamic imports in renderer * remove discord-rpc import in renderer
This commit is contained in:
@@ -24,6 +24,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build and Publish releases
|
- name: Build and Publish releases
|
||||||
env:
|
env:
|
||||||
|
NODE_OPTIONS: --max-old-space-size=4096
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
uses: nick-invision/retry@v3.0.2
|
uses: nick-invision/retry@v3.0.2
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -1,2 +1,9 @@
|
|||||||
import './core';
|
import './core';
|
||||||
import(`./${process.platform}`);
|
|
||||||
|
if (process.platform === 'linux') {
|
||||||
|
import('./linux');
|
||||||
|
} else if (process.platform === 'darwin') {
|
||||||
|
import('./darwin');
|
||||||
|
} else if (process.platform === 'win32') {
|
||||||
|
import('./win32');
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { SetActivity } from '@xhayper/discord-rpc';
|
import type { SetActivity } from '@xhayper/discord-rpc';
|
||||||
|
|
||||||
import { ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
|
|
||||||
const initialize = (clientId: string) => {
|
const initialize = (clientId: string) => {
|
||||||
|
|||||||
@@ -22,12 +22,7 @@ import { WebAudio } from '/@/shared/types/types';
|
|||||||
import '/@/shared/styles/global.css';
|
import '/@/shared/styles/global.css';
|
||||||
import { PlayerProvider } from '/@/renderer/features/player/context/player-context';
|
import { PlayerProvider } from '/@/renderer/features/player/context/player-context';
|
||||||
import { AudioPlayers } from '/@/renderer/features/player/components/audio-players';
|
import { AudioPlayers } from '/@/renderer/features/player/components/audio-players';
|
||||||
|
import { ReleaseNotesModal } from '/@/renderer/release-notes-modal';
|
||||||
const ReleaseNotesModal = lazy(() =>
|
|
||||||
import('./release-notes-modal').then((module) => ({
|
|
||||||
default: module.ReleaseNotesModal,
|
|
||||||
})),
|
|
||||||
);
|
|
||||||
|
|
||||||
const UpdateAvailableDialog = lazy(() =>
|
const UpdateAvailableDialog = lazy(() =>
|
||||||
import('./update-available-dialog').then((module) => ({
|
import('./update-available-dialog').then((module) => ({
|
||||||
@@ -82,8 +77,8 @@ const AppShell = memo(function AppShell() {
|
|||||||
<AppRouter />
|
<AppRouter />
|
||||||
</PlayerProvider>
|
</PlayerProvider>
|
||||||
</WebAudioContext.Provider>
|
</WebAudioContext.Provider>
|
||||||
|
<ReleaseNotesModal />
|
||||||
<Suspense fallback={null}>
|
<Suspense fallback={null}>
|
||||||
<ReleaseNotesModal />
|
|
||||||
<UpdateAvailableDialog />
|
<UpdateAvailableDialog />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { SetActivity, StatusDisplayType } from '@xhayper/discord-rpc';
|
import type { SetActivity } from '@xhayper/discord-rpc';
|
||||||
|
|
||||||
import isElectron from 'is-electron';
|
import isElectron from 'is-electron';
|
||||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
@@ -27,6 +28,13 @@ import { LibraryItem, QueueSong, ServerType } from '/@/shared/types/domain-types
|
|||||||
import { PlayerStatus } from '/@/shared/types/types';
|
import { PlayerStatus } from '/@/shared/types/types';
|
||||||
|
|
||||||
const discordRpc = isElectron() ? window.api.discordRpc : null;
|
const discordRpc = isElectron() ? window.api.discordRpc : null;
|
||||||
|
|
||||||
|
const DiscordStatusDisplayType = {
|
||||||
|
DETAILS: 2,
|
||||||
|
NAME: 0,
|
||||||
|
STATE: 1,
|
||||||
|
} as const;
|
||||||
|
|
||||||
type ActivityState = [QueueSong | undefined, number, PlayerStatus];
|
type ActivityState = [QueueSong | undefined, number, PlayerStatus];
|
||||||
|
|
||||||
const MAX_FIELD_LENGTH = 127;
|
const MAX_FIELD_LENGTH = 127;
|
||||||
@@ -122,7 +130,7 @@ export const useDiscordRpc = () => {
|
|||||||
: undefined
|
: undefined
|
||||||
: sentenceCase(current[2]),
|
: sentenceCase(current[2]),
|
||||||
state: truncate(artist),
|
state: truncate(artist),
|
||||||
statusDisplayType: StatusDisplayType.STATE,
|
statusDisplayType: DiscordStatusDisplayType.STATE,
|
||||||
type: discordSettings.showAsListening ? 2 : 0,
|
type: discordSettings.showAsListening ? 2 : 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -196,9 +204,9 @@ export const useDiscordRpc = () => {
|
|||||||
const artists = song?.artists.map((artist) => artist.name).join(', ');
|
const artists = song?.artists.map((artist) => artist.name).join(', ');
|
||||||
|
|
||||||
const statusDisplayMap = {
|
const statusDisplayMap = {
|
||||||
[DiscordDisplayType.ARTIST_NAME]: StatusDisplayType.STATE,
|
[DiscordDisplayType.ARTIST_NAME]: DiscordStatusDisplayType.STATE,
|
||||||
[DiscordDisplayType.FEISHIN]: StatusDisplayType.NAME,
|
[DiscordDisplayType.FEISHIN]: DiscordStatusDisplayType.NAME,
|
||||||
[DiscordDisplayType.SONG_NAME]: StatusDisplayType.DETAILS,
|
[DiscordDisplayType.SONG_NAME]: DiscordStatusDisplayType.DETAILS,
|
||||||
};
|
};
|
||||||
|
|
||||||
const activity: SetActivity = {
|
const activity: SetActivity = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { AnimatePresence } from 'motion/react';
|
import { AnimatePresence } from 'motion/react';
|
||||||
import { lazy, Suspense } from 'react';
|
import { Suspense } from 'react';
|
||||||
import { Outlet } from 'react-router';
|
import { Outlet } from 'react-router';
|
||||||
|
|
||||||
import styles from './mobile-layout.module.css';
|
import styles from './mobile-layout.module.css';
|
||||||
@@ -10,6 +10,7 @@ import { FullScreenVisualizer } from '/@/renderer/features/player/components/ful
|
|||||||
import { MobileFullscreenPlayer } from '/@/renderer/features/player/components/mobile-fullscreen-player';
|
import { MobileFullscreenPlayer } from '/@/renderer/features/player/components/mobile-fullscreen-player';
|
||||||
import { MobileSidebar } from '/@/renderer/features/sidebar/components/mobile-sidebar';
|
import { MobileSidebar } from '/@/renderer/features/sidebar/components/mobile-sidebar';
|
||||||
import { PlayerBar } from '/@/renderer/layouts/default-layout/player-bar';
|
import { PlayerBar } from '/@/renderer/layouts/default-layout/player-bar';
|
||||||
|
import { WindowBar } from '/@/renderer/layouts/window-bar';
|
||||||
import { useFullScreenPlayerOverlayState, useWindowBarStyle } from '/@/renderer/store';
|
import { useFullScreenPlayerOverlayState, useWindowBarStyle } from '/@/renderer/store';
|
||||||
import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
|
import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
|
||||||
import { Drawer } from '/@/shared/components/drawer/drawer';
|
import { Drawer } from '/@/shared/components/drawer/drawer';
|
||||||
@@ -17,12 +18,6 @@ import { Spinner } from '/@/shared/components/spinner/spinner';
|
|||||||
import { useDisclosure } from '/@/shared/hooks/use-disclosure';
|
import { useDisclosure } from '/@/shared/hooks/use-disclosure';
|
||||||
import { Platform } from '/@/shared/types/types';
|
import { Platform } from '/@/shared/types/types';
|
||||||
|
|
||||||
const WindowBar = lazy(() =>
|
|
||||||
import('/@/renderer/layouts/window-bar').then((module) => ({
|
|
||||||
default: module.WindowBar,
|
|
||||||
})),
|
|
||||||
);
|
|
||||||
|
|
||||||
interface MobileLayoutProps {
|
interface MobileLayoutProps {
|
||||||
shell?: boolean;
|
shell?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { lazy, Suspense } from 'react';
|
import { lazy, Suspense } from 'react';
|
||||||
import { HashRouter, Route, Routes } from 'react-router';
|
import { HashRouter, Route, Routes } from 'react-router';
|
||||||
|
|
||||||
|
import { ShuffleAllContextModal } from '/@/renderer/features/player/components/shuffle-all-modal';
|
||||||
import { RouterErrorBoundary } from '/@/renderer/features/shared/components/router-error-boundary';
|
import { RouterErrorBoundary } from '/@/renderer/features/shared/components/router-error-boundary';
|
||||||
import { AuthenticationOutlet } from '/@/renderer/layouts/authentication-outlet';
|
import { AuthenticationOutlet } from '/@/renderer/layouts/authentication-outlet';
|
||||||
import { ResponsiveLayout } from '/@/renderer/layouts/responsive-layout';
|
import { ResponsiveLayout } from '/@/renderer/layouts/responsive-layout';
|
||||||
@@ -96,18 +97,6 @@ const LyricsSettingsContextModal = (props: any) => (
|
|||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
|
|
||||||
const LazyShuffleAllContextModal = lazy(() =>
|
|
||||||
import('/@/renderer/features/player/components/shuffle-all-modal').then((module) => ({
|
|
||||||
default: module.ShuffleAllContextModal,
|
|
||||||
})),
|
|
||||||
);
|
|
||||||
|
|
||||||
const ShuffleAllContextModal = (props: any) => (
|
|
||||||
<Suspense fallback={<Spinner container />}>
|
|
||||||
<LazyShuffleAllContextModal {...props} />
|
|
||||||
</Suspense>
|
|
||||||
);
|
|
||||||
|
|
||||||
const LazyAddToPlaylistContextModal = lazy(() =>
|
const LazyAddToPlaylistContextModal = lazy(() =>
|
||||||
import('/@/renderer/features/playlists/components/add-to-playlist-context-modal').then(
|
import('/@/renderer/features/playlists/components/add-to-playlist-context-modal').then(
|
||||||
(module) => ({
|
(module) => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user