Skip to content

Commit 167eaa3

Browse files
Merge branch 'main' into vrf-wd-clarification
2 parents 3fd905d + 0542021 commit 167eaa3

File tree

718 files changed

+101120
-24487
lines changed

Some content is hidden

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

718 files changed

+101120
-24487
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ public/samples
1616

1717
/src/pages/chainlink-functions/resources/example-source.js
1818
/src/env.d.ts
19+
20+
src/graphql/generated.ts

.github/workflows/test.yml

Lines changed: 76 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,89 @@ name: Test
22
on: [push, pull_request]
33

44
jobs:
5-
test:
6-
name: Test
5+
# Job 1: Check Solidity Compilation and Solhint
6+
solidity:
77
runs-on: ubuntu-latest
8-
defaults:
9-
run:
10-
working-directory: ./
118
steps:
129
- name: Checkout Repo
13-
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
10+
uses: actions/checkout@v4
11+
12+
- name: Cache NPM dependencies
13+
uses: actions/cache@v3
14+
with:
15+
path: ~/.npm
16+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
17+
restore-keys: |
18+
${{ runner.os }}-node-
19+
1420
- name: Install Dependencies
15-
run: npm i
21+
run: npm ci
22+
1623
- name: Check Solidity Compilation
1724
run: npm run sol:compile
25+
1826
- name: Check Solidity Solhint
1927
run: npm run lint-solc
20-
- name: Check Eslint
28+
29+
# Job 2: Check ESLint
30+
eslint:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout Repo
34+
uses: actions/checkout@v4
35+
36+
- name: Cache NPM dependencies
37+
uses: actions/cache@v3
38+
with:
39+
path: ~/.npm
40+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
41+
restore-keys: |
42+
${{ runner.os }}-node-
43+
44+
- name: Install Dependencies
45+
run: npm ci
46+
47+
- name: Check ESLint
2148
run: npm run lint
22-
- name: Build
23-
run: npm run build
24-
# TODO: fix css files throwing 404 errors
25-
- name: Check internal links
49+
50+
# Job 3: Check Internal Links
51+
linkcheck-internal:
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Checkout Repo
55+
uses: actions/checkout@v4
56+
57+
- name: Cache NPM dependencies
58+
uses: actions/cache@v3
59+
with:
60+
path: ~/.npm
61+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
62+
restore-keys: |
63+
${{ runner.os }}-node-
64+
65+
- name: Install Dependencies
66+
run: npm ci
67+
68+
- name: Check Internal Links
2669
run: npm run linkcheck-internal
27-
- name: Check types
28-
run: npm run typecheck
70+
71+
# Job 4: Check Types
72+
typecheck:
73+
runs-on: ubuntu-latest
74+
steps:
75+
- name: Checkout Repo
76+
uses: actions/checkout@v4
77+
78+
- name: Cache NPM dependencies
79+
uses: actions/cache@v3
80+
with:
81+
path: ~/.npm
82+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
83+
restore-keys: |
84+
${{ runner.os }}-node-
85+
86+
- name: Install Dependencies
87+
run: npm ci
88+
89+
- name: Check Types
90+
run: npm run typecheck

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# build output
22
dist/
33
.astro/
4+
.vercel/
45

56
# dependencies
67
node_modules/
@@ -37,3 +38,4 @@ typechain-types/
3738

3839
.cache
3940
.idea
41+
.vercel

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
dist
22
.cache
33
.test
4+
.vercel
5+
.astro
6+
temp
47
node_modules
58
.github
69
.changeset

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"NUON",
4646
"offchain",
4747
"offramp",
48+
"permissionally",
4849
"preact",
4950
"preconfigured",
5051
"quickstarts",

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @dwightjl @aelmanaa @thedriftofwords @khadni
1+
* @gfletcher-cll @aelmanaa @thedriftofwords @khadni

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,22 @@ This repo is configured to automatically create a preview environment on Vercel
3333
## Deploying to Production
3434

3535
This repo is configured to automatically update the production (`https://docs.chain.link`) site when commits are pushed to the `main` branch.
36+
37+
## Referencing Chainlink documentation
38+
39+
If you want to reference Chainlink documentation in your documentation, please include direct links to the page(s) you're referencing, so that your users can easily access the latest information. We also recommend keeping the amount of content that you quote to a minimum, in order to reduce the maintenance burden on your side.
40+
41+
For example:
42+
43+
```
44+
Ethereum is integrated with the following Chainlink services:
45+
- [Data Feeds](https://docs.chain.link/data-feeds/price-feeds/addresses?network=ethereum)
46+
- [CCIP](https://docs.chain.link/ccip/directory/mainnet/chain/mainnet)
47+
- [Functions](https://docs.chain.link/chainlink-functions/supported-networks#ethereum)
48+
- [Automation](https://docs.chain.link/chainlink-automation/overview/supported-networks#ethereum)
49+
- [VRF](https://docs.chain.link/vrf/v2-5/supported-networks#ethereum-mainnet)
50+
51+
Additionally, you may need to refer to the [LINK Token Contracts for Ethereum](https://docs.chain.link/resources/link-token-contracts#ethereum).
52+
```
53+
54+
The most relevant documentation links for each supported chain and for each product are available in [this table](https://docs.chain.link/builders-quick-links).

SIDE_BY_SIDE_CODE.md

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# SideBySideCode Component
2+
3+
A modern, accessible component for displaying code alongside explanatory content. Perfect for documentation, tutorials, and educational content.
4+
5+
## Features
6+
7+
- 🎯 Side-by-side display of code and explanations
8+
- 🔍 Syntax highlighting with Shiki
9+
- 📍 Interactive line highlighting
10+
- 📋 One-click code copying
11+
- 🌐 Load code from local files or URLs
12+
- 📱 Responsive design
13+
- ♿ WCAG AA compliant
14+
15+
## Basic Usage
16+
17+
```mdx
18+
import { SideBySideCode } from "@components"
19+
20+
<SideBySideCode language="solidity" codeSrc="/samples/example.sol" title="Example.sol">
21+
This is where you put your explanation text. It will appear alongside the code.
22+
</SideBySideCode>
23+
```
24+
25+
## Loading Code
26+
27+
The component supports two methods for loading code:
28+
29+
### 1. Local Files
30+
31+
Place your code files in the `public/samples` directory and reference them with a relative path:
32+
33+
```mdx
34+
<SideBySideCode language="javascript" codeSrc="/samples/example.js" title="Example.js">
35+
Explanation goes here...
36+
</SideBySideCode>
37+
```
38+
39+
### 2. Remote URLs
40+
41+
Load code directly from any HTTP(S) URL:
42+
43+
```mdx
44+
<SideBySideCode
45+
language="python"
46+
codeSrc="https://raw.githubusercontent.com/user/repo/main/example.py"
47+
title="Example.py"
48+
>
49+
Explanation goes here...
50+
</SideBySideCode>
51+
```
52+
53+
## Interactive Line Highlighting
54+
55+
Highlight specific lines of code to draw attention to important sections:
56+
57+
```mdx
58+
<SideBySideCode
59+
language="typescript"
60+
codeSrc="/samples/example.ts"
61+
title="Example.ts"
62+
highlights={[
63+
{
64+
lines: [1, 2, 3],
65+
label: "Imports",
66+
description: "Import required dependencies",
67+
},
68+
{
69+
lines: [5, 6, 7],
70+
label: "Configuration",
71+
description: "Set up the configuration object",
72+
},
73+
]}
74+
>
75+
The highlights will create interactive cards that, when clicked, will highlight the corresponding lines of code.
76+
</SideBySideCode>
77+
```
78+
79+
## Props Reference
80+
81+
| Prop | Type | Required | Description |
82+
| ------------ | ----------- | -------- | ---------------------------------------------------------------------- |
83+
| `language` | `string` | No | Programming language for syntax highlighting. Defaults to "plaintext". |
84+
| `codeSrc` | `string` | Yes | Path to local file (in public/samples) or HTTP(S) URL. |
85+
| `title` | `string` | No | Title displayed in the code header. |
86+
| `highlights` | `Array` | No | Array of line highlights (see structure below). |
87+
| `children` | `ReactNode` | No | Explanatory content to display alongside the code. |
88+
89+
### Highlight Structure
90+
91+
```typescript
92+
interface LineHighlight {
93+
lines: number[] // Array of line numbers to highlight
94+
label: string // Short label for the highlight
95+
description: string // Detailed description
96+
}
97+
```
98+
99+
## Supported Languages
100+
101+
The component supports syntax highlighting for:
102+
103+
- JavaScript/TypeScript
104+
- Solidity
105+
- Python
106+
- And many more...
107+
108+
For a complete list, refer to [Shiki's supported languages](https://github.com/shikijs/shiki/blob/main/docs/languages.md).
109+
110+
## Best Practices
111+
112+
1. **Concise Explanations**
113+
114+
- Keep explanations clear and focused
115+
- Use bullet points for better readability
116+
- Highlight only the most important code sections
117+
118+
2. **Responsive Design**
119+
120+
- Component automatically adjusts for different screen sizes
121+
- Code and explanation stack vertically on mobile
122+
- Maintains readability across devices
123+
124+
3. **Accessibility**
125+
- Use descriptive labels for highlights
126+
- Ensure good color contrast in explanations
127+
- Provide meaningful titles for code sections
128+
129+
## Examples
130+
131+
### Basic Example
132+
133+
```mdx
134+
<SideBySideCode language="javascript" codeSrc="/samples/hello.js" title="Hello World">
135+
A simple hello world example in JavaScript.
136+
</SideBySideCode>
137+
```
138+
139+
### With Highlights
140+
141+
```mdx
142+
<SideBySideCode
143+
language="solidity"
144+
codeSrc="/samples/contract.sol"
145+
title="Smart Contract"
146+
highlights={[
147+
{
148+
lines: [1, 2],
149+
label: "SPDX License",
150+
description: "Specify the license for the contract",
151+
},
152+
]}
153+
>
154+
This smart contract demonstrates basic functionality. Click on the highlight cards to focus on specific sections.
155+
</SideBySideCode>
156+
```
157+
158+
### Loading from URL
159+
160+
```mdx
161+
<SideBySideCode language="python" codeSrc="https://api.example.com/code/script.py" title="Python Script">
162+
This code is loaded directly from a URL.
163+
</SideBySideCode>
164+
```
165+
166+
## Troubleshooting
167+
168+
1. **Code Not Loading**
169+
170+
- For local files: Ensure the file exists in `public/samples`
171+
- For URLs: Verify the URL is accessible and returns raw code
172+
- Check file permissions and CORS settings
173+
174+
2. **Syntax Highlighting Issues**
175+
176+
- Verify the language is supported
177+
- Check the language identifier is correct
178+
- Ensure code is properly formatted
179+
180+
3. **Layout Problems**
181+
- Clear any conflicting CSS
182+
- Ensure parent container allows for proper width
183+
- Check for proper MDX import syntax
184+
185+
## Contributing
186+
187+
We welcome contributions! Please see our contributing guidelines for more details.

astro.config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineConfig } from "astro/config"
2+
import vercel from "@astrojs/vercel/serverless"
23
import preact from "@astrojs/preact"
34
import react from "@astrojs/react"
45
import mdx from "@astrojs/mdx"
@@ -7,10 +8,19 @@ import rehypeAutolinkHeadings from "rehype-autolink-headings"
78
import rehypeWrapAll from "rehype-wrap-all"
89
import sitemap from "@astrojs/sitemap"
910
import { RehypePlugins } from "@astrojs/markdown-remark"
11+
import yaml from "@rollup/plugin-yaml"
12+
import { ccipRedirects } from "./src/config/redirects/ccip"
1013

1114
// https://astro.build/config
1215
export default defineConfig({
1316
site: "https://docs.chain.link",
17+
redirects: {
18+
"/ccip/directory": "/ccip/directory/mainnet",
19+
"/ccip/supported-networks": "/ccip/directory/mainnet",
20+
"/getting-started": "/getting-started/conceptual-overview",
21+
"/resources": "/resources/link-token-contracts",
22+
...ccipRedirects,
23+
},
1424
integrations: [
1525
preact({
1626
include: ["**/preact/*"],
@@ -36,4 +46,9 @@ export default defineConfig({
3646
syntaxHighlight: "prism",
3747
smartypants: false,
3848
},
49+
output: "hybrid",
50+
adapter: vercel(),
51+
vite: {
52+
plugins: [yaml()],
53+
},
3954
})

0 commit comments

Comments
 (0)