Skip to content

Commit 675cf7d

Browse files
author
iexitdev
committed
Add Pro chart docs previews
1 parent b6d1097 commit 675cf7d

18 files changed

Lines changed: 2024 additions & 715 deletions

.github/workflows/site.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Site
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
- next
9+
paths:
10+
- ".github/workflows/site.yml"
11+
- "apps/site/**"
12+
- "docs/**"
13+
- "packages/**"
14+
- "package-lock.json"
15+
- "package.json"
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v5
24+
25+
- name: Setup Node
26+
uses: actions/setup-node@v5
27+
with:
28+
node-version: 22
29+
cache: npm
30+
31+
- name: Install dependencies
32+
run: npm ci --ignore-scripts
33+
34+
- name: Install Pro docs package
35+
env:
36+
CHART_KIT_PRO_NPM_TOKEN: ${{ secrets.CHART_KIT_PRO_NPM_TOKEN }}
37+
run: |
38+
if [ -n "$CHART_KIT_PRO_NPM_TOKEN" ]; then
39+
npm config set //registry.npmjs.org/:_authToken "$CHART_KIT_PRO_NPM_TOKEN"
40+
npm install --no-save --package-lock=false --ignore-scripts @chart-kit/pro
41+
echo "CHART_KIT_PRO_DOCS=true" >> "$GITHUB_ENV"
42+
else
43+
echo "CHART_KIT_PRO_NPM_TOKEN is not set; building with local Pro docs stubs."
44+
fi
45+
46+
- name: Build site
47+
run: npm run site:build

apps/site/astro.config.mjs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ const expoVectorIconsStub = localSource(
2525
const svgTransformParserStub = localSource(
2626
"./src/previews/svgTransformParserStub.ts"
2727
);
28+
const useRealProCharts = process.env.CHART_KIT_PRO_DOCS === "true";
29+
const chartKitProAliases = useRealProCharts
30+
? []
31+
: [
32+
{
33+
find: /^@chart-kit\/pro$/,
34+
replacement: localSource("./src/previews/proStub.tsx")
35+
}
36+
];
2837

2938
const chartKitPreviewWebAliases = () => ({
3039
name: "chart-kit-preview-web-aliases",
@@ -95,6 +104,14 @@ export default defineConfig({
95104
{ slug: docsSlug("charts/contribution-heatmap") }
96105
]
97106
},
107+
{
108+
label: "Pro Charts",
109+
items: [
110+
{ slug: docsSlug("charts/candlebar") },
111+
{ slug: docsSlug("charts/radar") },
112+
{ slug: docsSlug("charts/combo") }
113+
]
114+
},
98115
{
99116
label: "Guides",
100117
items: [
@@ -125,6 +142,7 @@ export default defineConfig({
125142
"react-native",
126143
"react-native-chart-kit",
127144
"react-native-chart-kit/v2",
145+
"@chart-kit/pro",
128146
"react-native-gesture-handler",
129147
"react-native-svg"
130148
]
@@ -147,6 +165,7 @@ export default defineConfig({
147165
find: /^@chart-kit\/svg-renderer$/,
148166
replacement: packageSource("svg-renderer/src/index.ts")
149167
},
168+
...chartKitProAliases,
150169
{
151170
find: /^react-native$/,
152171
replacement: reactNativeWebStub

0 commit comments

Comments
 (0)