npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

scrobbler-for-discogs-libs

v1.0.0

Published

Shared business logic for Scrobbler for Discogs (web & mobile)

Readme

Scrobbler for Discogs - Shared Library

Shared business logic, utilities, and services for both web and mobile versions of Scrobbler for Discogs.

What's Included

✅ 100% Shared Code

  • Types (types.ts) - All TypeScript interfaces and types
  • Utilities:
    • queueUtils - Track preparation, timestamp calculation
    • collectionUtils - Metadata correction logic
    • collectionSyncUtils - Collection merging
    • formattingUtils - Artist name formatting
    • fuzzyUtils - Fuzzy search algorithms (Levenshtein distance)
    • sortCollection - Collection sorting with multiple options
    • credentialsUtils - Last.fm signature generation
  • Services:
    • appleMusic/* - Apple Music metadata fetching
    • musicbrainz/* - MusicBrainz metadata fetching

🔌 Platform Adapters (Interfaces Only)

The library defines interfaces that must be implemented by each platform:

  • CryptoAdapter - HMAC-SHA1 and MD5 hashing
  • StorageAdapter - Persistent storage (localStorage/AsyncStorage)

Usage

In Web App

import { queueUtils, fuzzySearch, CryptoAdapter } from 'scrobbler-for-discogs-libs';

// Provide web-specific crypto implementation
const webCrypto: CryptoAdapter = {
  hmacSha1Base64: (msg, key) => CryptoJS.HmacSHA1(msg, key).toString(CryptoJS.enc.Base64),
  md5: (msg) => CryptoJS.MD5(msg).toString(),
  rfc3986encode: (str) => /* ... */
};

In Mobile App

import { queueUtils, fuzzySearch, CryptoAdapter } from 'scrobbler-for-discogs-libs';
import CryptoJS from 'crypto-js';

// Provide React Native crypto implementation
const mobileCrypto: CryptoAdapter = {
  hmacSha1Base64: (msg, key) => CryptoJS.HmacSHA1(msg, key).toString(CryptoJS.enc.Base64),
  md5: async (msg) => await Crypto.digestStringAsync(Crypto.CryptoDigestAlgorithm.MD5, msg),
  rfc3986encode: (str) => /* ... */
};

Development

# Build the library
npm run build

# Watch for changes
npm run watch

Code Reusability

  • ~85% of business logic is shared
  • Platform adapters handle web vs mobile differences
  • Single source of truth for algorithms and utilities

Architecture Benefits

  1. Maintainability - Fix bugs in one place
  2. Consistency - Same logic on web and mobile
  3. Type Safety - Shared TypeScript types
  4. Testability - Test business logic once
  5. Bundle Optimization - Tree-shakeable exports

CI/CD

GitHub Actions

The library uses GitHub Actions for continuous integration:

  • Workflow: .github/workflows/build.yml
  • Triggers: Push/PR to main or develop branches
  • Node versions: Tests on Node 20.x and 22.x
  • Steps:
    1. Checkout code
    2. Install dependencies with npm ci
    3. Build library with npm run build
    4. Verify build artifacts (dist/index.js, dist/index.d.ts)
    5. Upload artifacts (Node 22.x only)

Status Badge

![Build Status](https://github.com/YOUR_USERNAME/scrobbler-for-discogs-libs/workflows/Build%20and%20Test/badge.svg)

Web and Mobile App CI

Both web and mobile app repositories have their own GitHub Actions workflows that:

  1. Check out the app repository
  2. Check out the shared library repository
  3. Build the shared library
  4. Install and link the library locally
  5. Build and test the app

This ensures that changes to the shared library don't break dependent applications.