@@ -25,7 +25,7 @@ export type RunCreateLlamaOptions = {
25
25
dataSource : string ;
26
26
vectorDb : TemplateVectorDB ;
27
27
port : number ;
28
- externalPort : number ;
28
+ externalPort ? : number ;
29
29
postInstallAction : TemplatePostInstallAction ;
30
30
templateUI ?: TemplateUI ;
31
31
appType ?: AppType ;
@@ -93,8 +93,6 @@ export async function runCreateLlama({
93
93
"--use-pnpm" ,
94
94
"--port" ,
95
95
port ,
96
- "--external-port" ,
97
- externalPort ,
98
96
"--post-install-action" ,
99
97
postInstallAction ,
100
98
"--tools" ,
@@ -103,6 +101,10 @@ export async function runCreateLlama({
103
101
"none" ,
104
102
] ;
105
103
104
+ if ( externalPort ) {
105
+ commandArgs . push ( "--external-port" , externalPort ) ;
106
+ }
107
+
106
108
if ( templateUI ) {
107
109
commandArgs . push ( "--ui" , templateUI ) ;
108
110
}
@@ -142,12 +144,9 @@ export async function runCreateLlama({
142
144
143
145
// Wait for app to start
144
146
if ( postInstallAction === "runApp" ) {
145
- await checkAppHasStarted (
146
- appType === "--frontend" ,
147
- templateFramework ,
148
- port ,
149
- externalPort ,
150
- ) ;
147
+ const portsToWait = externalPort ? [ port , externalPort ] : [ port ] ;
148
+
149
+ await waitPorts ( portsToWait ) ;
151
150
} else if ( postInstallAction === "dependencies" ) {
152
151
await waitForProcess ( appProcess , 1000 * 60 ) ; // wait 1 min for dependencies to be resolved
153
152
} else {
@@ -167,19 +166,6 @@ export async function createTestDir() {
167
166
return cwd ;
168
167
}
169
168
170
- // eslint-disable-next-line max-params
171
- async function checkAppHasStarted (
172
- frontend : boolean ,
173
- framework : TemplateFramework ,
174
- port : number ,
175
- externalPort : number ,
176
- ) {
177
- const portsToWait = frontend
178
- ? [ port , externalPort ]
179
- : [ framework === "nextjs" ? port : externalPort ] ;
180
- await waitPorts ( portsToWait ) ;
181
- }
182
-
183
169
async function waitPorts ( ports : number [ ] ) : Promise < void > {
184
170
const waitForPort = async ( port : number ) : Promise < void > => {
185
171
await waitPort ( {
0 commit comments