Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Fix CLI template migrate copy target (#915)

Jakub Dobryb43793ceb9e0
diff --git a/.changeset/thirty-birds-serve.md b/.changeset/thirty-birds-serve.md
new file mode 100644
index 000000000..18c3b7ffa
--- /dev/null
+++ b/.changeset/thirty-birds-serve.md
@@ -0,0 +1,5 @@
+---
+'@e2b/cli': patch
+---
+
+fix template migrate copy target path
diff --git a/packages/cli/src/commands/template/generators/handlebars.ts b/packages/cli/src/commands/template/generators/handlebars.ts
index b7a2ddf9d..ce1b18dcd 100644
--- a/packages/cli/src/commands/template/generators/handlebars.ts
+++ b/packages/cli/src/commands/template/generators/handlebars.ts
@@ -72,7 +72,7 @@ export async function transformTemplateData(
case 'COPY': {
if (step.args.length >= 2) {
const src = step.args[0]
- let dest = step.args[step.args.length - 1]
+ let dest = step.args[1]
if (!dest || dest === '') {
dest = '.'
}
diff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/template.py b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/template.py
index a590649b8..61e8fc604 100644
--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/template.py
+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/template.py
@@ -3,7 +3,7 @@ from e2b import AsyncTemplate
template = (
AsyncTemplate()
.from_image("alpine:latest")
- .copy("package.json", ".")
- .copy("src/index.js", ".")
- .copy("config.json", ".")
+ .copy("package.json", "/app/")
+ .copy("src/index.js", "./src/")
+ .copy("config.json", "/etc/app/config.json")
)
\ No newline at end of file
diff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/template.py b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/template.py
index c3fae6c00..83a3694c3 100644
--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/template.py
+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/template.py
@@ -3,7 +3,7 @@ from e2b import Template
template = (
Template()
.from_image("alpine:latest")
- .copy("package.json", ".")
- .copy("src/index.js", ".")
- .copy("config.json", ".")
+ .copy("package.json", "/app/")
+ .copy("src/index.js", "./src/")
+ .copy("config.json", "/etc/app/config.json")
)
\ No newline at end of file
diff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/template.ts b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/template.ts
index 53557e163..a4fffac47 100644
--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/template.ts
+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/template.ts
@@ -2,6 +2,6 @@ import { Template } from 'e2b'
export const template = Template()
.fromImage('alpine:latest')
- .copy('package.json', '.')
- .copy('src/index.js', '.')
- .copy('config.json', '.')
\ No newline at end of file
+ .copy('package.json', '/app/')
+ .copy('src/index.js', './src/')
+ .copy('config.json', '/etc/app/config.json')