Skip to content

Commit 75b77a3

Browse files
committed
cp dines
1 parent 71de54c commit 75b77a3

17 files changed

Lines changed: 1285 additions & 28 deletions

.github/workflows/publish-docs.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Publish Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'src/**'
9+
- 'typedoc.json'
10+
- 'tsconfig.typedoc.json'
11+
- 'package.json'
12+
- 'README-SDK.md'
13+
workflow_dispatch:
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
publish-docs:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: '22'
31+
cache: 'yarn'
32+
33+
- name: Install dependencies
34+
run: yarn install --frozen-lockfile
35+
36+
- name: Build project
37+
run: yarn build
38+
39+
- name: Build documentation
40+
run: yarn docs:sdk
41+
42+
- name: Get version from package.json
43+
id: package-version
44+
run: |
45+
VERSION=$(node -p "require('./package.json').version")
46+
echo "version=$VERSION" >> $GITHUB_OUTPUT
47+
echo "Built docs for version: $VERSION"
48+
49+
- name: Check if gh-pages branch exists
50+
id: check-branch
51+
run: |
52+
if git ls-remote --heads origin gh-pages | grep -q gh-pages; then
53+
echo "exists=true" >> $GITHUB_OUTPUT
54+
else
55+
echo "exists=false" >> $GITHUB_OUTPUT
56+
fi
57+
58+
- name: Create gh-pages branch if it doesn't exist
59+
if: steps.check-branch.outputs.exists == 'false'
60+
run: |
61+
git checkout --orphan gh-pages
62+
git rm -rf . || true
63+
mkdir -p docs
64+
touch docs/.gitkeep
65+
git add docs/.gitkeep
66+
git commit -m "Initial commit for gh-pages branch"
67+
git push origin gh-pages
68+
69+
- name: Checkout gh-pages branch
70+
uses: actions/checkout@v4
71+
with:
72+
ref: gh-pages
73+
path: gh-pages
74+
fetch-depth: 0
75+
76+
- name: Copy documentation to gh-pages
77+
run: |
78+
# Create docs directory if it doesn't exist
79+
mkdir -p gh-pages/docs
80+
81+
# The plugin creates versioned directories and symlinks automatically
82+
# Copy the entire docs directory structure to preserve all versions
83+
# Use -a to preserve symlinks and directory structure
84+
if [ -d "docs" ]; then
85+
# Copy all contents from docs to gh-pages/docs
86+
# This preserves version directories and symlinks created by the plugin
87+
cp -a docs/* gh-pages/docs/ 2>/dev/null || cp -r docs/* gh-pages/docs/
88+
echo "Copied documentation to gh-pages/docs/"
89+
else
90+
echo "Warning: docs directory not found"
91+
exit 1
92+
fi
93+
94+
# List what was copied for debugging
95+
echo "Contents of gh-pages/docs:"
96+
ls -la gh-pages/docs/ || true
97+
98+
- name: Create index.html redirect
99+
run: |
100+
# Create an index.html in gh-pages root that redirects to docs
101+
# This allows GitHub Pages to serve the docs when configured to deploy from gh-pages branch
102+
VERSION="${{ steps.package-version.outputs.version }}"
103+
cat > gh-pages/index.html <<EOF
104+
<!DOCTYPE html>
105+
<html>
106+
<head>
107+
<meta http-equiv="refresh" content="0; url=./docs/$VERSION/">
108+
<link rel="canonical" href="./docs/$VERSION/">
109+
</head>
110+
<body>
111+
<p>Redirecting to <a href="./docs/$VERSION/">documentation</a>...</p>
112+
</body>
113+
</html>
114+
EOF
115+
116+
- name: Commit and push to gh-pages
117+
run: |
118+
cd gh-pages
119+
git config user.name "github-actions[bot]"
120+
git config user.email "github-actions[bot]@users.noreply.github.com"
121+
122+
# Check if there are changes to commit
123+
if [ -n "$(git status --porcelain)" ]; then
124+
git add -A
125+
git commit -m "docs: Update documentation for version ${{ steps.package-version.outputs.version }} [skip ci]"
126+
git push origin gh-pages
127+
else
128+
echo "No changes to commit"
129+
fi
130+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ dist-deno
1212
.DS_Store
1313
coverage-objects
1414
object-coverage-report.json
15+
docs
16+
docs-markdown

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build && ./scripts/utils/git-swap.sh; fi",
2929
"tsn": "ts-node -r tsconfig-paths/register",
3030
"lint": "./scripts/lint",
31-
"fix": "./scripts/format"
31+
"fix": "./scripts/format",
32+
"docs:sdk": "typedoc --options typedoc.json",
33+
"docs:sdk:markdown": "typedoc --options typedoc.markdown.json"
3234
},
3335
"dependencies": {
3436
"@types/node": "^18.11.18",
@@ -42,6 +44,7 @@
4244
"zod": "^3.24.1"
4345
},
4446
"devDependencies": {
47+
"@shipgirl/typedoc-plugin-versions": "^0.3.2",
4548
"@swc/core": "^1.3.102",
4649
"@swc/jest": "^0.2.29",
4750
"@types/jest": "^29.4.0",
@@ -57,6 +60,9 @@
5760
"ts-node": "^10.5.0",
5861
"tsc-multi": "^1.1.0",
5962
"tsconfig-paths": "^4.0.0",
63+
"typedoc": "^0.28.14",
64+
"typedoc-material-theme": "^1.4.1",
65+
"typedoc-plugin-markdown": "^4.9.0",
6066
"typescript": "^4.8.2"
6167
},
6268
"sideEffects": [

scripts/build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ if [ -e ./scripts/build-deno ]
5454
then
5555
./scripts/build-deno
5656
fi
57+
58+
# Generate SDK documentation
59+
yarn docs:sdk

src/index.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -580,18 +580,16 @@ export {
580580

581581
export { RunloopSDK } from './sdk';
582582

583-
// /**
584-
// * @deprecated Use named imports instead of default import. This is the old api client. Use the new SDK instead.
585-
// * @example
586-
// * ```typescript
587-
// * // Instead of: import Runloop from '@runloop/api-client'
588-
// * import { RunloopSDK } from '@runloop/api-client'
589-
// * const sdk = new RunloopSDK();
590-
// * //For existing api client, use the api property
591-
// * const client = new RunloopSDK();
592-
// * const devbox = await client.api.devboxes.create({ name: 'my-devbox' });
593-
// * ```
594-
// */
595-
// This WILL be deprecated soon.. not yet though.
596-
583+
/**
584+
* @deprecated Use named imports instead of default import. This is the old api client. Use the new SDK instead.
585+
* @example
586+
* ```typescript
587+
* // Instead of: import Runloop from '@runloop/api-client'
588+
* import { RunloopSDK } from '@runloop/api-client'
589+
* const sdk = new RunloopSDK();
590+
* //For existing api client, use the api property
591+
* const client = new RunloopSDK();
592+
* const devbox = await client.api.devboxes.create({ name: 'my-devbox' });
593+
* ```
594+
*/
597595
export default Runloop;

src/sdk.ts

Lines changed: 88 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,99 @@
11
import { Runloop, type ClientOptions } from './index';
2-
import { Devbox } from './objects/devbox';
3-
import { Blueprint } from './objects/blueprint';
4-
import { Snapshot } from './objects/snapshot';
5-
import { StorageObject } from './objects/storage-object';
2+
import { Devbox } from './sdk/devbox';
3+
import { Blueprint } from './sdk/blueprint';
4+
import { Snapshot } from './sdk/snapshot';
5+
import { StorageObject } from './sdk/storage-object';
6+
import { Execution } from './sdk/execution';
7+
import { ExecutionResult } from './sdk/execution-result';
8+
9+
// Re-export SDK classes for documentation
10+
export { Devbox, Blueprint, Snapshot, StorageObject, Execution, ExecutionResult };
11+
12+
// Re-export types from core
613
import type * as Core from './core';
14+
export type { RequestOptions } from './core';
15+
16+
// Re-export types from lib
17+
import { PollingOptions } from './lib/polling';
18+
export { PollingOptions };
19+
20+
// Re-export types from resources/devboxes
721
import type {
822
DevboxCreateParams,
923
DevboxListDiskSnapshotsParams,
1024
DevboxListParams,
1125
DevboxView,
26+
DevboxAsyncExecutionDetailView,
27+
DevboxExecutionDetailView,
28+
DevboxSnapshotDiskParams,
29+
DevboxCreateTunnelParams,
30+
DevboxRemoveTunnelParams,
31+
DevboxReadFileContentsParams,
32+
DevboxWriteFileContentsParams,
33+
DevboxDownloadFileParams,
34+
DevboxUploadFileParams,
35+
DevboxExecuteParams,
36+
DevboxExecuteAsyncParams,
37+
DevboxSnapshotView,
38+
DevboxCreateSSHKeyResponse,
39+
DevboxTunnelView,
1240
} from './resources/devboxes/devboxes';
13-
import type { BlueprintCreateParams, BlueprintListParams } from './resources/blueprints';
14-
import type { ObjectCreateParams, ObjectListParams } from './resources/objects';
15-
import { PollingOptions } from './lib/polling';
41+
42+
export type {
43+
DevboxCreateParams,
44+
DevboxListDiskSnapshotsParams,
45+
DevboxListParams,
46+
DevboxView,
47+
DevboxAsyncExecutionDetailView,
48+
DevboxExecutionDetailView,
49+
DevboxSnapshotDiskParams,
50+
DevboxCreateTunnelParams,
51+
DevboxRemoveTunnelParams,
52+
DevboxReadFileContentsParams,
53+
DevboxWriteFileContentsParams,
54+
DevboxDownloadFileParams,
55+
DevboxUploadFileParams,
56+
DevboxExecuteParams,
57+
DevboxExecuteAsyncParams,
58+
DevboxSnapshotView,
59+
DevboxCreateSSHKeyResponse,
60+
DevboxTunnelView,
61+
};
62+
63+
// Re-export types from resources/devboxes/disk-snapshots
64+
import type {
65+
DevboxSnapshotAsyncStatusView,
66+
DiskSnapshotUpdateParams,
67+
} from './resources/devboxes/disk-snapshots';
68+
69+
export type { DevboxSnapshotAsyncStatusView, DiskSnapshotUpdateParams };
70+
71+
// Re-export types from resources/blueprints
72+
import type {
73+
BlueprintCreateParams,
74+
BlueprintListParams,
75+
BlueprintView,
76+
BlueprintBuildLogsListView,
77+
} from './resources/blueprints';
78+
79+
export type { BlueprintCreateParams, BlueprintListParams, BlueprintView, BlueprintBuildLogsListView };
80+
81+
// Re-export types from resources/objects
82+
import type {
83+
ObjectCreateParams,
84+
ObjectListParams,
85+
ObjectView,
86+
ObjectDownloadURLView,
87+
} from './resources/objects';
88+
89+
export type { ObjectCreateParams, ObjectListParams, ObjectView, ObjectDownloadURLView };
90+
91+
// Re-export ExecuteStreamingCallbacks from devbox
92+
export type { ExecuteStreamingCallbacks } from './sdk/devbox';
93+
94+
// Re-export Runloop and ClientOptions
95+
export { Runloop };
96+
export type { ClientOptions };
1697

1798
// Extract the content type from the API types
1899
type ContentType = ObjectCreateParams['content_type'];

0 commit comments

Comments
 (0)