MCPcopy Index your code
hub / github.com/remix-run/react-router / createFixtureProject

Function createFixtureProject

integration/helpers/create-fixture.ts:436–489  ·  view source on GitHub ↗
(
  init: FixtureInit = {},
  mode?: ServerMode,
)

Source from the content-addressed store, hash-verified

434////////////////////////////////////////////////////////////////////////////////
435
436export async function createFixtureProject(
437 init: FixtureInit = {},
438 mode?: ServerMode,
439): Promise<string> {
440 let templateName = init.templateName ?? defaultTemplateName;
441 let integrationTemplateDir = path.resolve(__dirname, templateName);
442 let projectName = `rr-${templateName}-${Math.random().toString(32).slice(2)}`;
443 let projectDir = path.join(TMP_DIR, projectName);
444 let port = init.port ?? (await getPort());
445
446 await mkdir(projectDir, { recursive: true });
447 await cp(integrationTemplateDir, projectDir, { recursive: true });
448
449 let hasViteConfig = Object.keys(init.files ?? {}).some((filename) =>
450 filename.startsWith("vite.config."),
451 );
452
453 let hasReactRouterConfig = Object.keys(init.files ?? {}).some((filename) =>
454 filename.startsWith("react-router.config."),
455 );
456
457 let { spaMode } = init;
458
459 await writeTestFiles(
460 {
461 ...(hasViteConfig
462 ? {}
463 : {
464 "vite.config.js": await viteConfig.basic({
465 port,
466 templateName,
467 }),
468 }),
469 ...(hasReactRouterConfig
470 ? {}
471 : {
472 "react-router.config.ts": reactRouterConfig({
473 ssr: !spaMode,
474 }),
475 }),
476 ...init.files,
477 },
478 projectDir,
479 );
480
481 reactRouterBuild(
482 projectDir,
483 init.buildStdio,
484 mode,
485 templateName.includes("rsc"),
486 );
487
488 return projectDir;
489}
490
491function reactRouterBuild(
492 projectDir: string,

Callers 2

fs-routes-test.tsFile · 0.85
createFixtureFunction · 0.85

Calls 3

writeTestFilesFunction · 0.85
reactRouterConfigFunction · 0.85
reactRouterBuildFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…