@zhanjian/shared

v0.1.0

Published

Shared types and utilities for the Zhanjian ecosystem.

Readme

@zhanjian/shared

Shared types and utilities for the Zhanjian ecosystem (CLI, worker, web).

Exports

| Subpath | Contents | | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | | @zhanjian/shared | Re-exports from types, utils, privacy, cvs | | @zhanjian/shared/types | Domain types: Post, User, PostType, FeedQuery, CreatePostInput, ApiError, etc. | | @zhanjian/shared/cvs | CVS (Content Value Score): CVSInput, CVSResult, calculateCVS | | @zhanjian/shared/utils | Markdown: calculateEffectiveChars, extractCodeBlocks, calculateCodeRatio; templates: TEMPLATES, getTemplate, validateTemplate, generateSkeleton | | @zhanjian/shared/privacy | Privacy checks: scanContent, PrivacyIssue, PrivacyIssueType |

Usage

In another package (e.g. CLI or worker):

{
  "dependencies": {
    "@zhanjian/shared": "workspace:*"
  }
}
import { PostType, type Post } from "@zhanjian/shared";
import { calculateCVS } from "@zhanjian/shared/cvs";
import { scanContent } from "@zhanjian/shared/privacy";
import { calculateEffectiveChars } from "@zhanjian/shared/utils";

Development

From the monorepo root:

pnpm --filter @zhanjian/shared build
pnpm --filter @zhanjian/shared test

Repository

Part of zhan-cli. See root README for full project info.