[READ-ONLY] Mirror of https://github.com/probablykasper/ferrum. Music library app for Mac, Linux and Windows ferrum.kasper.space
electron linux macos music music-library music-player napi windows
0

Configure Feed

Select the types of activity you want to include in your feed.

Improve setup, revert to TypeScript 4

svelte-check doesn't support ts5 yet

Kasper (Apr 2, 2023, 8:32 PM +0200) 605894b4 e3cd24c8

+43 -90
+2 -7
.eslintrc.cjs
··· 5 5 plugins: ['svelte3', '@typescript-eslint'], 6 6 overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }], 7 7 settings: { 8 - 'svelte3/typescript': true, 9 - 'svelte3/ignore-styles': (attributes) => { 10 - // https://github.com/sveltejs/eslint-plugin-svelte3/issues/10 11 - return attributes && attributes.lang && attributes.lang !== 'css' 12 - }, 13 - 'svelte3/ignore-warnings': () => true, // svelte-check used instead 8 + 'svelte3/typescript': () => require('typescript'), 14 9 }, 15 10 parserOptions: { 16 11 sourceType: 'module', 17 - ecmaVersion: 2019, 12 + ecmaVersion: 2020, 18 13 }, 19 14 env: { 20 15 browser: true,
-6
.vscode/settings.json
··· 1 - { 2 - "svelte.plugin.svelte.compilerWarnings": { 3 - "a11y-click-events-have-key-events": "ignore", 4 - "a11y-no-noninteractive-tabindex": "ignore" 5 - } 6 - }
-2
index.html
··· 5 5 <meta name="viewport" content="width=device-width, initial-scale=1" /> 6 6 7 7 <link href="./src/assets/fonts.css" rel="stylesheet" /> 8 - 9 - <link rel="icon" type="image/png" href="/favicon.png" /> 10 8 </head> 11 9 <body> 12 10 <script defer type="module" src="./src/main.ts"></script>
+21 -42
package-lock.json
··· 10 10 "devDependencies": { 11 11 "@napi-rs/cli": "^2.15.2", 12 12 "@sveltejs/vite-plugin-svelte": "^2.0.4", 13 - "@types/wicg-mediasession": "^1.1.4", 13 + "@tsconfig/svelte": "^3.0.0", 14 14 "@typescript-eslint/eslint-plugin": "^5.57.0", 15 15 "@typescript-eslint/parser": "^5.57.0", 16 16 "concurrently": "^8.0.1", ··· 26 26 "svelte": "^3.58.0", 27 27 "svelte-check": "^3.1.4", 28 28 "svelte-preprocess": "^5.0.3", 29 - "typescript": "^5.0.3", 29 + "typescript": "^4.9.5", 30 30 "vite": "^4.2.1", 31 31 "vite-plugin-electron": "^0.11.1", 32 32 "vite-plugin-externals": "^0.6.2" ··· 778 778 "node": ">= 10" 779 779 } 780 780 }, 781 + "node_modules/@tsconfig/svelte": { 782 + "version": "3.0.0", 783 + "resolved": "https://registry.npmjs.org/@tsconfig/svelte/-/svelte-3.0.0.tgz", 784 + "integrity": "sha512-pYrtLtOwku/7r1i9AMONsJMVYAtk3hzOfiGNekhtq5tYBGA7unMve8RvUclKLMT3PrihvJqUmzsRGh0RP84hKg==", 785 + "dev": true 786 + }, 781 787 "node_modules/@types/debug": { 782 788 "version": "4.1.7", 783 789 "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz", ··· 861 867 "integrity": "sha512-NNm+gdePAX1VGvPcGZCDKQZKYSiAWigKhKaz5KF94hG6f2s8de9Ow5+7AbXoeKxL8gavZfk4UquSAygOF2duEQ==", 862 868 "dev": true, 863 869 "optional": true 864 - }, 865 - "node_modules/@types/wicg-mediasession": { 866 - "version": "1.1.4", 867 - "resolved": "https://registry.npmjs.org/@types/wicg-mediasession/-/wicg-mediasession-1.1.4.tgz", 868 - "integrity": "sha512-x6qWKaAoae/yjKThSsFeZ4SP6036zLrYUOx3Mg1BrbUR38FiKQetWO8owq261XXkdsLg52PyQ2/BZ8Wy038woQ==", 869 - "dev": true 870 870 }, 871 871 "node_modules/@types/yargs": { 872 872 "version": "17.0.24", ··· 4773 4773 "svelte": "^3.55.0" 4774 4774 } 4775 4775 }, 4776 - "node_modules/svelte-check/node_modules/typescript": { 4777 - "version": "4.9.5", 4778 - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", 4779 - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", 4780 - "dev": true, 4781 - "bin": { 4782 - "tsc": "bin/tsc", 4783 - "tsserver": "bin/tsserver" 4784 - }, 4785 - "engines": { 4786 - "node": ">=4.2.0" 4787 - } 4788 - }, 4789 4776 "node_modules/svelte-hmr": { 4790 4777 "version": "0.15.1", 4791 4778 "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.15.1.tgz", ··· 5080 5067 "dev": true 5081 5068 }, 5082 5069 "node_modules/typescript": { 5083 - "version": "5.0.3", 5084 - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.3.tgz", 5085 - "integrity": "sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA==", 5070 + "version": "4.9.5", 5071 + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", 5072 + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", 5086 5073 "dev": true, 5087 5074 "bin": { 5088 5075 "tsc": "bin/tsc", 5089 5076 "tsserver": "bin/tsserver" 5090 5077 }, 5091 5078 "engines": { 5092 - "node": ">=12.20" 5079 + "node": ">=4.2.0" 5093 5080 } 5094 5081 }, 5095 5082 "node_modules/universalify": { ··· 5844 5831 "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", 5845 5832 "dev": true 5846 5833 }, 5834 + "@tsconfig/svelte": { 5835 + "version": "3.0.0", 5836 + "resolved": "https://registry.npmjs.org/@tsconfig/svelte/-/svelte-3.0.0.tgz", 5837 + "integrity": "sha512-pYrtLtOwku/7r1i9AMONsJMVYAtk3hzOfiGNekhtq5tYBGA7unMve8RvUclKLMT3PrihvJqUmzsRGh0RP84hKg==", 5838 + "dev": true 5839 + }, 5847 5840 "@types/debug": { 5848 5841 "version": "4.1.7", 5849 5842 "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz", ··· 5927 5920 "integrity": "sha512-NNm+gdePAX1VGvPcGZCDKQZKYSiAWigKhKaz5KF94hG6f2s8de9Ow5+7AbXoeKxL8gavZfk4UquSAygOF2duEQ==", 5928 5921 "dev": true, 5929 5922 "optional": true 5930 - }, 5931 - "@types/wicg-mediasession": { 5932 - "version": "1.1.4", 5933 - "resolved": "https://registry.npmjs.org/@types/wicg-mediasession/-/wicg-mediasession-1.1.4.tgz", 5934 - "integrity": "sha512-x6qWKaAoae/yjKThSsFeZ4SP6036zLrYUOx3Mg1BrbUR38FiKQetWO8owq261XXkdsLg52PyQ2/BZ8Wy038woQ==", 5935 - "dev": true 5936 5923 }, 5937 5924 "@types/yargs": { 5938 5925 "version": "17.0.24", ··· 8836 8823 "sade": "^1.7.4", 8837 8824 "svelte-preprocess": "^5.0.0", 8838 8825 "typescript": "^4.9.4" 8839 - }, 8840 - "dependencies": { 8841 - "typescript": { 8842 - "version": "4.9.5", 8843 - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", 8844 - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", 8845 - "dev": true 8846 - } 8847 8826 } 8848 8827 }, 8849 8828 "svelte-hmr": { ··· 9044 9023 "dev": true 9045 9024 }, 9046 9025 "typescript": { 9047 - "version": "5.0.3", 9048 - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.3.tgz", 9049 - "integrity": "sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA==", 9026 + "version": "4.9.5", 9027 + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", 9028 + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", 9050 9029 "dev": true 9051 9030 }, 9052 9031 "universalify": {
+3 -3
package.json
··· 14 14 "build": "npm run napi && npm run build:web && electron-builder", 15 15 "build:web": "vite build", 16 16 "electron-builder": "electron-builder", 17 - "lint": "prettier --check --plugin-search-dir=. src && svelte-check && eslint src", 17 + "lint": "prettier --check --plugin-search-dir=. src && svelte-check --tsconfig ./tsconfig.json && eslint src", 18 18 "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", 19 19 "check": "npm run lint && cargo check" 20 20 }, ··· 64 64 "devDependencies": { 65 65 "@napi-rs/cli": "^2.15.2", 66 66 "@sveltejs/vite-plugin-svelte": "^2.0.4", 67 - "@types/wicg-mediasession": "^1.1.4", 67 + "@tsconfig/svelte": "^3.0.0", 68 68 "@typescript-eslint/eslint-plugin": "^5.57.0", 69 69 "@typescript-eslint/parser": "^5.57.0", 70 70 "concurrently": "^8.0.1", ··· 80 80 "svelte": "^3.58.0", 81 81 "svelte-check": "^3.1.4", 82 82 "svelte-preprocess": "^5.0.3", 83 - "typescript": "^5.0.3", 83 + "typescript": "^4.9.5", 84 84 "vite": "^4.2.1", 85 85 "vite-plugin-electron": "^0.11.1", 86 86 "vite-plugin-externals": "^0.6.2"
+2 -2
src/App.svelte
··· 5 5 import Player from './components/Player.svelte' 6 6 import Sidebar from './components/Sidebar.svelte' 7 7 import Queue from './components/Queue.svelte' 8 - import TrackInfo, { TrackInfoList } from './components/TrackInfo.svelte' 8 + import TrackInfo, { type TrackInfoList } from './components/TrackInfo.svelte' 9 9 import PlaylistInfoModal from './components/PlaylistInfo.svelte' 10 10 import { queueVisible } from './lib/queue' 11 11 import { ipcListen, ipcRenderer } from '@/lib/window' 12 - import { isMac, importTracks, PlaylistInfo, methods } from './lib/data' 12 + import { isMac, importTracks, type PlaylistInfo, methods } from './lib/data' 13 13 import { playPause } from './lib/player' 14 14 import DragGhost from './components/DragGhost.svelte' 15 15 import ItunesImport from './components/ItunesImport.svelte'
+1 -1
src/components/PlaylistInfo.svelte
··· 1 1 <script lang="ts"> 2 2 import { checkShortcut } from '../lib/helpers' 3 - import { newPlaylist, PlaylistInfo, updatePlaylist } from '../lib/data' 3 + import { newPlaylist, type PlaylistInfo, updatePlaylist } from '../lib/data' 4 4 import Modal from './Modal.svelte' 5 5 import Button from './Button.svelte' 6 6
+1 -1
src/components/Queue.svelte
··· 7 7 moveIndexes, 8 8 prependToUserQueue, 9 9 queue, 10 - Queue, 10 + type Queue, 11 11 } from '../lib/queue' 12 12 import { page, paths } from '../lib/data' 13 13 import { onDestroy } from 'svelte'
+5 -1
src/components/Sidebar.svelte
··· 1 1 <script lang="ts"> 2 - import SidebarItems, { hideFolder, showFolder, SidebarItemHandle } from './SidebarItems.svelte' 2 + import SidebarItems, { 3 + hideFolder, 4 + showFolder, 5 + type SidebarItemHandle, 6 + } from './SidebarItems.svelte' 3 7 import Filter from './Filter.svelte' 4 8 import { isMac, trackListsDetailsMap, page, movePlaylist } from '../lib/data' 5 9 import { ipcRenderer } from '../lib/window'
+1 -1
src/components/SidebarItems.svelte
··· 30 30 31 31 <script lang="ts"> 32 32 import type { TrackListDetails } from 'ferrum-addon' 33 - import { Writable, writable } from 'svelte/store' 33 + import { type Writable, writable } from 'svelte/store' 34 34 import { createEventDispatcher, SvelteComponent } from 'svelte' 35 35 import { getContext } from 'svelte' 36 36 import { dragged } from '../lib/drag-drop'
+1 -1
src/electron/menubar.ts
··· 1 - import { App, BrowserWindow, Menu, shell } from 'electron' 1 + import { type App, BrowserWindow, Menu, shell } from 'electron' 2 2 import { ipcMain } from './typed_ipc' 3 3 import type { MenuItemConstructorOptions } from 'electron/common' 4 4 import is from './is'
+1 -1
src/lib/helpers.ts
··· 1 - import { Updater, Writable, writable } from 'svelte/store' 1 + import { type Updater, type Writable, writable } from 'svelte/store' 2 2 import type { TrackListDetails } from 'ferrum-addon' 3 3 4 4 export function getDuration(dur: number) {
+2 -17
tsconfig.json
··· 1 1 { 2 + "extends": "@tsconfig/svelte/tsconfig.json", 2 3 "compilerOptions": { 3 - "moduleResolution": "node", 4 4 "target": "ESNext", 5 5 "useDefineForClassFields": true, 6 6 "module": "ESNext", 7 - 8 - // svelte-preprocess can't tell if you're importing a value or 9 - // type, so require 'import type' instead of 'import' for types 10 - "importsNotUsedAsValues": "error", 11 - 12 - // To have svelte warnings/errors correct position 13 - "sourceMap": true, 14 - 15 - // Prevent type errors 16 - "types": ["svelte", "node", "wicg-mediasession"], 17 - 7 + "resolveJsonModule": true, 18 8 "isolatedModules": true, 19 - "resolveJsonModule": true, 20 - "strict": true, 21 - "esModuleInterop": true, 22 - "skipLibCheck": true, 23 - "forceConsistentCasingInFileNames": true, 24 9 "baseUrl": ".", 25 10 "paths": { 26 11 "@/*": ["src/*"]
+3 -5
vite.config.mjs
··· 1 1 import { resolve } from 'path' 2 2 import { viteExternalsPlugin } from 'vite-plugin-externals' 3 3 import { defineConfig } from 'vite' 4 - import { svelte } from '@sveltejs/vite-plugin-svelte' 5 - import sveltePreprocess from 'svelte-preprocess' // using vitePreprocess results in an error 4 + import { svelte, vitePreprocess } from '@sveltejs/vite-plugin-svelte' 6 5 import electron from 'vite-plugin-electron' 7 6 8 7 export default defineConfig({ ··· 16 15 build: { 17 16 outDir: './build/web', 18 17 emptyOutDir: true, 19 - minify: false, 20 18 sourcemap: true, 21 - target: ['chrome64', 'edge79', 'firefox62', 'safari11.1'], 19 + target: 'chrome93', 22 20 }, 23 21 plugins: [ 24 22 viteExternalsPlugin({ 25 23 'ferrum-addon': 'ferrum-addon', 26 24 }), 27 25 svelte({ 28 - preprocess: sveltePreprocess(), 26 + preprocess: vitePreprocess(), 29 27 }), 30 28 electron({ 31 29 entry: ['./src/electron/main.ts', './src/electron/preload.ts'],