Skip to content

Commit 6cfe58e

Browse files
committed
small fixes
1 parent 2071cf0 commit 6cfe58e

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

packages/cli/src/commands/template/migrate.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,11 @@ export const migrateCommand = new commander.Command('migrate')
100100
`specify target language: ${Object.values(Language).join(', ')}`,
101101
(value) => {
102102
if (!Object.values(Language).includes(value as Language)) {
103-
console.error(
103+
throw new commander.InvalidArgumentError(
104104
`Invalid language. Must be one of: ${Object.values(Language).join(
105105
', '
106106
)}`
107107
)
108-
process.exit(1)
109108
}
110109
return value as Language
111110
}

packages/cli/src/templates/readme.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ cd {{templateDir}} && npx tsx {{buildProdFile}}
4747
# For development
4848
cd {{templateDir}} && python {{buildDevFile}}
4949

50-
# For production
50+
# For production
5151
cd {{templateDir}} && python {{buildProdFile}}
5252
```
5353
{{/if}}

packages/cli/tests/commands/template/init.test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { existsSync } from 'fs'
33
import * as fs from 'fs/promises'
44
import * as path from 'path'
55
import { afterEach, beforeEach, describe, expect, test } from 'vitest'
6+
import { Language } from '../../../src/commands/template/generators'
67

78
describe('Template Init', () => {
89
let testDir: string
@@ -20,10 +21,8 @@ describe('Template Init', () => {
2021
}
2122
})
2223

23-
const languages = ['typescript', 'python-sync', 'python-async'] as const
24-
2524
describe('CLI Options', () => {
26-
languages.forEach((language) => {
25+
Object.values(Language).forEach((language) => {
2726
test(`should generate files with --name and --language ${language}`, async () => {
2827
const templateName = 'my-test-template'
2928

@@ -199,7 +198,7 @@ describe('Template Init', () => {
199198
expect(templateContent).toContain("import { Template } from 'e2b'")
200199
expect(templateContent).toContain('export const template = Template()')
201200
expect(templateContent).toContain('fromImage')
202-
expect(templateContent).toContain('ubuntu:22.04')
201+
expect(templateContent).toContain('e2bdev/base')
203202
})
204203

205204
test('should generate correct Python template content', async () => {
@@ -219,7 +218,7 @@ describe('Template Init', () => {
219218
expect(templateContent).toContain('template = (')
220219
expect(templateContent).toContain('Template()')
221220
expect(templateContent).toContain('from_image')
222-
expect(templateContent).toContain('ubuntu:22.04')
221+
expect(templateContent).toContain('e2bdev/base')
223222
})
224223

225224
test('should generate correct async Python template content', async () => {

0 commit comments

Comments
 (0)