nostr-dev-kit / ndk

Nostr Development Kit with outbox-model support
https://nostr-dev-kit.github.io/ndk/
MIT License
366 stars 99 forks source link

ndk-cache-redis not built when installed #254

Open arkin0x opened 3 months ago

arkin0x commented 3 months ago

Issue: ndk-cache-redis package not built after installation

Description

When adding ndk-cache-redis as a dependency, the package is not automatically built with a prepare script after installation. This prevents using the package in a project.

Steps to Reproduce

  1. Create a new Node.js project or use an existing one
  2. Run npm install @nostr-dev-kit/ndk-cache-redis
  3. Attempt to import and use the package in your code
import NDKRedisCacheAdapter from '@nostr-dev-kit/ndk-cache-redis'
Error: Cannot find module '@nostr-dev-kit/ndk-cache-redis' or its corresponding type declarations. ts(2307)

Expected Behavior

The package should be built and ready to use immediately after installation.

Actual Behavior

The package is installed but not built (no /dist folder), leading to errors when trying to use it.

When trying to run the build script manually for ndk-cache-redis, I got an error about the dependency "@nostr-dev-kit/eslint-config-custom": "0.0.0" which does not exist in the repo, NPM registry, nor in the nostr-dev-kit repository AFAIK.

Environment

Additional Context

Possible Solution

Create a proper build script, republish, and make sure the dependencies can resolve

hzrd149 commented 2 months ago

Just ran into this issue. It looks like the latest version of @nostr-dev-kit/ndk-cache-redis@2.1.17 is missing the dist folder

This could probably easily be solved by adding a "prepare": "pnpm build" to the package.json so it builds the package before its published. similar to what the core ndk package does https://github.com/nostr-dev-kit/ndk/blob/master/ndk/package.json#L42