-
Notifications
You must be signed in to change notification settings - Fork 17
docs: add sandbox and ensv2readiness #2103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
d391047
add sandbox and ensv2readiness
sevenzing 787609b
temp remove quickstart from llmtext
sevenzing f01ce76
create static graphql examples
sevenzing 0e9b76e
revert quickstart and ensv2 readiness changes
sevenzing 894b9b6
Merge branch 'main' into ll/docs-query-sandbox
sevenzing ab9e0de
playgroud examples
sevenzing 394dd38
rename cookbook to examples
sevenzing 58cef6a
Merge branch 'main' into ll/docs-query-sandbox
sevenzing 28b1a51
add description to examples
sevenzing 4f9ec7c
add interactive enssdk example
sevenzing 8335ddf
add enskit interactive example
sevenzing b867a9c
remove title from code example
sevenzing 0b720c5
add sidebar docked
sevenzing 6d29219
add schema reference
sevenzing 239109f
use @ import instead of ..
sevenzing e4045e4
add cleanup
sevenzing 15959fc
Merge branch 'main' into ll/docs-query-sandbox
sevenzing 5dceafa
fix AI comments
sevenzing 9e7be1a
fix production bug
sevenzing 85825e1
replace rocket with zap
sevenzing 9c47174
update interactive example descriptions
sevenzing 8b5dca6
Merge branch 'main' into ll/docs-query-sandbox
sevenzing 4f30016
fix wrong git merge
sevenzing 42def48
Merge branch 'main' into ll/docs-query-sandbox
sevenzing 2ed324c
Update examples export to be published to NPM
tk-o e6413bb
Fix import paths
tk-o 100fda5
Add specific package entrypoint for gql examples
tk-o 6239a61
Update GQL examples
tk-o 410e6ff
revert examples to use previous data model version
tk-o d5ce33d
publish the internal module for ENSNode SDK package
tk-o f2f7ac2
Pin package version to make GQL examples work with the current produc…
tk-o 8fb2f07
fix example start
sevenzing 9c223af
final fixes
sevenzing ea80606
Merge branch 'main' into ll/docs-query-sandbox
sevenzing 821e2f3
Merge remote-tracking branch 'origin/fix-sha-89c022b' into ll/docs-qu…
sevenzing 97d434f
fix final
sevenzing 98c57d2
revert deleting why ensnode
sevenzing 348661b
super final fixes after self review. always self review before merge!…
sevenzing 922e358
final fixes
sevenzing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import starlightLlmsTxt from "starlight-llms-txt"; | ||
|
|
||
| /** | ||
| * `starlight-llms-txt` renders each docs entry for `/llms-full.txt` and `/llms-small.txt` through | ||
| * an Astro container that only registers the MDX SSR renderer, not React. MDX pages that import | ||
| * `.tsx` islands must be omitted from those exports or `astro build` fails with `NoMatchingRenderer`. | ||
| * | ||
| * Patterns use micromatch against each entry's `id` in the Starlight `docs` collection | ||
| * (paths are relative to `src/content/docs/`; a folder's `index.mdx` uses the folder path as `id`, | ||
| * e.g. `docs/integrate` for `docs/integrate/index.mdx`). | ||
| */ | ||
| export const starlightLlmsTxtPlugin = starlightLlmsTxt({ | ||
| exclude: ["docs/integrate"], | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 86 additions & 0 deletions
86
docs/ensnode.io/src/components/molecules/CodePlayground.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| import sdk, { type EmbedOptions, type Project } from "@stackblitz/sdk"; | ||
| import { useEffect, useRef } from "react"; | ||
|
|
||
| interface CodePlaygroundProps { | ||
| title: string; | ||
| description?: string; | ||
| files: Record<string, string>; | ||
| dependencies: Record<string, string>; | ||
| entryFileName?: string; | ||
| height?: number; | ||
| terminalHeight?: number; | ||
| } | ||
|
|
||
| export default function CodePlayground({ | ||
| title, | ||
| description, | ||
| files, | ||
| dependencies, | ||
| entryFileName = "index.ts", | ||
| height = 500, | ||
| terminalHeight = 35, | ||
| }: CodePlaygroundProps) { | ||
| const ref = useRef<HTMLDivElement>(null); | ||
|
|
||
| useEffect(() => { | ||
| if (!ref.current) return; | ||
|
|
||
| const packageJson = JSON.stringify( | ||
| { | ||
| name: title.toLowerCase().replace(/\s+/g, "-"), | ||
| version: "0.0.0", | ||
| private: true, | ||
| type: "module", | ||
| scripts: { start: `tsx ${entryFileName}` }, | ||
| dependencies: { tsx: "latest", ...dependencies }, | ||
| }, | ||
| null, | ||
| 2, | ||
| ); | ||
|
|
||
| const tsconfig = JSON.stringify( | ||
| { | ||
| compilerOptions: { | ||
| target: "es2022", | ||
| module: "nodenext", | ||
| moduleResolution: "nodenext", | ||
| strict: true, | ||
| }, | ||
| }, | ||
| null, | ||
| 2, | ||
| ); | ||
|
|
||
| const projectFiles = { | ||
| "package.json": packageJson, | ||
| "tsconfig.json": tsconfig, | ||
| ...files, | ||
| }; | ||
|
sevenzing marked this conversation as resolved.
|
||
|
|
||
| const project = { | ||
| title, | ||
| description, | ||
| template: "node", | ||
| files: projectFiles, | ||
| } as Project; | ||
| const options = { | ||
| openFile: entryFileName, | ||
| terminalHeight, | ||
| height, | ||
| hideNavigation: true, | ||
| hideExplorer: true, | ||
| hideDevTools: true, | ||
| showSidebar: false, | ||
| view: "editor", | ||
| theme: "light", | ||
| } as EmbedOptions; | ||
|
|
||
| sdk.embedProject(ref.current, project, options); | ||
| }, []); | ||
|
sevenzing marked this conversation as resolved.
Outdated
sevenzing marked this conversation as resolved.
Outdated
|
||
|
|
||
| return ( | ||
| <div className="not-content"> | ||
| <div ref={ref} /> | ||
| </div> | ||
| ); | ||
| } | ||
28 changes: 28 additions & 0 deletions
28
docs/ensnode.io/src/components/molecules/EnssdkPlayground.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import CodePlayground from "./CodePlayground"; | ||
|
|
||
| interface CodePlaygroundProps { | ||
| title: string; | ||
| description?: string; | ||
| fileContent: string; | ||
| height?: number; | ||
| terminalHeight?: number; | ||
| } | ||
|
|
||
| export default function EnssdkPlayground({ | ||
| title, | ||
| description, | ||
| fileContent, | ||
| height, | ||
| terminalHeight, | ||
| }: CodePlaygroundProps) { | ||
| return ( | ||
| <CodePlayground | ||
| title={title} | ||
| description={description} | ||
| files={{ "index.ts": fileContent }} | ||
| dependencies={{ "@ensnode/ensnode-sdk": "latest" }} | ||
| height={height} | ||
| terminalHeight={terminalHeight} | ||
|
sevenzing marked this conversation as resolved.
Outdated
|
||
| /> | ||
| ); | ||
| } | ||
40 changes: 40 additions & 0 deletions
40
docs/ensnode.io/src/components/playgrounds/EnssdkResolutionApi.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import EnssdkPlayground from "../molecules/EnssdkPlayground"; | ||
| import { ENSNODE_URL, getNiceHeightForSnippet } from "./common"; | ||
|
|
||
| const snippet = ` | ||
| import { createEnsNodeClient } from 'enssdk/core'; | ||
| import { omnigraph, graphql } from 'enssdk/omnigraph'; | ||
| import { asInterpretedName } from "enssdk"; | ||
|
|
||
| const client = createEnsNodeClient({ | ||
| url: '${ENSNODE_URL}', | ||
| }).extend(omnigraph); | ||
|
|
||
| const MyQuery = graphql(\` | ||
| query MyQuery($name: InterpretedName!) { | ||
| domain(by: { name: $name }) { | ||
| name | ||
| owner { address } | ||
| resolver { contract { chainId address }} | ||
| registration { expiry } | ||
| } | ||
| } | ||
| \`); | ||
|
|
||
| const result = await client.omnigraph.query({ | ||
| query: MyQuery, | ||
| variables: { name: asInterpretedName('nick.eth') }, | ||
| }); | ||
| console.log('Result:', result.data); | ||
| `.trim(); | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| export default function EnssdkResolutionApiPlayground() { | ||
| return ( | ||
| <EnssdkPlayground | ||
| title="ENSNode SDK — Resolution API" | ||
| description="Query ENS name data in seconds using [`@ensnode/ensnode-sdk`](/docs/integrate/integration-options/enssdk)." | ||
| fileContent={snippet} | ||
| height={getNiceHeightForSnippet(snippet)} | ||
| /> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // TODO: Update to the latest ENSNode URL | ||
| export const ENSNODE_URL = "https://api.v2-sepolia.green.ensnode.io"; | ||
|
sevenzing marked this conversation as resolved.
Outdated
sevenzing marked this conversation as resolved.
Outdated
|
||
|
|
||
| export function getNiceHeightForSnippet(snippet: string) { | ||
| const linesCount = snippet.split("\n").length; | ||
| const lineHeight = 18; | ||
| const headerHeight = 38; | ||
| const footerHeight = 32; | ||
| const height = linesCount * lineHeight + headerHeight + footerHeight; | ||
|
|
||
| const terminalHeightPercentage = 0.35; | ||
|
|
||
| return Math.ceil(height / (1 - terminalHeightPercentage)); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| diff --git a/llms-full.txt.ts b/llms-full.txt.ts | ||
| index cdc3a34c0555c4a556224f63d937d976c669eef0..45d60f54994240e93277021cb649237c4874f4ce 100644 | ||
| --- a/llms-full.txt.ts | ||
| +++ b/llms-full.txt.ts | ||
| @@ -1,4 +1,5 @@ | ||
| import type { APIRoute } from 'astro'; | ||
| +import { starlightLllmsTxtContext } from 'virtual:starlight-llms-txt/context'; | ||
| import { generateLlmsTxt } from './generator'; | ||
| import { getSiteTitle } from './utils'; | ||
|
|
||
| @@ -9,6 +10,7 @@ export const GET: APIRoute = async (context) => { | ||
| const body = await generateLlmsTxt(context, { | ||
| minify: false, | ||
| description: `This is the full developer documentation for ${getSiteTitle()}`, | ||
| + exclude: starlightLllmsTxtContext.exclude, | ||
| }); | ||
| return new Response(body); | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.