Skip to content

Update dependencies and refactor validation logic#426

Draft
Sandakan wants to merge 32 commits intomasterfrom
release/4.0.0-alpha.3
Draft

Update dependencies and refactor validation logic#426
Sandakan wants to merge 32 commits intomasterfrom
release/4.0.0-alpha.3

Conversation

@Sandakan
Copy link
Owner

@Sandakan Sandakan commented Nov 24, 2025

This pull request introduces a variety of improvements and updates across the codebase, focusing on dependency upgrades, environment configuration, playlist management, and documentation. The most significant changes are grouped below by theme.

Dependency and Build System Updates:

  • Upgraded several dependencies in package.json, including drizzle-orm, electron-vite, material-symbols, and zod, and added new dependencies such as node-taglib-sharp and yoctocolors. [1] [2] [3] [4] [5]
  • Updated electron.vite.config.ts to remove the use of externalizeDepsPlugin and ensure compatibility with the new electron-vite version. [1] [2]

Environment and Configuration:

  • Added a comprehensive .env.example file with placeholders for all required environment variables, improving developer onboarding and configuration clarity.

Playlist Management Improvements:

  • Refactored playlist-related functions to consistently use number types for playlistId and songIds instead of string, enhancing type safety and reliability in functions like addSongsToPlaylist, addArtworkToAPlaylist, and blacklistSongs. [1] [2] [3] [4]
  • Introduced a new SpecialPlaylists enum in src/common/playlists.enum.ts to better handle special playlist IDs such as History and Favorites.

Documentation and Developer Experience:

  • Completely overhauled the README.md for improved clarity, structure, and user engagement, including new feature lists, gallery, feedback/contribution sections, and clearer build instructions. [1] [2]
  • Added a new logs script in package.json for easier log colorization and access.

Path and Import Fixes:

  • Fixed and standardized import paths for utility and update functions in playlist-related modules, ensuring correct module resolution and maintainability. [1] [2] [3]

These changes collectively improve the robustness, maintainability, and usability of the project.Upgrade zod and material-symbols dependencies. Refactor validation logic to directly utilize zod schemas across various routes, removing reliance on zod-adapter. This change streamlines validation processes and enhances code maintainability.

- Updated `zod` from version 3.25.76 to 4.1.13 in `package.json`.
- Updated `material-symbols` from version 0.39.1 to 0.40.0 in `package.json`.
- Refactored validation logic in various routes to directly use `zod` schemas instead of `zodValidator` from `@tanstack/zod-adapter`.
- Updated routes in `albums`, `artists`, `folders`, `genres`, `lyrics`, `playlists`, `queue`, and `search` to reflect the new validation approach.
@Sandakan Sandakan added this to the Nora v4.0.0 milestone Nov 24, 2025
Sandakan and others added 26 commits November 24, 2025 23:27
…tadata and update related imports

- Renamed `sendSongId3Tags` to `sendSongMetadata` across multiple files for clarity.
- Updated the function signature in `songs.ts` to reflect the new naming convention.
- Removed the old `sendSongId3Tags` implementation and replaced it with the new `sendSongMetadata` logic.
- Adjusted all relevant imports and usages to ensure consistency throughout the codebase.
- Introduced a new script `colorize-logs.ts` for colorizing and tailing NDJSON log files.
- The script supports various features including log level filtering, file selection, and pretty-printing of log data.
- Added a new npm command `logs` to execute the log viewer script with an optional environment log path.
- Implemented `testUtils.ts` to provide mock data and utility functions for testing song metadata, file stats, and database transactions.
- Created comprehensive tests in `tryToParseSong.test.ts` to cover various scenarios including duplicate prevention, success cases, retry logic, renderer messages, and edge cases.
- Mocked dependencies such as file system operations, database queries, and external libraries to isolate tests and ensure reliability.
- Enhanced test coverage for song parsing logic, ensuring robust handling of different paths and error scenarios.
…nres, and artists; enhance song metadata update process
- Updated function signatures and variable types in various modules to use number for songId instead of string.
- Adjusted related database queries and IPC handlers to accommodate the new type.
- Modified local storage migration to convert songId from string to number.
- Updated type definitions in app.d.ts to reflect changes in songId type.
- Ensured consistency in handling songId throughout the application, including in event data and song-related operations.
Updated the README to enhance clarity and structure, including a new introduction and improved feature descriptions.
…and queries

- Updated toggleSongIsFavorite to accept songId as a number.
- Modified updateQueueOnSongPlay to handle songId as a number and adjusted queue structure accordingly.
- Changed album, artist, genre, listen, playlist, and song queries to use number for songId and related identifiers.
- Adjusted route parameters in main-player routes to convert string params to numbers for songId, albumId, artistId, genreId, and playlistId.
- Updated local storage utility functions to handle number arrays instead of string arrays for ignored artists and songs.
- Refined metadata management functions to ensure consistent handling of artist and genre data.
- Adjusted types in app.d.ts to reflect changes in songId and related identifiers.
- Fixed various instances in the UI where songId was treated as a string instead of a number.
…s to use enums

- Changed import paths for conversion functions in multiple files to use '../utils/convert' instead of '../../common/convert'.
- Updated playlist IDs in the filesystem and related components to use the SpecialPlaylists enum for better maintainability.
- Adjusted types for song and album data structures to use numbers instead of strings where applicable.
- Modified API calls to handle data responses correctly in various components.
- Cleaned up unused parameters and improved code readability across several files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants