Skip to content

chore(docs): install vitepress and generate structure #167

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,7 @@ typings/
!.vscode/extensions.json

# End of https://www.gitignore.io/api/node,visualstudiocode,macos

### Vitepress ###
docs/.vitepress/cache
docs/.vitepress/dist
152 changes: 152 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "CodeSandbox SDK",
description: "The power of CodeSandbox in a library",
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Home', link: '/' },
{ text: 'Guides', link: '/guides/getting-started/quick-start' },
{ text: 'API Reference', link: '/api/core-classes/codesandbox' },
{ text: 'CLI', link: '/cli/overview' }
],

sidebar: {
'/guides/': [
{
text: 'Getting Started',
collapsed: false,
items: [
{ text: 'Quick Start', link: '/guides/getting-started/quick-start' },
{ text: 'Platform Setup', link: '/guides/getting-started/platform-setup' },
{ text: 'Authentication', link: '/guides/getting-started/authentication' }
]
},
{
text: 'Core Concepts',
collapsed: false,
items: [
{ text: 'Understanding Sandboxes', link: '/guides/core-concepts/sandboxes' },
{ text: 'Sandbox Lifecycle', link: '/guides/core-concepts/lifecycle' },
{ text: 'VM Tiers & Resources', link: '/guides/core-concepts/vm-tiers' }
]
},
{
text: 'SDK Usage',
collapsed: false,
items: [
{ text: 'Basic Operations', link: '/guides/sdk-usage/basic-operations' },
{ text: 'File System Operations', link: '/guides/sdk-usage/filesystem' },
{ text: 'Command Execution', link: '/guides/sdk-usage/commands' },
{ text: 'Terminal Management', link: '/guides/sdk-usage/terminals' }
]
},
{
text: 'Advanced Features',
collapsed: false,
items: [
{ text: 'Port Management', link: '/guides/advanced/ports' },
{ text: 'Source Control', link: '/guides/advanced/git' },
{ text: 'Code Interpretation', link: '/guides/advanced/interpreters' },
{ text: 'Browser Integration', link: '/guides/advanced/browser' }
]
},
{
text: 'Use Cases',
collapsed: false,
items: [
{ text: 'AI Agents & Code Interpretation', link: '/guides/use-cases/ai-agents' },
{ text: 'Development Environments', link: '/guides/use-cases/dev-environments' },
{ text: 'CI/CD Integration', link: '/guides/use-cases/cicd' },
{ text: 'Educational Platforms', link: '/guides/use-cases/education' }
]
},
{
text: 'Best Practices',
collapsed: false,
items: [
{ text: 'Performance Optimization', link: '/guides/best-practices/performance' },
{ text: 'Error Handling', link: '/guides/best-practices/error-handling' },
{ text: 'Monitoring & Debugging', link: '/guides/best-practices/monitoring' }
]
}
],
'/api/': [
{
text: 'Core Classes',
collapsed: false,
items: [
{ text: 'CodeSandbox', link: '/api/core-classes/codesandbox' },
{ text: 'Sandboxes', link: '/api/core-classes/sandboxes' },
{ text: 'Sandbox', link: '/api/core-classes/sandbox' },
{ text: 'SandboxClient', link: '/api/core-classes/sandbox-client' }
]
},
{
text: 'SandboxClient APIs',
collapsed: false,
items: [
{ text: 'File System', link: '/api/sandbox-client/filesystem' },
{ text: 'Commands', link: '/api/sandbox-client/commands' },
{ text: 'Terminals', link: '/api/sandbox-client/terminals' },
{ text: 'Ports', link: '/api/sandbox-client/ports' },
{ text: 'Tasks', link: '/api/sandbox-client/tasks' },
{ text: 'Interpreters', link: '/api/sandbox-client/interpreters' },
{ text: 'Setup', link: '/api/sandbox-client/setup' }
]
},
{
text: 'Browser APIs',
collapsed: false,
items: [
{ text: 'Browser Connection', link: '/api/browser/connection' },
{ text: 'Preview Management', link: '/api/browser/previews' }
]
},
{
text: 'Host Tokens',
collapsed: false,
items: [
{ text: 'HostTokens Class', link: '/api/host-tokens/host-tokens' }
]
},
{
text: 'Types & Interfaces',
collapsed: false,
items: [
{ text: 'Configuration Types', link: '/api/types/configuration' },
{ text: 'Event Types', link: '/api/types/events' },
{ text: 'Error Types', link: '/api/types/errors' }
]
}
],
'/cli/': [
{
text: 'CLI Documentation',
collapsed: false,
items: [
{ text: 'Overview', link: '/cli/overview' },
{ text: 'Interactive Mode', link: '/cli/interactive' },
{ text: 'Build Command', link: '/cli/build' },
{ text: 'Sandbox Management', link: '/cli/sandboxes' },
{ text: 'Host Tokens', link: '/cli/host-tokens' }
]
}
]
},

socialLinks: [
{ icon: 'github', link: 'https://github.com/codesandbox/codesandbox-sdk' }
],

search: {
provider: 'local'
},

editLink: {
pattern: 'https://github.com/codesandbox/codesandbox-sdk/edit/main/docs/:path'
}
}
})
49 changes: 49 additions & 0 deletions docs/api-examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
outline: deep
---

# Runtime API Examples

This page demonstrates usage of some of the runtime APIs provided by VitePress.

The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:

```md
<script setup>
import { useData } from 'vitepress'

const { theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>
```

<script setup>
import { useData } from 'vitepress'

const { site, theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>

## More

Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).
Loading