MCPcopy
hub / github.com/remix-run/react-router / copyTemplateToTempDirStep

Function copyTemplateToTempDirStep

packages/create-react-router/index.ts:257–309  ·  view source on GitHub ↗
(ctx: Context)

Source from the content-addressed store, hash-verified

255}
256
257async function copyTemplateToTempDirStep(ctx: Context) {
258 if (ctx.template) {
259 log("");
260 info("Template:", ["Using ", color.reset(ctx.template), "..."]);
261 } else {
262 log("");
263 info("Using default template", [
264 "See https://github.com/remix-run/react-router-templates for more",
265 ]);
266 }
267
268 let template =
269 ctx.template ??
270 "https://github.com/remix-run/react-router-templates/tree/main/default";
271
272 await loadingIndicator({
273 start: "Template copying...",
274 end: "Template copied",
275 while: async () => {
276 await ensureDirectory(ctx.tempDir);
277 if (ctx.debug) {
278 debug(`Extracting to: ${ctx.tempDir}`);
279 }
280
281 let result = await copyTemplate(template, ctx.tempDir, {
282 debug: ctx.debug,
283 token: ctx.token,
284 async onError(err) {
285 error(
286 "Oh no!",
287 err instanceof CopyTemplateError
288 ? err.message
289 : "Something went wrong. Run `create-react-router --debug` to see more info.\n\n" +
290 "Open an issue to report the problem at " +
291 "https://github.com/remix-run/react-router/issues/new",
292 );
293 throw err;
294 },
295 async log(message) {
296 if (ctx.debug) {
297 debug(message);
298 await sleep(500);
299 }
300 },
301 });
302
303 if (result?.localTemplateDirectory) {
304 ctx.tempDir = path.resolve(result.localTemplateDirectory);
305 }
306 },
307 ctx,
308 });
309}
310
311async function agentSkillsQuestionStep(ctx: Context) {
312 if (ctx.agentSkills === undefined) {

Callers

nothing calls this directly

Calls 7

logFunction · 0.90
infoFunction · 0.90
ensureDirectoryFunction · 0.90
debugFunction · 0.90
copyTemplateFunction · 0.90
loadingIndicatorFunction · 0.85
resetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…