Skip to content

Commit 7867a28

Browse files
committed
fix: always publish plugins to avoid broken states
1 parent 985479f commit 7867a28

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

cli/src/commands/demo/command.ts

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,27 @@ async function handleStep2(
184184
return handleStep2(opts, { onboarding, userInfo, supportDir, signal, logPath });
185185
}
186186

187+
async function publishPlugins() {
188+
console.log(`\nPublishing plugins… ${pc.dim(`(logs: ${logPath})`)}`);
189+
190+
const publishResult = await publishAllPlugins({
191+
client: opts.client,
192+
supportDir,
193+
signal,
194+
logPath,
195+
});
196+
197+
if (publishResult.error) {
198+
await waitForKeyPress(
199+
{
200+
r: retryFn,
201+
R: retryFn,
202+
},
203+
'Hit [r] to retry. CTRL+C to quit.',
204+
);
205+
}
206+
}
207+
187208
const graphData = await handleGetFederatedGraphResponse(opts.client, {
188209
onboarding,
189210
userInfo,
@@ -212,6 +233,7 @@ async function handleStep2(
212233
console.log(pc.yellow('\nPlease restart the demo command to continue.\n'));
213234
process.exit(0);
214235
}
236+
await publishPlugins();
215237
return { routingUrl: graph.routingURL };
216238
}
217239

@@ -223,24 +245,7 @@ async function handleStep2(
223245
const routingUrl = new URL('graphql', 'http://localhost');
224246
routingUrl.port = String(config.demoRouterPort);
225247

226-
console.log(`\nPublishing plugins… ${pc.dim(`(logs: ${logPath})`)}`);
227-
228-
const publishResult = await publishAllPlugins({
229-
client: opts.client,
230-
supportDir,
231-
signal,
232-
logPath,
233-
});
234-
235-
if (publishResult.error) {
236-
await waitForKeyPress(
237-
{
238-
r: retryFn,
239-
R: retryFn,
240-
},
241-
'Hit [r] to retry. CTRL+C to quit.',
242-
);
243-
}
248+
await publishPlugins();
244249

245250
return { routingUrl: routingUrl.toString() };
246251
}

0 commit comments

Comments
 (0)