Skip to content

Commit

Permalink
feat(js-sdk,py-sdk): Rename rootDir/rootdir to cwd, add cwd option to…
Browse files Browse the repository at this point in the history
… Session (#165)

Co-authored-by: Jakub Novák <[email protected]>
  • Loading branch information
Strajk and jakubno authored Sep 27, 2023
1 parent 522079c commit e250a7b
Show file tree
Hide file tree
Showing 25 changed files with 185 additions and 314 deletions.
7 changes: 7 additions & 0 deletions .changeset/sixty-pugs-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@e2b/python-sdk': minor
'@e2b/sdk': minor
---

Renamed process.start argument rootDir to cwd
Added cwd option to Session creation
2 changes: 2 additions & 0 deletions .github/workflows/js_sdk_compat_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2

- name: Setup Node
uses: actions/setup-node@v3
with:
Expand Down
268 changes: 0 additions & 268 deletions apps/docs/src/app/old-page.mdx

This file was deleted.

2 changes: 1 addition & 1 deletion apps/docs/src/code/js/agents/clone_repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ console.log(content)
console.log('Installing deps...')
proc = await session.process.start({
cmd: 'npm install',
rootdir: '/code/open-react-template',
cwd: '/code/open-react-template',
onStdout: data => console.log(data.line),
onStderr: data => console.log(data.line),
})
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/code/js/agents/install_deps_npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const session = await Session.create({
console.log('Installing lodash...')
const proc = await session.process.start({
cmd: 'npm install lodash', // $HighlightLine
rootdir: '/code', // $HighlightLine
cwd: '/code', // $HighlightLine
onStdout: (data) => console.log('[INFO] ', data.line),
onStderr: (data) => console.log('[WARN | ERROR] ', data.line),
})
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/code/python/agents/clone_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ async def main():
cmd="npm install",
on_stdout=print_out,
on_stderr=print_out,
rootdir="/code/open-react-template"
cwd="/code/open-react-template"
)

await proc

await session.close()

asyncio.run(main())
asyncio.run(main())
2 changes: 1 addition & 1 deletion apps/docs/src/components/Code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function CodePanel({
await session.filesystem.write(filename, code)
session.process.start({
cmd: `${runtime} ${filename}`,
rootdir: '/code',
cwd: '/code',
onStdout: appendOutput,
onStderr: filterAndMaybeAppendOutput,
onExit: () => setIsRunning(false),
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/utils/useSessions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const useSessionsStore = create<SessionsStore>((set, get) => ({
cmd: preps[lang],
onStdout: stdHandler,
onStderr: stdHandler,
rootdir: '/code',
cwd: '/code',
})
await proc.finished // await prep process to finish
log(`${lang} session created and started`)
Expand Down
Loading

0 comments on commit e250a7b

Please sign in to comment.