Skip to content

Commit f34f1b6

Browse files
committed
chore: v0.1.0 — CI/CD + npm publish setup
- Rename scope from @chainstream to @chainstream-io - Bump @chainstream-io/a2ui-catalog and @chainstream-io/a2ui-react to 0.1.0 - Add `files: ["dist"]` to both packages for clean npm publishes - Add GitHub Actions: ci.yml (build on PR/push) + publish.yml (npm publish on tag) - Update root build script to skip unfinished image-renderer - Add KlineChart, stories, hooks, shadcn UI primitives, and globals.css Made-with: Cursor
1 parent 100d10f commit f34f1b6

43 files changed

Lines changed: 8003 additions & 105 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: pnpm/action-setup@v4
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: '22'
20+
21+
- run: pnpm install --frozen-lockfile
22+
23+
- run: pnpm build

.github/workflows/publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- uses: pnpm/action-setup@v4
15+
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: '22'
19+
registry-url: 'https://registry.npmjs.org'
20+
21+
- run: pnpm install --frozen-lockfile
22+
23+
- run: pnpm build
24+
25+
- name: Publish catalog
26+
run: pnpm --filter @chainstream-io/a2ui-catalog publish --no-git-checks
27+
env:
28+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
29+
30+
- name: Publish react
31+
run: pnpm --filter @chainstream-io/a2ui-react publish --no-git-checks
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.storybook/main.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
11
import type { StorybookConfig } from '@storybook/react-vite';
2+
import { dirname, resolve } from 'node:path';
3+
import { fileURLToPath } from 'node:url';
4+
5+
const __dirname = dirname(fileURLToPath(import.meta.url));
26

37
const config: StorybookConfig = {
48
stories: ['../packages/react/src/**/*.stories.@(ts|tsx)'],
5-
addons: ['@storybook/addon-essentials'],
9+
addons: ['@storybook/addon-essentials', '@storybook/addon-interactions'],
610
framework: {
711
name: '@storybook/react-vite',
812
options: {},
913
},
14+
viteFinal: async (config) => {
15+
const tailwindcss = await import('@tailwindcss/vite');
16+
config.plugins = config.plugins || [];
17+
config.plugins.push(tailwindcss.default());
18+
19+
config.resolve = config.resolve || {};
20+
config.resolve.alias = {
21+
...config.resolve.alias,
22+
'@': resolve(__dirname, '../packages/react/src'),
23+
};
24+
25+
return config;
26+
},
1027
};
1128

1229
export default config;

.storybook/preview.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import type { Preview } from '@storybook/react';
2+
import '../packages/react/src/globals.css';
23

34
const preview: Preview = {
45
parameters: {
6+
backgrounds: {
7+
default: 'dark',
8+
values: [
9+
{ name: 'dark', value: '#0d1117' },
10+
{ name: 'light', value: '#ffffff' },
11+
],
12+
},
513
controls: {
614
matchers: {
715
color: /(background|color)$/i,

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# ChainStream A2UI Components
2+
3+
A2UI Crypto Catalog — 10 个交互式链上数据可视化组件。
4+
5+
## Packages
6+
7+
| Package | npm | Description |
8+
|---------|-----|-------------|
9+
| `@chainstream/a2ui-catalog` | Catalog schema | 组件 JSON Schema 定义 + 验证器 |
10+
| `@chainstream/a2ui-react` | React renderer | 10 个 React 组件 (TradingView Lightweight Charts) |
11+
| `@chainstream/a2ui-image-renderer` | Image fallback | Puppeteer 服务端渲染截图 |
12+
13+
## Components
14+
15+
| Component | Description |
16+
|-----------|-------------|
17+
| `KlineChart` | 专业级 K 线图 (OHLCV + 成交量 + 时间周期切换 + 实时更新) |
18+
| `PriceLineChart` | 价格走势折线图 |
19+
| `VolumeBarChart` | 交易量柱状图 |
20+
| `HolderPieChart` | 持仓分布饼图 (Top 10) |
21+
| `PnLWaterfall` | 盈亏瀑布图 |
22+
| `TokenCard` | 代币信息卡片 |
23+
| `TradeTable` | 实时交易明细表 |
24+
| `WalletDashboard` | 钱包总览面板 |
25+
| `AlertBadge` | 风险/信号告警标签 |
26+
| `SmartMoneyFlow` | 聪明钱资金流向 Sankey 图 |
27+
28+
## Development
29+
30+
```bash
31+
pnpm install
32+
pnpm run storybook # Storybook on :6006
33+
pnpm run build # Build all packages
34+
```

package.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,26 @@
55
"description": "A2UI Crypto Catalog and renderers for ChainStream",
66
"license": "MIT",
77
"scripts": {
8-
"build": "pnpm -r build",
8+
"build": "pnpm --filter @chainstream-io/a2ui-catalog --filter @chainstream-io/a2ui-react build",
99
"lint": "pnpm -r lint",
1010
"test": "pnpm -r test",
1111
"storybook": "storybook dev -p 6006",
1212
"build-storybook": "storybook build"
1313
},
14-
"packageManager": "pnpm@10.9.0"
14+
"packageManager": "pnpm@10.9.0",
15+
"devDependencies": {
16+
"storybook": "^8.6.0",
17+
"@storybook/react": "^8.6.0",
18+
"@storybook/react-vite": "^8.6.0",
19+
"@storybook/addon-essentials": "^8.6.0",
20+
"@storybook/addon-interactions": "^8.6.0",
21+
"react": "^19.0.0",
22+
"react-dom": "^19.0.0",
23+
"@types/react": "^19.0.0",
24+
"@types/react-dom": "^19.0.0",
25+
"typescript": "^5.7.0",
26+
"tailwindcss": "^4.0.0",
27+
"@tailwindcss/vite": "^4.0.0",
28+
"vite": "^6.0.0"
29+
}
1530
}

packages/catalog/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
2-
"name": "@chainstream/a2ui-catalog",
3-
"version": "0.0.1",
2+
"name": "@chainstream-io/a2ui-catalog",
3+
"version": "0.1.0",
44
"description": "A2UI Crypto Catalog JSON Schema definitions",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
7+
"files": ["dist"],
78
"license": "MIT",
89
"scripts": {
910
"build": "tsc",

packages/catalog/src/schema/crypto-catalog.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ export interface CryptoComponent {
99
}
1010

1111
export const cryptoCatalog: Record<string, CryptoComponent> = {
12-
CandlestickChart: {
13-
type: 'CandlestickChart',
14-
description: 'OHLCV candlestick chart',
12+
KlineChart: {
13+
type: 'KlineChart',
14+
description: 'Full-featured K-line chart with volume overlay, resolution bar, crosshair info, and real-time updates via WebSocket',
1515
dataBinding: { path: '/klines', format: 'ohlcv' },
16+
props: {
17+
showVolume: true,
18+
showToolbar: true,
19+
showCrosshairInfo: true,
20+
autoScroll: true,
21+
},
1622
},
1723
PriceLineChart: {
1824
type: 'PriceLineChart',

packages/react/package.json

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,40 @@
11
{
2-
"name": "@chainstream/a2ui-react",
3-
"version": "0.0.1",
2+
"name": "@chainstream-io/a2ui-react",
3+
"version": "0.1.0",
44
"description": "React renderer for A2UI Crypto Catalog components",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
7+
"files": ["dist"],
78
"license": "MIT",
89
"scripts": {
9-
"build": "tsc",
10+
"build": "tsc && tsc-alias",
1011
"test": "jest"
1112
},
1213
"dependencies": {
13-
"@chainstream/a2ui-catalog": "workspace:*",
14-
"lightweight-charts": "^4.2.0"
14+
"@chainstream-io/a2ui-catalog": "workspace:*",
15+
"class-variance-authority": "^0.7.0",
16+
"clsx": "^2.1.0",
17+
"lightweight-charts": "^4.2.0",
18+
"lucide-react": "^0.468.0",
19+
"radix-ui": "^1.0.0",
20+
"tailwind-merge": "^3.0.0",
21+
"tw-animate-css": "^1.0.0"
1522
},
1623
"peerDependencies": {
24+
"@chainstream-io/sdk": "^2.0.0",
1725
"react": "^18.0.0 || ^19.0.0",
1826
"react-dom": "^18.0.0 || ^19.0.0"
1927
},
28+
"peerDependenciesMeta": {
29+
"@chainstream-io/sdk": {
30+
"optional": true
31+
}
32+
},
2033
"devDependencies": {
2134
"@types/react": "^19.0.0",
2235
"react": "^19.0.0",
2336
"react-dom": "^19.0.0",
37+
"tsc-alias": "^1.8.16",
2438
"typescript": "^5.7.0"
2539
},
2640
"publishConfig": {
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import type { Meta, StoryObj } from '@storybook/react';
2+
import { AlertBadge } from './AlertBadge';
3+
4+
const meta: Meta<typeof AlertBadge> = {
5+
title: 'UI/AlertBadge',
6+
component: AlertBadge,
7+
parameters: { layout: 'centered' },
8+
};
9+
10+
export default meta;
11+
type Story = StoryObj<typeof AlertBadge>;
12+
13+
export const Info: Story = {
14+
args: {
15+
type: 'info',
16+
message: 'New listing detected on Raydium',
17+
timestamp: Date.now(),
18+
},
19+
};
20+
21+
export const Warning: Story = {
22+
args: {
23+
type: 'warning',
24+
message: 'Top holder owns 45% of supply',
25+
timestamp: Date.now(),
26+
},
27+
};
28+
29+
export const Danger: Story = {
30+
args: {
31+
type: 'danger',
32+
message: 'Honeypot risk — sell tax 99%',
33+
},
34+
};
35+
36+
export const Success: Story = {
37+
args: {
38+
type: 'success',
39+
message: 'Audit passed by CertiK',
40+
timestamp: Date.now(),
41+
},
42+
};

0 commit comments

Comments
 (0)