Skip to content

Commit d599dda

Browse files
committed
rebrand to SDK reference
1 parent 5f15a2a commit d599dda

File tree

80 files changed

+175
-161
lines changed

Some content is hidden

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

80 files changed

+175
-161
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
packages/python-sdk/e2b/api/client/** linguist-generated=true
22
**/*.gen.ts linguist-generated=true
3-
apps/web/src/app/(docs)/docs/api-reference/** linguist-generated=true
3+
apps/web/src/app/(docs)/docs/sdk-reference/** linguist-generated=true

.github/scripts/is_new_api_ref.sh renamed to .github/scripts/is_new_sdk_ref.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -euo pipefail
44

55
# This script checks for diffs in the packages directory.
6-
# If there are diffs, it means we need to generate a new API references.
6+
# If there are diffs, it means we need to generate new SDK references.
77
if git diff --name-only HEAD^ | grep -q '^packages/'; then
88
echo "true"
99
else

.github/workflows/generate_api_ref.yml renamed to .github/workflows/generate_sdk_ref.yml

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Generate SDK API references
1+
name: Generate SDK references
22

33
on:
44
workflow_dispatch:
@@ -13,11 +13,11 @@ permissions:
1313
contents: write
1414

1515
jobs:
16-
is_new_api_ref:
17-
name: Is new API reference?
16+
is_new_sdk_ref:
17+
name: Is new SDK reference?
1818
runs-on: ubuntu-latest
1919
outputs:
20-
new_api_ref: ${{ steps.sdk-changes.outputs.new_api_ref }}
20+
new_sdk_ref: ${{ steps.sdk-changes.outputs.new_sdk_ref }}
2121
steps:
2222
- name: Checkout Repo
2323
uses: actions/checkout@v3
@@ -27,12 +27,12 @@ jobs:
2727
- name: Check if SDK changes
2828
id: sdk-changes
2929
run: |
30-
IS_NEW_API_REF=$(./.github/scripts/is_new_api_ref.sh)
31-
echo "new_api_ref=$IS_NEW_API_REF" >> "$GITHUB_OUTPUT"
30+
IS_NEW_sdk_REF=$(./.github/scripts/is_new_sdk_ref.sh)
31+
echo "new_sdk_ref=$IS_NEW_sdk_REF" >> "$GITHUB_OUTPUT"
3232
3333
sdk-changes:
3434
name: SDK changes
35-
needs: [is_new_api_ref]
35+
needs: [is_new_sdk_ref]
3636
if: always()
3737
runs-on: ubuntu-latest
3838
steps:
@@ -81,43 +81,41 @@ jobs:
8181
working-directory: ./packages/python-sdk
8282
run: poetry install --no-interaction --no-root
8383

84-
- name: Generate Python SDK API reference
85-
id: python-sdk-api-ref
84+
- name: Generate Python SDK reference
85+
id: python-sdk-ref
8686
working-directory: ./packages/python-sdk
8787
run: |
8888
source .venv/bin/activate
89-
./scripts/generate_api_ref.sh
89+
./scripts/generate_sdk_ref.sh
9090
91-
- name: Generate JS SDK API reference
92-
id: js-sdk-api-ref
91+
- name: Generate JS SDK reference
92+
id: js-sdk-ref
9393
working-directory: packages/js-sdk
94-
run: ./scripts/generate_api_ref.sh
94+
run: ./scripts/generate_sdk_ref.sh
9595

96-
- name: Generate CLI API reference
97-
id: cli-api-ref
96+
- name: Generate CLI reference
97+
id: cli-sdk-ref
9898
working-directory: packages/cli
99-
run: ./scripts/generate_api_ref.sh
99+
run: ./scripts/generate_sdk_ref.sh
100100

101-
- name: Clone code-interpreter API reference
101+
- name: Clone code-interpreter reference
102102
run: |
103103
git clone --depth 1 --filter=blob:none --sparse https://github.com/e2b-dev/code-interpreter -b generate-api-reference-for-code-interpreter-sdk-e2b-1235
104104
cd code-interpreter
105-
git sparse-checkout set api-reference
106-
cp -r api-reference/* ../apps/web/src/app/\(docs\)/docs/api-reference/
105+
git sparse-checkout set sdk-reference
106+
cp -r sdk-reference/* ../apps/web/src/app/\(docs\)/docs/sdk-reference/
107107
cd ..
108108
rm -rf code-interpreter
109109
110110
- name: Show docs file structure
111-
run: tree apps/web/src/app/\(docs\)/docs/api-reference
111+
run: tree apps/web/src/app/\(docs\)/docs/sdk-reference
112112

113-
- name: Commit new SDK API reference versions
113+
- name: Commit new SDK reference versions
114114
env:
115115
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116116
run: |
117117
git config user.name "github-actions[bot]"
118118
git config user.email "github-actions[bot]@users.noreply.github.com"
119-
tree apps/web/src/app/\(docs\)/docs/api-reference
120-
git status
121-
git add apps/web/src/app/\(docs\)/docs/api-reference
122-
git commit -m "[skip ci] Release new SDK API reference doc versions" || exit 0
119+
git add apps/web/src/app/\(docs\)/docs/sdk-reference
120+
git commit -m "[skip ci] Release new SDK reference doc versions" || exit 0
123121
git push

.github/workflows/publish_packages.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ jobs:
6767
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6868
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
6969

70-
- name: Generate API Ref
71-
run: pnpm run generate-api-reference
70+
- name: Generate SDK reference
71+
run: pnpm run generate-sdk-reference
7272

7373
- name: Update lock file
7474
run: pnpm i --no-link --no-frozen-lockfile
@@ -77,7 +77,7 @@ jobs:
7777
run: |
7878
git config user.name "github-actions[bot]"
7979
git config user.email "github-actions[bot]@users.noreply.github.com"
80-
git add apps/web/src/app/\(docs\)/docs/api-reference
80+
git add apps/web/src/app/\(docs\)/docs/sdk-reference
8181
git commit -am "[skip ci] Release new versions" || exit 0
8282
git push
8383
env:

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,6 @@ cython_debug/
289289
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
290290
.idea/
291291

292-
# API reference artifacts
293-
api_ref/
294-
apiRefRoutes.json
292+
# SDK reference artifacts
293+
sdk_ref/
294+
sdkRefRoutes.json

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Web
66
apps/web @jakubno @mishushakov
77
apps/web/src/app/(docs)/docs @mlejva
8-
apps/web/src/app/(docs)/docs/api-reference @0div
8+
apps/web/src/app/(docs)/docs/sdk-reference @0div
99

1010
# SDKs
1111
packages @jakubno @ValentaTomas

apps/web/.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ vale-styles
4444
# Sentry Auth Token
4545
.sentryclirc
4646

47-
# Add the generated route file for API reference docs to gitignore so we don't commit it.
47+
# Add the generated route file for SDK reference docs to gitignore so we don't commit it.
4848
# The idea is that we want to generate this file only from the automated GitHub actions.
49-
apiRefRoutes.json
49+
sdkRefRoutes.json

apps/web/README.md

Lines changed: 7 additions & 7 deletions

apps/web/prebuild.js

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const fs = require('fs')
22
const path = require('path')
33

4-
const ApiRefRoutesFilePath = './src/components/Navigation/apiRefRoutes.json'
4+
const sdkRefRoutesFilePath = './src/components/Navigation/sdkRefRoutes.json'
55

66
// Current directory hierarchy:
77
//
@@ -42,6 +42,10 @@ function formatModuleTitle(title) {
4242
}
4343

4444
function toAnchorLink(title) {
45+
// Replace underscores with dashes
46+
title = title.replace(/_/g, '-')
47+
// Trim dashes from start and end
48+
title = title.replace(/^-+|-+$/g, '')
4549
// Remove special characters except dashes and spaces
4650
title = title.replace(/[^a-zA-Z0-9\- ]/g, '')
4751
// Add dashes between words for camelCase
@@ -62,17 +66,23 @@ function getSubModules(pkg, href, dirPath) {
6266
const subModules = []
6367
for (let i = 0; i < lines.length; i++) {
6468
const line = lines[i]
65-
if (pkg === 'js-sdk') {
69+
if (pkg === 'js-sdk' || pkg === 'code-interpreter-js-sdk') {
6670
if (line.startsWith('### ')) {
67-
const title = line.slice(3).trim()
71+
let title = line.slice(3).trim()
72+
// Remove backslashes from title
73+
title = title.replace(/\\/g, '')
6874
if (title) {
6975
subModules.push({
7076
title: title,
7177
href: href + toAnchorLink(title),
7278
})
7379
}
7480
}
75-
} else if (pkg === 'python-sdk' || pkg === 'cli') {
81+
} else if (
82+
pkg === 'python-sdk' ||
83+
pkg === 'cli' ||
84+
pkg === 'code-interpreter-python-sdk'
85+
) {
7686
if (line.startsWith('## ')) {
7787
const title = line.slice(2).trim()
7888
if (title) {
@@ -119,13 +129,13 @@ function buildRoutes(dirName, dir, basePath = '', depth = 1) {
119129
versionedItems[version] = modules.map((module) => {
120130
return {
121131
title: formatModuleTitle(module),
122-
href: `/docs/api-reference/${entryName}/${version}/${module}`,
132+
href: `/docs/sdk-reference/${entryName}/${version}/${module}`,
123133
links: getSubModules(
124134
entryName,
125-
`/docs/api-reference/${entryName}/${version}/${module}`,
135+
`/docs/sdk-reference/${entryName}/${version}/${module}`,
126136
path.join(
127137
__dirname,
128-
`./src/app/(docs)/docs/api-reference/${entryName}/${version}/${module}`
138+
`./src/app/(docs)/docs/sdk-reference/${entryName}/${version}/${module}`
129139
)
130140
),
131141
}
@@ -162,7 +172,7 @@ function buildRoutes(dirName, dir, basePath = '', depth = 1) {
162172
// .slice(1)
163173
// .map(
164174
// (version) =>
165-
// `<a href="/docs/api-reference/${dirName}/${version}" className="version-link">${version}</a>`
175+
// `<a href="/docs/sdk-reference/${dirName}/${version}" className="version-link">${version}</a>`
166176
// )
167177
// .join('\n ')}
168178
// </div>
@@ -204,25 +214,25 @@ function buildRoutes(dirName, dir, basePath = '', depth = 1) {
204214
.filter(Boolean)
205215
}
206216

207-
function generateApiRefRoutes() {
208-
const apiRefPath = path.join(__dirname, './src/app/(docs)/docs/api-reference')
217+
function generatesdkRefRoutes() {
218+
const sdkRefPath = path.join(__dirname, './src/app/(docs)/docs/sdk-reference')
209219

210-
if (!fs.existsSync(apiRefPath)) {
220+
if (!fs.existsSync(sdkRefPath)) {
211221
return []
212222
}
213223

214-
hierarchy = buildDirectoryHierarchy(apiRefPath)
224+
hierarchy = buildDirectoryHierarchy(sdkRefPath)
215225

216-
const routes = buildRoutes('api-reference', apiRefPath)
226+
const routes = buildRoutes('sdk-reference', sdkRefPath)
217227
return routes
218228
}
219229

220-
const apiRefRoutes = generateApiRefRoutes()
230+
const sdkRefRoutes = generatesdkRefRoutes()
221231

222232
fs.writeFileSync(
223-
path.join(__dirname, ApiRefRoutesFilePath),
224-
JSON.stringify(apiRefRoutes, null, 2)
233+
path.join(__dirname, sdkRefRoutesFilePath),
234+
JSON.stringify(sdkRefRoutes, null, 2)
225235
)
226236

227-
console.log('\n\nAPI reference routes generated successfully:\n\n')
228-
console.log('routes', JSON.stringify(apiRefRoutes, null, 2), '\n\n')
237+
console.log('\n\nSDK reference routes generated successfully:\n\n')
238+
console.log('routes', JSON.stringify(sdkRefRoutes, null, 2), '\n\n')

apps/web/src/app/(docs)/docs/page.mdx

Lines changed: 1 addition & 1 deletion

apps/web/src/app/(docs)/docs/api-reference/page.mdx renamed to apps/web/src/app/(docs)/docs/sdk-reference/page.mdx

Lines changed: 2 additions & 2 deletions

apps/web/src/components/Header.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ function DocumentationTypeLink({
3434
className={clsx(
3535
'hover:text-white hover:cursor-pointer text-sm font-medium px-2 py-1 rounded-md',
3636
pathname.startsWith(href) &&
37-
// XXX: this is a hack to avoid the /docs and /docs/api-reference links being highlighted at the same time
38-
!(href === '/docs' && pathname.startsWith('/docs/api-reference'))
37+
// XXX: this is a hack to avoid the /docs and /docs/sdk-reference links being highlighted at the same time
38+
!(href === '/docs' && pathname.startsWith('/docs/sdk-reference'))
3939
? 'text-white bg-zinc-800'
4040
: 'text-neutral-400'
4141
)}
@@ -110,8 +110,8 @@ export const Header = forwardRef(function Header({ className }, ref) {
110110
/>
111111
<DocumentationTypeLink
112112
pathname={pathname}
113-
href="/docs/api-reference"
114-
title="API Reference"
113+
href="/docs/sdk-reference"
114+
title="SDK Reference"
115115
/>
116116
<DocumentationTypeLink
117117
pathname={pathname}
@@ -136,8 +136,8 @@ export const Header = forwardRef(function Header({ className }, ref) {
136136
/>
137137
<DocumentationTypeLink
138138
pathname={pathname}
139-
href="/docs/api-reference"
140-
title="API Reference"
139+
href="/docs/sdk-reference"
140+
title="SDK Reference"
141141
/>
142142
<DocumentationTypeLink
143143
pathname={pathname}

apps/web/src/components/Layout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { motion } from 'framer-motion'
55
import { usePathname } from 'next/navigation'
66

77
import { Footer } from '@/components/Footer'
8-
import { ApiRefNavigation, DocsNavigation } from '@/components/Navigation'
8+
import { DocsNavigation, SdkRefNavigation } from '@/components/Navigation'
99
import { Section, SectionProvider } from '@/components/SectionProvider'
1010

1111
export function Layout({
@@ -18,7 +18,7 @@ export function Layout({
1818
const pathname = usePathname()
1919
const relativePathname = pathname?.replace(new RegExp('^/docs'), '')
2020
const isDocs = pathname?.startsWith('/docs')
21-
const isApiRef = pathname?.startsWith('/docs/api-reference')
21+
const isApiRef = pathname?.startsWith('/docs/sdk-reference')
2222
const isDashboard = pathname?.startsWith('/dashboard')
2323

2424
return (
@@ -53,7 +53,7 @@ export function Layout({
5353
"
5454
>
5555
<div className="hidden lg:block lg:mt-4">
56-
{isApiRef ? <ApiRefNavigation /> : <DocsNavigation />}
56+
{isApiRef ? <SdkRefNavigation /> : <DocsNavigation />}
5757
</div>
5858
</div>
5959
)}

0 commit comments

Comments
 (0)