Skip to content

Commit

Permalink
Rename routes option adapter function
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish committed Oct 18, 2024
1 parent 7b9806f commit 210d09e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions docs/start/future-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -537,16 +537,16 @@ npm install --dev @remix-run/routes-option-adapter

This package matches the API of React Router v7's `@react-router/remix-route-config-adapter`, making the React Router v7 migration as easy as possible.

Then, update your `routes.ts` file to use the adapter, passing the value of your `routes` option to the `routesOptionAdapter` function which will return an array of configured routes.
Then, update your `routes.ts` file to use the adapter, passing the value of your `routes` option to the `remixRoutesOptionAdapter` function which will return an array of configured routes.

For example, if you were using the `routes` option to use an alternative file system routing implementation like [remix-flat-routes]:

```ts filename=app/routes.ts
import { type RouteConfig } from "@remix-run/route-config";
import { routesOptionAdapter } from "@remix-run/routes-option-adapter";
import { remixRoutesOptionAdapter } from "@remix-run/routes-option-adapter";
import { flatRoutes } from "remix-flat-routes";

export const routes: RouteConfig = routesOptionAdapter(
export const routes: RouteConfig = remixRoutesOptionAdapter(
(defineRoutes) => flatRoutes("routes", defineRoutes)
);
```
Expand All @@ -556,9 +556,9 @@ Or, if you were using the `routes` option to define config-based routes:
```ts filename=app/routes.ts
import { flatRoutes } from "@remix-run/fs-routes";
import { type RouteConfig } from "@remix-run/route-config";
import { routesOptionAdapter } from "@remix-run/routes-option-adapter";
import { remixRoutesOptionAdapter } from "@remix-run/routes-option-adapter";

export const routes: RouteConfig = routesOptionAdapter(
export const routes: RouteConfig = remixRoutesOptionAdapter(
(defineRoutes) => {
return defineRoutes((route) => {
route("/", "home/route.tsx", { index: true });
Expand Down Expand Up @@ -598,12 +598,12 @@ Note that if you need to mix and match different route config approaches, they c
import { flatRoutes } from "@remix-run/fs-routes";
import type { RouteConfig } from "@remix-run/route-config";
import { route } from "@remix-run/route-config";
import { routesOptionAdapter } from "@remix-run/routes-option-adapter";
import { remixRoutesOptionAdapter } from "@remix-run/routes-option-adapter";

export const routes: RouteConfig = [
...(await flatRoutes({ rootDirectory: "fs-routes" })),

...(await routesOptionAdapter(/* ... */)),
...(await remixRoutesOptionAdapter(/* ... */)),

route("/hello", "routes/hello.tsx"),
];
Expand Down
4 changes: 2 additions & 2 deletions integration/vite-fs-routes-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test.describe("fs-routes", () => {
"app/routes.ts": js`
import { type RouteConfig } from "@remix-run/route-config";
import { flatRoutes } from "@remix-run/fs-routes";
import { routesOptionAdapter } from "@remix-run/routes-option-adapter";
import { remixRoutesOptionAdapter } from "@remix-run/routes-option-adapter";
export const routes: RouteConfig = [
...await flatRoutes({
Expand All @@ -38,7 +38,7 @@ test.describe("fs-routes", () => {
}),
// Ensure back compat layer works
...await routesOptionAdapter(async (defineRoutes) => {
...await remixRoutesOptionAdapter(async (defineRoutes) => {
// Ensure async routes work
return defineRoutes((route) => {
route("/routes/option/adapter/route", "routes-option-adapter-route.tsx")
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-routes-option-adapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type { DefineRoutesFunction };
* option](https://remix.run/docs/en/v2/file-conventions/vite-config#routes),
* for use within `routes.ts`.
*/
export async function routesOptionAdapter(
export async function remixRoutesOptionAdapter(
routes: (
defineRoutes: DefineRoutesFunction
) =>
Expand Down

0 comments on commit 210d09e

Please sign in to comment.