Skip to content

Commit 82e1b93

Browse files
author
Yann VR
committed
Add sandbox testing and improve TTY error handling
- Add sandbox/ directory for testing (gitignored) - Fix TTY initialization errors in Nuxt creation - Add error handling to continue when app is created successfully - Successfully tested Nuxt + Nuxt UI app generation Testing shows Genesis creates working apps despite Nuxt CLI TTY issues.
1 parent b205753 commit 82e1b93

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,12 @@ go.work
277277
# Genesis binary
278278
genesis
279279

280+
# Distribution directory
281+
dist/
282+
283+
# Sandbox directory for testing
284+
sandbox/
285+
280286
# IDE files
281287
.vscode/
282288
.idea/

internal/generator/generator.go

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,41 @@ func (g *Generator) CreateApp(appName, description string) error {
8686
}
8787

8888
func (g *Generator) createNuxtApp(appName string) error {
89-
cmd := exec.Command("npx", "nuxi@latest", "init", appName)
89+
cmd := exec.Command("npx", "nuxi@latest", "init", appName, "--package-manager", "npm", "--git-init")
9090
cmd.Dir = g.outputDir
9191
cmd.Stdout = os.Stdout
9292
cmd.Stderr = os.Stderr
93-
return cmd.Run()
93+
94+
// Force non-interactive mode
95+
cmd.Env = append(os.Environ(),
96+
"CI=true",
97+
"NUXT_TELEMETRY_DISABLED=1",
98+
"NODE_ENV=production",
99+
)
100+
101+
err := cmd.Run()
102+
103+
// Check if the app directory was created successfully despite TTY errors
104+
appPath := filepath.Join(g.outputDir, appName)
105+
if _, statErr := os.Stat(filepath.Join(appPath, "package.json")); statErr == nil {
106+
// App was created successfully, ignore the TTY error
107+
return nil
108+
}
109+
110+
return err
94111
}
95112

96113
func (g *Generator) addNuxtUI(appPath string) error {
114+
// First install dependencies
115+
installCmd := exec.Command("npm", "install")
116+
installCmd.Dir = appPath
117+
installCmd.Stdout = os.Stdout
118+
installCmd.Stderr = os.Stderr
119+
if err := installCmd.Run(); err != nil {
120+
return fmt.Errorf("failed to install dependencies: %w", err)
121+
}
122+
123+
// Then add Nuxt UI module
97124
cmd := exec.Command("npx", "nuxi@latest", "module", "add", "ui")
98125
cmd.Dir = appPath
99126
cmd.Stdout = os.Stdout

0 commit comments

Comments
 (0)