Rename @reviq/utils to @reviq/server-utils and add package READMEs

- Rename packages/utils/ to packages/server-utils/
- Update all imports and package.json references
- Add READMEs for frontend-utils, server-utils, and common packages
- Update main README with new package structure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
igm
2026-01-12 13:57:28 +08:00
parent 94b6de5970
commit 26d10d452f
19 changed files with 73 additions and 26 deletions

View File

@@ -1,6 +1,8 @@
# @reviq/common
Shared utilities for all RevIQ applications. This package contains environment-agnostic code that works in browsers, Node.js, Bun, and other JavaScript runtimes.
Shared utilities for frontend and backend. This package contains environment-agnostic code that works in browsers, Node.js, Bun, and Cloudflare Workers.
Use this package for utilities that need to work in both the publisher dashboard and the API server.
## Installation

View File

@@ -19,7 +19,7 @@
"dependencies": {
"@noble/hashes": "^2.0.1",
"@reviq/db-schema": "workspace:*",
"@reviq/utils": "workspace:*",
"@reviq/server-utils": "workspace:*",
"@scure/base": "^2.0.0",
"kysely": "^0.28.9",
"pg": "^8.13.1"

View File

@@ -7,7 +7,7 @@
import type { Database } from "@reviq/db-schema";
import type { Kysely, Transaction } from "kysely";
import { hashPassword } from "@reviq/utils";
import { hashPassword } from "@reviq/server-utils";
import { generateToken, hashToken } from "./token.js";
/**

View File

@@ -0,0 +1,15 @@
# @reviq/frontend-utils
Frontend-specific utilities for the RevIQ publisher dashboard.
## Usage
```typescript
import { getOrgColor, getOrgInitials } from "@reviq/frontend-utils";
```
## Exports
- `getOrgInitials(org)` - Get display initials from an organization's slug or display name
- `getOrgColor(org)` - Get a consistent HSL color based on the organization slug
- `OrgLike` - Type interface for organization objects

View File

@@ -0,0 +1,24 @@
# @reviq/server-utils
Server and CLI utilities for the RevIQ platform. These utilities use crypto APIs and are designed for Cloudflare Workers compatibility.
## Usage
```typescript
import {
generateSecureBase58Token,
hashPassword,
verifyPassword,
} from "@reviq/server-utils";
```
## Exports
### Token Generation
- `generateSecureBase58Token(prefix)` - Generate a secure random token with a prefix (e.g., `reviq_`)
- `parseBase58Token(token)` - Parse and validate a base58-encoded token
- `isBase58(str)` - Check if a string is valid base58
### Password Hashing
- `hashPassword(password)` - Hash a password using PBKDF2-SHA256
- `verifyPassword(password, hash)` - Verify a password against a stored hash

View File

@@ -1,5 +1,5 @@
{
"name": "@reviq/utils",
"name": "@reviq/server-utils",
"version": "0.0.1",
"type": "module",
"main": "./dist/index.js",