Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Build System v2 Introduction (#957)

Jakub Dobryc05c8c6f2478
diff --git a/.changeset/silly-rockets-cheer.md b/.changeset/silly-rockets-cheer.md
new file mode 100644
index 000000000..cf93236be
--- /dev/null
+++ b/.changeset/silly-rockets-cheer.md
@@ -0,0 +1,7 @@
+---
+'@e2b/python-sdk': minor
+'e2b': minor
+'@e2b/cli': minor
+---
+
+new build system v2 release
diff --git a/packages/cli/src/commands/template/build.ts b/packages/cli/src/commands/template/build.ts
index 41de1765e..69130ae3d 100644
--- a/packages/cli/src/commands/template/build.ts
+++ b/packages/cli/src/commands/template/build.ts
@@ -198,6 +198,33 @@ export const buildCommand = new commander.Command('build')
}
) => {
try {
+ // Display deprecation warning
+ const deprecationMessage = `${asBold('DEPRECATION WARNING')}
+
+This is the v1 build system which is now deprecated.
+Please migrate to the new build system v2.
+
+Migration guide: ${asPrimary('https://e2b.dev/docs/template/migration-v2')}`
+
+ const deprecationWarning = boxen.default(deprecationMessage, {
+ padding: {
+ bottom: 0,
+ top: 0,
+ left: 2,
+ right: 2,
+ },
+ margin: {
+ top: 1,
+ bottom: 1,
+ left: 0,
+ right: 0,
+ },
+ borderColor: 'yellow',
+ borderStyle: 'round',
+ })
+
+ console.log(deprecationWarning)
+
const dockerInstalled = commandExists.sync('docker')
if (!dockerInstalled) {
console.error(
diff --git a/packages/cli/src/commands/template/build-v2.ts b/packages/cli/src/commands/template/create.ts
similarity index 98%
rename from packages/cli/src/commands/template/build-v2.ts
rename to packages/cli/src/commands/template/create.ts
index e2d9b4f8a..2480b87ea 100644
--- a/packages/cli/src/commands/template/build-v2.ts
+++ b/packages/cli/src/commands/template/create.ts
@@ -19,7 +19,7 @@ import {
} from '../../utils/format'
import { getDockerfile } from './build'
-export const buildV2Command = new commander.Command('build-v2')
+export const createCommand = new commander.Command('create')
.description(
'build Dockerfile as a Sandbox template. This command reads a Dockerfile and builds it directly.'
)
@@ -53,7 +53,7 @@ export const buildV2Command = new commander.Command('build-v2')
parseInt
)
.option('--no-cache', 'skip cache when building the template.')
- .alias('bd-v2')
+ .alias('ct')
.action(
async (
templateName: string,
diff --git a/packages/cli/src/commands/template/index.ts b/packages/cli/src/commands/template/index.ts
index 9568a0070..fc8d336f2 100644
--- a/packages/cli/src/commands/template/index.ts
+++ b/packages/cli/src/commands/template/index.ts
@@ -1,22 +1,20 @@
import * as commander from 'commander'
+import { createCommand } from './create'
import { buildCommand } from './build'
-import { listCommand } from './list'
-import { initCommand } from './init'
import { deleteCommand } from './delete'
-import { publishCommand, unPublishCommand } from './publish'
+import { initCommand } from './init'
+import { listCommand } from './list'
import { migrateCommand } from './migrate'
-import { initV2Command } from './init-v2'
-import { buildV2Command } from './build-v2'
+import { publishCommand, unPublishCommand } from './publish'
export const templateCommand = new commander.Command('template')
.description('manage sandbox templates')
.alias('tpl')
- .addCommand(buildCommand)
- .addCommand(buildV2Command)
+ .addCommand(createCommand)
+ .addCommand(buildCommand, { hidden: true })
.addCommand(listCommand)
.addCommand(initCommand)
- .addCommand(initV2Command)
.addCommand(deleteCommand)
.addCommand(publishCommand)
.addCommand(unPublishCommand)
diff --git a/packages/cli/src/commands/template/init-v2.ts b/packages/cli/src/commands/template/init-v2.ts
deleted file mode 100644
index 139fac366..000000000
--- a/packages/cli/src/commands/template/init-v2.ts
+++ /dev/null
@@ -1,326 +0,0 @@
-import { input, select } from '@inquirer/prompts'
-import PackageJson from '@npmcli/package-json'
-import * as commander from 'commander'
-import { Template } from 'e2b'
-import * as fs from 'fs'
-import * as path from 'path'
-import { pathOption } from 'src/options'
-import { getRoot } from 'src/utils/filesystem'
-import { asPrimary } from 'src/utils/format'
-import {
- generateAndWriteTemplateFiles,
- GeneratedFiles,
- Language,
- languageDisplay,
-} from './generators'
-import { generateReadmeContent } from './generators/handlebars'
-
-const DEFAULT_TEMPLATE_NAME = 'my-template'
-
-/**
- * Generate template files using shared template generation logic
- */
-async function generateTemplateFiles(
- root: string,
- alias: string,
- language: Language,
- cpuCount?: number,
- memoryMB?: number
-): Promise<GeneratedFiles> {
- const template = Template().fromBaseImage().runCmd('echo Hello World E2B!')
-
- return generateAndWriteTemplateFiles(
- root,
- alias,
- language,
- template,
- cpuCount,
- memoryMB
- )
-}
-
-/**
- * Add build scripts to Makefile if it exists or create a new one
- */
-async function addMakefileScripts(
- root: string,
- files: GeneratedFiles,
- templateDirName: string
-): Promise<void> {
- try {
- const makefileName = 'Makefile'
- const makefileExists = fs.existsSync(path.join(root, makefileName))
-
- let cdPrefix = ''
- if (makefileExists) {
- cdPrefix = `cd ${templateDirName} && `
- }
-
- const makefileContent = `
-.PHONY: e2b:build:dev
-e2b:build:dev:
-\t${cdPrefix}python ${files.buildDevFile}
-
-.PHONY: e2b:build:prod
-e2b:build:prod:
-\t${cdPrefix}python ${files.buildProdFile}
-`
-
- if (makefileExists) {
- const makefilePath = path.join(root, makefileName)
- await fs.promises.appendFile(makefilePath, '\n' + makefileContent, 'utf8')
- } else {
- // Create a basic Makefile if it doesn't exist
- const makefilePath = path.join(root, templateDirName, makefileName)
- await fs.promises.writeFile(makefilePath, makefileContent, 'utf8')
- }
-
- console.log('\n๐Ÿ“ Added build scripts to Makefile:')
- console.log(
- ` ${asPrimary('make e2b:build:dev')} - Build development template`
- )
- console.log(
- ` ${asPrimary('make e2b:build:prod')} - Build production template`
- )
- } catch (err) {
- console.warn(
- '\nโš ๏ธ Could not add scripts to Makefile:',
- err instanceof Error ? err.message : err
- )
- }
-}
-
-/**
- * Add build scripts to package.json if it exists or create a new one
- */
-async function addPackageJsonScripts(
- root: string,
- files: GeneratedFiles,
- templateDirName: string
-): Promise<void> {
- try {
- let cdPrefix = ''
- let pkgJson: PackageJson
- try {
- // The library expects the directory path, not the full file path
- pkgJson = await PackageJson.load(root)
- cdPrefix = `cd ${templateDirName} && `
- } catch (error) {
- // Handle the case where package.json does not exist
- const createRoot = path.join(root, templateDirName)
- pkgJson = await PackageJson.create(createRoot)
- }
-
- pkgJson.update({
- scripts: {
- ...pkgJson.content.scripts,
- 'e2b:build:dev': `${cdPrefix}npx tsx ${files.buildDevFile}`,
- 'e2b:build:prod': `${cdPrefix}npx tsx ${files.buildProdFile}`,
- },
- })
-
- // Save the changes
- await pkgJson.save()
-
- console.log('\n๐Ÿ“ Added build scripts to package.json:')
- console.log(
- ` ${asPrimary('npm run e2b:build:dev')} - Build development template`
- )
- console.log(
- ` ${asPrimary('npm run e2b:build:prod')} - Build production template`
- )
- } catch (err) {
- console.warn(
- '\nโš ๏ธ Could not add scripts to package.json:',
- err instanceof Error ? err.message : err
- )
- }
-}
-
-/**
- * Check template name format
- */
-function templateNameRegex(name: string): boolean {
- return /^[a-z0-9][a-z0-9_-]*[a-z0-9]$|^[a-z0-9]$/.test(name)
-}
-
-function validateTemplateName(name: string) {
- if (!name || name.trim().length === 0) {
- throw new Error('Template name cannot be empty')
- }
- if (!templateNameRegex(name.trim())) {
- throw new Error(
- 'Template name must contain only lowercase letters, numbers, hyphens, and underscores, and cannot start or end with a hyphen or underscore'
- )
- }
-}
-
-export const initV2Command = new commander.Command('init-v2')
- .description('initialize a new sandbox template using the SDK')
- .addOption(pathOption)
- .option('-n, --name <name>', 'template name (alias)', (value) => {
- try {
- validateTemplateName(value)
- } catch (err) {
- throw new commander.InvalidArgumentError(
- err instanceof Error ? err.message : String(err)
- )
- }
-
- return value
- })
- .option(
- '-l, --language <language>',
- `target language: ${Object.values(Language).join(', ')}`,
- (value) => {
- if (!Object.values(Language).includes(value as Language)) {
- throw new commander.InvalidArgumentError(
- `Invalid language. Must be one of: ${Object.values(Language).join(
- ', '
- )}`
- )
- }
- return value as Language
- }
- )
- .alias('it-v2')
- .alias('create')
- .action(
- async (opts: { path?: string; name?: string; language?: Language }) => {
- try {
- process.stdout.write('\n')
-
- const root = getRoot(opts.path)
-
- console.log('๐Ÿš€ Initializing Sandbox Template...\n')
-
- // Step 1: Get template name (from CLI or prompt)
- let templateName: string = opts.name ?? DEFAULT_TEMPLATE_NAME
- if (opts.name === undefined) {
- templateName = await input({
- message: 'Enter template name (alias):',
- default: DEFAULT_TEMPLATE_NAME,
- validate: (input: string) => {
- try {
- validateTemplateName(input)
- } catch (err) {
- return err instanceof Error ? err.message : err
- }
-
- return true
- },
- })
- }
- templateName = templateName.trim()
- console.log(`Using template name: ${templateName}`)
-
- // Step 2: Get language (from CLI or prompt)
- let language: Language
- if (opts.language) {
- language = opts.language
- console.log(`Using language: ${languageDisplay[language]}`)
- } else {
- language = await select({
- message: 'Select target language for template files:',
- choices: [
- {
- name: languageDisplay[Language.TypeScript],
- value: Language.TypeScript,
- description:
- 'Generate .ts files for JavaScript/TypeScript projects',
- },
- {
- name: languageDisplay[Language.PythonSync],
- value: Language.PythonSync,
- description: 'Generate synchronous Python template files',
- },
- {
- name: languageDisplay[Language.PythonAsync],
- value: Language.PythonAsync,
- description: 'Generate asynchronous Python template files',
- },
- ],
- default: Language.TypeScript,
- })
- }
-
- // Step 3: Create template directory - fail if it already exists
- const templateDirName = templateName
- const templateDir = path.join(root, templateDirName)
-
- if (fs.existsSync(templateDir)) {
- throw new Error(
- `Directory '${templateDirName}' already exists. Please choose a different template name or remove the existing directory.`
- )
- }
-
- await fs.promises.mkdir(templateDir, { recursive: true })
-
- // Step 4: Generate template and build files in the template directory
- const generatedFiles = await generateTemplateFiles(
- templateDir,
- templateName,
- language
- )
-
- // Step 5: Add scripts
- switch (language) {
- case Language.TypeScript:
- await addPackageJsonScripts(root, generatedFiles, templateDirName)
- break
- case Language.PythonAsync:
- case Language.PythonSync:
- await addMakefileScripts(root, generatedFiles, templateDirName)
- break
- default:
- throw new Error('Unsupported language for scripts')
- }
-
- // Step 6: Create README.md
- const readmeContent = await generateReadmeContent(
- templateName,
- templateDirName,
- generatedFiles
- )
- const readmeFilePath = path.join(templateDir, 'README.md')
- await fs.promises.writeFile(readmeFilePath, readmeContent, 'utf8')
-
- console.log('\n๐ŸŽ‰ Template initialized successfully!')
- console.log(
- `\nTemplate created in: ${asPrimary(`./${templateDirName}/`)}`
- )
- console.log('\nYou can now build your template using:')
-
- switch (language) {
- case Language.TypeScript:
- console.log(
- ` ${asPrimary('npm run e2b:build:dev')} (for development)`
- )
- console.log(
- ` ${asPrimary('npm run e2b:build:prod')} (for production)`
- )
- break
- case Language.PythonAsync:
- case Language.PythonSync:
- console.log(
- ` ${asPrimary('make e2b:build:dev')} (for development)`
- )
- console.log(
- ` ${asPrimary('make e2b:build:prod')} (for production)`
- )
- break
- default:
- throw new Error('Unsupported language for instructions')
- }
-
- console.log(
- `\nLearn more about Sandbox Templates: ${asPrimary(
- 'https://e2b.dev/docs'
- )}\n`
- )
- } catch (err: any) {
- console.error(err)
- process.exit(1)
- }
- }
- )
diff --git a/packages/cli/src/commands/template/init.ts b/packages/cli/src/commands/template/init.ts
index e4a9f8f1c..c534d7ca2 100644
--- a/packages/cli/src/commands/template/init.ts
+++ b/packages/cli/src/commands/template/init.ts
@@ -1,48 +1,325 @@
+import { input, select } from '@inquirer/prompts'
+import PackageJson from '@npmcli/package-json'
import * as commander from 'commander'
-import * as fsPromises from 'fs/promises'
+import { Template } from 'e2b'
import * as fs from 'fs'
import * as path from 'path'
-
-import { basicDockerfile, defaultDockerfileName } from 'src/docker/constants'
import { pathOption } from 'src/options'
import { getRoot } from 'src/utils/filesystem'
-import { asLocalRelative, asPrimary } from 'src/utils/format'
+import { asPrimary } from 'src/utils/format'
+import {
+ generateAndWriteTemplateFiles,
+ GeneratedFiles,
+ Language,
+ languageDisplay,
+} from './generators'
+import { generateReadmeContent } from './generators/handlebars'
-export const initCommand = new commander.Command('init')
- .description(
- `create basic E2B Dockerfile (${asLocalRelative(
- 'e2b.Dockerfile'
- )}) in root directory. You can then run ${asPrimary(
- 'e2b template build'
- )} to build sandbox template from this Dockerfile`
+const DEFAULT_TEMPLATE_NAME = 'my-template'
+
+/**
+ * Generate template files using shared template generation logic
+ */
+async function generateTemplateFiles(
+ root: string,
+ alias: string,
+ language: Language,
+ cpuCount?: number,
+ memoryMB?: number
+): Promise<GeneratedFiles> {
+ const template = Template().fromBaseImage().runCmd('echo Hello World E2B!')
+
+ return generateAndWriteTemplateFiles(
+ root,
+ alias,
+ language,
+ template,
+ cpuCount,
+ memoryMB
)
+}
+
+/**
+ * Add build scripts to Makefile if it exists or create a new one
+ */
+async function addMakefileScripts(
+ root: string,
+ files: GeneratedFiles,
+ templateDirName: string
+): Promise<void> {
+ try {
+ const makefileName = 'Makefile'
+ const makefileExists = fs.existsSync(path.join(root, makefileName))
+
+ let cdPrefix = ''
+ if (makefileExists) {
+ cdPrefix = `cd ${templateDirName} && `
+ }
+
+ const makefileContent = `
+.PHONY: e2b:build:dev
+e2b:build:dev:
+\t${cdPrefix}python ${files.buildDevFile}
+
+.PHONY: e2b:build:prod
+e2b:build:prod:
+\t${cdPrefix}python ${files.buildProdFile}
+`
+
+ if (makefileExists) {
+ const makefilePath = path.join(root, makefileName)
+ await fs.promises.appendFile(makefilePath, '\n' + makefileContent, 'utf8')
+ } else {
+ // Create a basic Makefile if it doesn't exist
+ const makefilePath = path.join(root, templateDirName, makefileName)
+ await fs.promises.writeFile(makefilePath, makefileContent, 'utf8')
+ }
+
+ console.log('\n๐Ÿ“ Added build scripts to Makefile:')
+ console.log(
+ ` ${asPrimary('make e2b:build:dev')} - Build development template`
+ )
+ console.log(
+ ` ${asPrimary('make e2b:build:prod')} - Build production template`
+ )
+ } catch (err) {
+ console.warn(
+ '\nโš ๏ธ Could not add scripts to Makefile:',
+ err instanceof Error ? err.message : err
+ )
+ }
+}
+
+/**
+ * Add build scripts to package.json if it exists or create a new one
+ */
+async function addPackageJsonScripts(
+ root: string,
+ files: GeneratedFiles,
+ templateDirName: string
+): Promise<void> {
+ try {
+ let cdPrefix = ''
+ let pkgJson: PackageJson
+ try {
+ // The library expects the directory path, not the full file path
+ pkgJson = await PackageJson.load(root)
+ cdPrefix = `cd ${templateDirName} && `
+ } catch (error) {
+ // Handle the case where package.json does not exist
+ const createRoot = path.join(root, templateDirName)
+ pkgJson = await PackageJson.create(createRoot)
+ }
+
+ pkgJson.update({
+ scripts: {
+ ...pkgJson.content.scripts,
+ 'e2b:build:dev': `${cdPrefix}npx tsx ${files.buildDevFile}`,
+ 'e2b:build:prod': `${cdPrefix}npx tsx ${files.buildProdFile}`,
+ },
+ })
+
+ // Save the changes
+ await pkgJson.save()
+
+ console.log('\n๐Ÿ“ Added build scripts to package.json:')
+ console.log(
+ ` ${asPrimary('npm run e2b:build:dev')} - Build development template`
+ )
+ console.log(
+ ` ${asPrimary('npm run e2b:build:prod')} - Build production template`
+ )
+ } catch (err) {
+ console.warn(
+ '\nโš ๏ธ Could not add scripts to package.json:',
+ err instanceof Error ? err.message : err
+ )
+ }
+}
+
+/**
+ * Check template name format
+ */
+function templateNameRegex(name: string): boolean {
+ return /^[a-z0-9][a-z0-9_-]*[a-z0-9]$|^[a-z0-9]$/.test(name)
+}
+
+function validateTemplateName(name: string) {
+ if (!name || name.trim().length === 0) {
+ throw new Error('Template name cannot be empty')
+ }
+ if (!templateNameRegex(name.trim())) {
+ throw new Error(
+ 'Template name must contain only lowercase letters, numbers, hyphens, and underscores, and cannot start or end with a hyphen or underscore'
+ )
+ }
+}
+
+export const initCommand = new commander.Command('init')
+ .description('initialize a new sandbox template using the SDK')
.addOption(pathOption)
- .alias('it')
- .action(async (opts: { path?: string }) => {
+ .option('-n, --name <name>', 'template name (alias)', (value) => {
try {
- process.stdout.write('\n')
+ validateTemplateName(value)
+ } catch (err) {
+ throw new commander.InvalidArgumentError(
+ err instanceof Error ? err.message : String(err)
+ )
+ }
- const root = getRoot(opts.path)
- const filepath = path.join(root, defaultDockerfileName)
+ return value
+ })
+ .option(
+ '-l, --language <language>',
+ `target language: ${Object.values(Language).join(', ')}`,
+ (value) => {
+ if (!Object.values(Language).includes(value as Language)) {
+ throw new commander.InvalidArgumentError(
+ `Invalid language. Must be one of: ${Object.values(Language).join(
+ ', '
+ )}`
+ )
+ }
+ return value as Language
+ }
+ )
+ .alias('it')
+ .action(
+ async (opts: { path?: string; name?: string; language?: Language }) => {
+ try {
+ process.stdout.write('\n')
+
+ const root = getRoot(opts.path)
+
+ console.log('๐Ÿš€ Initializing Sandbox Template...\n')
+
+ // Step 1: Get template name (from CLI or prompt)
+ let templateName: string = opts.name ?? DEFAULT_TEMPLATE_NAME
+ if (opts.name === undefined) {
+ templateName = await input({
+ message: 'Enter template name (alias):',
+ default: DEFAULT_TEMPLATE_NAME,
+ validate: (input: string) => {
+ try {
+ validateTemplateName(input)
+ } catch (err) {
+ return err instanceof Error ? err.message : err
+ }
+
+ return true
+ },
+ })
+ }
+ templateName = templateName.trim()
+ console.log(`Using template name: ${templateName}`)
+
+ // Step 2: Get language (from CLI or prompt)
+ let language: Language
+ if (opts.language) {
+ language = opts.language
+ console.log(`Using language: ${languageDisplay[language]}`)
+ } else {
+ language = await select({
+ message: 'Select target language for template files:',
+ choices: [
+ {
+ name: languageDisplay[Language.TypeScript],
+ value: Language.TypeScript,
+ description:
+ 'Generate .ts files for JavaScript/TypeScript projects',
+ },
+ {
+ name: languageDisplay[Language.PythonSync],
+ value: Language.PythonSync,
+ description: 'Generate synchronous Python template files',
+ },
+ {
+ name: languageDisplay[Language.PythonAsync],
+ value: Language.PythonAsync,
+ description: 'Generate asynchronous Python template files',
+ },
+ ],
+ default: Language.TypeScript,
+ })
+ }
+
+ // Step 3: Create template directory - fail if it already exists
+ const templateDirName = templateName
+ const templateDir = path.join(root, templateDirName)
- const fileExists = fs.existsSync(filepath)
+ if (fs.existsSync(templateDir)) {
+ throw new Error(
+ `Directory '${templateDirName}' already exists. Please choose a different template name or remove the existing directory.`
+ )
+ }
- const relativePath = opts.path
- ? path.join(opts.path, defaultDockerfileName)
- : defaultDockerfileName
+ await fs.promises.mkdir(templateDir, { recursive: true })
- if (fileExists) {
+ // Step 4: Generate template and build files in the template directory
+ const generatedFiles = await generateTemplateFiles(
+ templateDir,
+ templateName,
+ language
+ )
+
+ // Step 5: Add scripts
+ switch (language) {
+ case Language.TypeScript:
+ await addPackageJsonScripts(root, generatedFiles, templateDirName)
+ break
+ case Language.PythonAsync:
+ case Language.PythonSync:
+ await addMakefileScripts(root, generatedFiles, templateDirName)
+ break
+ default:
+ throw new Error('Unsupported language for scripts')
+ }
+
+ // Step 6: Create README.md
+ const readmeContent = await generateReadmeContent(
+ templateName,
+ templateDirName,
+ generatedFiles
+ )
+ const readmeFilePath = path.join(templateDir, 'README.md')
+ await fs.promises.writeFile(readmeFilePath, readmeContent, 'utf8')
+
+ console.log('\n๐ŸŽ‰ Template initialized successfully!')
console.log(
- `Dockerfile ${asLocalRelative(relativePath)} already exists.\n`
+ `\nTemplate created in: ${asPrimary(`./${templateDirName}/`)}`
)
- return
- }
+ console.log('\nYou can now build your template using:')
- await fsPromises.writeFile(filepath, basicDockerfile)
+ switch (language) {
+ case Language.TypeScript:
+ console.log(
+ ` ${asPrimary('npm run e2b:build:dev')} (for development)`
+ )
+ console.log(
+ ` ${asPrimary('npm run e2b:build:prod')} (for production)`
+ )
+ break
+ case Language.PythonAsync:
+ case Language.PythonSync:
+ console.log(
+ ` ${asPrimary('make e2b:build:dev')} (for development)`
+ )
+ console.log(
+ ` ${asPrimary('make e2b:build:prod')} (for production)`
+ )
+ break
+ default:
+ throw new Error('Unsupported language for instructions')
+ }
- console.log(`Created ${asLocalRelative(relativePath)}\n`)
- } catch (err: any) {
- console.error(err)
- process.exit(1)
+ console.log(
+ `\nLearn more about Sandbox Templates: ${asPrimary(
+ 'https://e2b.dev/docs'
+ )}\n`
+ )
+ } catch (err: any) {
+ console.error(err)
+ process.exit(1)
+ }
}
- })
+ )
diff --git a/packages/cli/tests/commands/template/init.test.ts b/packages/cli/tests/commands/template/init.test.ts
index 020c90195..7f3222f5d 100644
--- a/packages/cli/tests/commands/template/init.test.ts
+++ b/packages/cli/tests/commands/template/init.test.ts
@@ -28,7 +28,7 @@ describe('Template Init', () => {
// Run init command with CLI options
execSync(
- `node "${cliPath}" template init-v2 --name "${templateName}" --language "${language}" --path "${testDir}"`,
+ `node "${cliPath}" template init --name "${templateName}" --language "${language}" --path "${testDir}"`,
{ stdio: 'inherit' }
)
@@ -71,7 +71,7 @@ describe('Template Init', () => {
for (const invalidName of invalidNames) {
expect(() => {
execSync(
- `node "${cliPath}" template init-v2 --name "${invalidName}" --language "typescript" --path "${testDir}"`,
+ `node "${cliPath}" template init --name "${invalidName}" --language "typescript" --path "${testDir}"`,
{ stdio: 'pipe' }
)
}).toThrow()
@@ -81,7 +81,7 @@ describe('Template Init', () => {
test('should validate language parameter', async () => {
expect(() => {
execSync(
- `node "${cliPath}" template init-v2 --name "test" --language "invalid-lang" --path "${testDir}"`,
+ `node "${cliPath}" template init --name "test" --language "invalid-lang" --path "${testDir}"`,
{ stdio: 'pipe' }
)
}).toThrow()
@@ -113,7 +113,7 @@ describe('Template Init', () => {
// Should not throw
execSync(
- `node "${cliPath}" template init-v2 --name "${validName}" --language "typescript" --path "${testDir}"`,
+ `node "${cliPath}" template init --name "${validName}" --language "typescript" --path "${testDir}"`,
{ stdio: 'pipe' }
)
@@ -145,7 +145,7 @@ describe('Template Init', () => {
// Run init command
execSync(
- `node "${cliPath}" template init-v2 --name "test-template" --language "typescript" --path "${testDir}"`,
+ `node "${cliPath}" template init --name "test-template" --language "typescript" --path "${testDir}"`,
{ stdio: 'inherit' }
)
@@ -162,7 +162,7 @@ describe('Template Init', () => {
test('should work without package.json', async () => {
// Run init command without package.json
execSync(
- `node "${cliPath}" template init-v2 --name "test-template" --language "typescript" --path "${testDir}"`,
+ `node "${cliPath}" template init --name "test-template" --language "typescript" --path "${testDir}"`,
{ stdio: 'inherit' }
)
@@ -199,7 +199,7 @@ build/%:
// Run init command
execSync(
- `node "${cliPath}" template init-v2 --name "test-template" --language "python-sync" --path "${testDir}"`,
+ `node "${cliPath}" template init --name "test-template" --language "python-sync" --path "${testDir}"`,
{ stdio: 'inherit' }
)
@@ -216,7 +216,7 @@ build/%:
test('should work without Makefile', async () => {
// Run init command without Makefile
execSync(
- `node "${cliPath}" template init-v2 --name "test-template" --language "python-sync" --path "${testDir}"`,
+ `node "${cliPath}" template init --name "test-template" --language "python-sync" --path "${testDir}"`,
{ stdio: 'inherit' }
)
@@ -243,7 +243,7 @@ build/%:
describe('File Content Validation', () => {
test('should generate correct TypeScript template content', async () => {
execSync(
- `node "${cliPath}" template init-v2 --name "test-ts" --language "typescript" --path "${testDir}"`,
+ `node "${cliPath}" template init --name "test-ts" --language "typescript" --path "${testDir}"`,
{ stdio: 'inherit' }
)
@@ -262,7 +262,7 @@ build/%:
test('should generate correct Python template content', async () => {
execSync(
- `node "${cliPath}" template init-v2 --name "test-py" --language "python-sync" --path "${testDir}"`,
+ `node "${cliPath}" template init --name "test-py" --language "python-sync" --path "${testDir}"`,
{ stdio: 'inherit' }
)
@@ -282,7 +282,7 @@ build/%:
test('should generate correct async Python template content', async () => {
execSync(
- `node "${cliPath}" template init-v2 --name "test-py-async" --language "python-async" --path "${testDir}"`,
+ `node "${cliPath}" template init --name "test-py-async" --language "python-async" --path "${testDir}"`,
{ stdio: 'inherit' }
)
@@ -310,7 +310,7 @@ build/%:
// Should fail when trying to create template with existing directory name
expect(() => {
execSync(
- `node "${cliPath}" template init-v2 --name "test" --language "typescript" --path "${testDir}"`,
+ `node "${cliPath}" template init --name "test" --language "typescript" --path "${testDir}"`,
{ stdio: 'pipe' }
)
}).toThrow()