Skip to content

Commit

Permalink
Cleaned up deps, added the dep viewer, updated js dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Frei committed Jun 25, 2024
1 parent a4e73a3 commit 1520776
Show file tree
Hide file tree
Showing 22 changed files with 2,368 additions and 1,438 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ dist-electron
shared/build
modules/*/lib
.nx
*-deps.svg
434 changes: 217 additions & 217 deletions .yarn/releases/yarn-4.3.0.cjs → .yarn/releases/yarn-4.3.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ enableGlobalCache: true

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.3.0.cjs
yarnPath: .yarn/releases/yarn-4.3.1.cjs
2 changes: 1 addition & 1 deletion electron/AudioDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Sleep } from '@freik/sync';
import { SafelyUnpickle, isArrayOfString } from '@freik/typechk';
import { statSync } from 'fs';
import path from 'path';
import { SendToUI } from './Communication';
import { SendToUI } from './SendToUI';

const { log, wrn } = MakeLog('EMP:main:AudioDatabase');
// log.enabled = true;
Expand Down
11 changes: 1 addition & 10 deletions electron/Communication.ts → electron/CommsSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import {
RestoreWindow,
} from './window';

const { wrn, log } = MakeLog('EMP:main:Communication');
const { wrn } = MakeLog('EMP:main:Communication');

/**
* Show a file in the shell
Expand Down Expand Up @@ -191,12 +191,3 @@ export function CommsSetup(): void {
isIgnoreItemFn,
);
}

// This is for one-way comms to the UI process
export function SendToUI<T>(name: IpcId, data: T) {
const obj: { [key: string]: T } = {};
obj[name] = data;
log(`Sending ${name} with data:`);
log(data);
Comms.AsyncSend(obj);
}
48 changes: 48 additions & 0 deletions electron/RegisterProtocols.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Comms, Persistence } from '@freik/electron-main';
import { MakeLog } from '@freik/logger';
import { protocol } from 'electron';
import { UpdateAudioLocations } from './AudioDatabase';
import { PictureHandler } from './cover-art';
import { tuneNewProtocolHandler, tuneProtocolHandler } from './protocols';

const { log } = MakeLog('EMP:main:RegisterProtocols');

export function RegisterPrivileges(): void {
protocol.registerSchemesAsPrivileged([
{
scheme: 'tune',
privileges: {
// secure: true,
standard: true,
supportFetchAPI: true, // Add this if you want to use fetch with this protocol.
stream: true, // Add this if you intend to use the protocol for streaming i.e. in video/audio html tags.
// corsEnabled: true, // Add this if you need to enable cors for this protocol.
// bypassCSP: false
},
},
]);
}
// This sets up all protocol handlers

export function RegisterProtocols(): void {
// TODO: Enable both song & album pictures
// folder-level photos are fine, but for song requests, check the song
// then fall back to the album
log('Registering pic://key/ protocol');
protocol.handle('pic', PictureHandler);
log('Registering tune://song/ protocol');
protocol.handle('tune', tuneNewProtocolHandler);
Comms.registerOldProtocolHandler(
'trune://song/',

protocol.registerFileProtocol,
tuneProtocolHandler,
);
log('Finished protocol registration');
}
// This sets up reactive responses to changes, for example:
// locations change, so music needs to be rescanned

export function RegisterListeners(): void {
Persistence.subscribe('locations', UpdateAudioLocations);
}
15 changes: 15 additions & 0 deletions electron/SendToUI.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Comms } from '@freik/electron-main';
import { IpcId } from '@freik/emp-shared';
import { MakeLog } from '@freik/logger';

const { log } = MakeLog('EMP:main:SendToUI');

// This is for one-way comms to the UI process

export function SendToUI<T>(name: IpcId, data: T) {
const obj: { [key: string]: T } = {};
obj[name] = data;
log(`Sending ${name} with data:`);
log(data);
Comms.AsyncSend(obj);
}
4 changes: 2 additions & 2 deletions electron/Startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { MakeLog } from '@freik/logger';
import { isString } from '@freik/typechk';
import { app } from 'electron';
import { UpdateLocations } from './AudioDatabase';
import { CommsSetup } from './Communication';
import { CommsSetup } from './CommsSetup';
import {
RegisterListeners,
RegisterPrivileges,
RegisterProtocols,
} from './protocols';
} from './RegisterProtocols';

const { wrn } = MakeLog('EMP:main:Startup');

Expand Down
2 changes: 1 addition & 1 deletion electron/Transcoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import os from 'node:os';
import path from 'node:path';
import { rimraf } from 'rimraf';
import { GetAudioDB } from './AudioDatabase';
import { SendToUI } from './Communication';
import { SendToUI } from './SendToUI';
import { LoadPlaylist } from './playlists';

const { log, wrn } = MakeLog('EMP:main:Transcoding');
Expand Down
3 changes: 1 addition & 2 deletions electron/electronSetup.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { MakeLog } from '@freik/logger';
import { app } from 'electron';
import { MakeMainMenu } from './menu';
import { OnWindowCreated } from './types';
import { CreateWindow, HasWindow } from './window';

const { wrn } = MakeLog('EMP:main:electronSetup');

app.commandLine.appendSwitch('disable-http-cache');

export type OnWindowCreated = () => Promise<void>;

/*
function registerGlobalShortcuts() {
Expand Down
2 changes: 1 addition & 1 deletion electron/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from 'electron';
import { KeyboardEvent } from 'electron/main';
import { ShowAbout } from './About.js';
import { SendToUI } from './Communication.js';
import { SendToUI } from './SendToUI.js';
import { ToggleMiniPlayer } from './window.js';

// const { wrn } = MakeLog('EMP:main:menu');
Expand Down
50 changes: 4 additions & 46 deletions electron/protocols.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { SongWithPath } from '@freik/audiodb';
import { Comms, Persistence } from '@freik/electron-main';
import { MakeLog } from '@freik/logger';
import { SongKey } from '@freik/media-core';
import { asString, hasStrField } from '@freik/typechk';
import { ProtocolRequest, ProtocolResponse, protocol } from 'electron';
import { ProtocolRequest, ProtocolResponse } from 'electron';
import fs from 'fs';
import path from 'path';
import { GetAudioDB, UpdateAudioLocations } from './AudioDatabase';
import { PictureHandler } from './cover-art';
import { GetAudioDB } from './AudioDatabase';

const fsp = fs.promises;

Expand Down Expand Up @@ -118,7 +116,7 @@ async function getRealFile(
return { extension, thePath };
}

async function tuneProtocolHandler(
export async function tuneProtocolHandler(
_: ProtocolRequest,
trimmedUrl: string,
): Promise<FileResponse> {
Expand All @@ -137,7 +135,7 @@ async function tuneProtocolHandler(
}
}

async function tuneNewProtocolHandler(req: Request): Promise<Response> {
export async function tuneNewProtocolHandler(req: Request): Promise<Response> {
const { pathname } = new URL(req.url);
const key: SongKey = pathname.substring(1);
log(`SongKey: ${key}`);
Expand Down Expand Up @@ -176,43 +174,3 @@ async function tuneNewProtocolHandler(req: Request): Promise<Response> {
log('Song not found');
return e404;
}

export function RegisterPrivileges(): void {
protocol.registerSchemesAsPrivileged([
{
scheme: 'tune',
privileges: {
// secure: true,
standard: true,
supportFetchAPI: true, // Add this if you want to use fetch with this protocol.
stream: true, // Add this if you intend to use the protocol for streaming i.e. in video/audio html tags.
// corsEnabled: true, // Add this if you need to enable cors for this protocol.
// bypassCSP: false
},
},
]);
}

// This sets up all protocol handlers
export function RegisterProtocols(): void {
// TODO: Enable both song & album pictures
// folder-level photos are fine, but for song requests, check the song
// then fall back to the album
log('Registering pic://key/ protocol');
protocol.handle('pic', PictureHandler);
log('Registering tune://song/ protocol');
protocol.handle('tune', tuneNewProtocolHandler);
Comms.registerOldProtocolHandler(
'trune://song/',

protocol.registerFileProtocol,
tuneProtocolHandler,
);
log('Finished protocol registration');
}

// This sets up reactive responses to changes, for example:
// locations change, so music needs to be rescanned
export function RegisterListeners(): void {
Persistence.subscribe('locations', UpdateAudioLocations);
}
1 change: 1 addition & 0 deletions electron/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type OnWindowCreated = () => Promise<void>;
2 changes: 1 addition & 1 deletion electron/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from 'electron';
import * as path from 'path';
import process from 'process';
import { OnWindowCreated } from './electronSetup';
import { OnWindowCreated } from './types';

const { wrn } = MakeLog('EMP:main:window');

Expand Down
10 changes: 5 additions & 5 deletions modules/audiofileindex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@
"@types/jest": "^29.5.12",
"@types/rmfr": "^2.0.5",
"@types/xxhashjs": "^0.2.4",
"@typescript-eslint/eslint-plugin": "^7.13.0",
"@typescript-eslint/parser": "^7.13.0",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"eslint": "^9.5.0",
"eslint-config-prettier": "^9.1.0",
"jest": "^29.7.0",
"prettier": "^3.3.2",
"rimraf": "^5.0.7",
"rmfr": "^2.0.0",
"ts-jest": "^29.1.5",
"typedoc": "^0.25.13",
"typedoc-plugin-markdown": "^4.0.3",
"typescript": "^5.4.5"
"typedoc": "^0.26.2",
"typedoc-plugin-markdown": "^4.1.0",
"typescript": "^5.5.2"
},
"files": [
"lib/**/*"
Expand Down
12 changes: 6 additions & 6 deletions modules/emain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
"@freik/node-utils": "^1.6.3",
"@types/debug": "^4.1.12",
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.13.0",
"@typescript-eslint/parser": "^7.13.0",
"electron": "^31.0.1",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"electron": "^31.0.2",
"eslint": "^9.5.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
Expand All @@ -51,9 +51,9 @@
"prettier": "^3.3.2",
"rimraf": "^5.0.7",
"ts-jest": "^29.1.5",
"typedoc": "^0.25.13",
"typedoc-plugin-markdown": "^4.0.3",
"typescript": "^5.4.5"
"typedoc": "^0.26.2",
"typedoc-plugin-markdown": "^4.1.0",
"typescript": "^5.5.2"
},
"files": [
"lib/**/*"
Expand Down
8 changes: 4 additions & 4 deletions modules/epreload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
"@freik/electron-render": "^0.1.0",
"@types/debug": "^4.1.12",
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.13.0",
"@typescript-eslint/parser": "^7.13.0",
"electron": "^31.0.1",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"electron": "^31.0.2",
"eslint": "^9.5.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
Expand All @@ -47,7 +47,7 @@
"prettier": "^3.3.2",
"rimraf": "^5.0.7",
"ts-jest": "^29.1.5",
"typescript": "^5.4.5"
"typescript": "^5.5.2"
},
"files": ["lib/**/*"],
"dependencies": {
Expand Down
18 changes: 9 additions & 9 deletions modules/erenderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@freik/seqnum": "^1.1.10",
"@freik/typechk": "^0.5.11",
"@freik/web-utils": "^0.5.2",
"electron": "^31.0.1"
"electron": "^31.0.2"
},
"peerDependencies": {
"react": ">=17.0.2",
Expand All @@ -50,15 +50,15 @@
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/react-test-renderer": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.13.0",
"@typescript-eslint/parser": "^7.13.0",
"electron": "^31.0.1",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"electron": "^31.0.2",
"eslint": "^9.5.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.2",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react-hooks": "^4.6.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
Expand All @@ -70,9 +70,9 @@
"recoil": "^0.7.7",
"rimraf": "^5.0.7",
"ts-jest": "^29.1.5",
"typedoc": "^0.25.13",
"typedoc-plugin-markdown": "^4.0.3",
"typescript": "^5.4.5"
"typedoc": "^0.26.2",
"typedoc-plugin-markdown": "^4.1.0",
"typescript": "^5.5.2"
},
"files": ["lib/**/*"],
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion modules/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"devDependencies": {
"rimraf": "^5.0.7",
"typescript": "^5.4.5"
"typescript": "^5.5.2"
},
"files": [
"./lib/**/*"
Expand Down
Loading

0 comments on commit 1520776

Please sign in to comment.