From 15a6d3a48b7d254e1fc9d1a9d9ec074f29cae9d8 Mon Sep 17 00:00:00 2001 From: Brooks Lybrand Date: Tue, 5 Nov 2024 14:18:35 -0600 Subject: [PATCH] Remove @remix-run/routes-option-adapter --- app/routes.ts | 82 +++++++++++++++++++++-------------------------- package-lock.json | 20 ------------ package.json | 1 - 3 files changed, 37 insertions(+), 66 deletions(-) diff --git a/app/routes.ts b/app/routes.ts index 7f7e68ec..88d6b3fa 100644 --- a/app/routes.ts +++ b/app/routes.ts @@ -1,45 +1,37 @@ -import { type RouteConfig } from "@remix-run/route-config"; -import { remixRoutesOptionAdapter } from "@remix-run/routes-option-adapter"; - -export const routes: RouteConfig = await remixRoutesOptionAdapter( - (defineRoutes) => { - return defineRoutes((route) => { - route("/__components", "components/_playground/playground.tsx"); - route("/color-scheme", "actions/color-scheme.ts"); - - route("/", "pages/home.tsx", { index: true }); - route("/brand", "pages/brand.tsx"); - route("/healthcheck", "pages/healthcheck.tsx"); - - // Pre v7 inline API docs - route("/en/:ref", "pages/docs-layout.tsx", { id: "v6-guides" }, () => { - route("", "pages/docs-index.tsx", { - index: true, - id: "v6-index", - }); - route("*", "pages/doc.tsx", { id: "v6-guide" }); - }); - - route("/v6/*", "pages/redirect-v6-doc.tsx"); - route("/v7/api/:pkg/*", "pages/redirect-v7-doc.tsx"); - route("/v7/docs/*", "pages/redirect-v7-doc.tsx", { - id: "v7-docs-redirect", - }); - - route("/:ref?/docs", "pages/docs-layout.tsx", { id: "docs" }, () => { - route("", "pages/docs-index.tsx", { index: true }); - route("*", "pages/doc.tsx"); - }); - - // TODO: uncomment after v7 - // route("/:ref?/api", "pages/api-redirect.ts"); - - route("/:ref?/api/:pkg", "pages/api-layout.tsx", { id: "api" }, () => { - route("", "pages/api-index.tsx", { index: true }); - route("*", "pages/api-doc.tsx"); - }); - - route("/*", "pages/notfound.tsx"); - }); - } -); +import { type RouteConfig, route, index } from "@remix-run/route-config"; + +export const routes: RouteConfig = [ + route("/__components", "components/_playground/playground.tsx"), + route("/color-scheme", "actions/color-scheme.ts"), + + index("pages/home.tsx"), + route("/brand", "pages/brand.tsx"), + route("/healthcheck", "pages/healthcheck.tsx"), + + // Pre v7 inline API docs + route("/en/:ref", "pages/docs-layout.tsx", { id: "v6-guides" }, [ + index("pages/docs-index.tsx", { id: "v6-index" }), + route("*", "pages/doc.tsx", { id: "v6-guide" }), + ]), + + route("/v6/*", "pages/redirect-v6-doc.tsx"), + route("/v7/api/:pkg/*", "pages/redirect-v7-doc.tsx"), + route("/v7/docs/*", "pages/redirect-v7-doc.tsx", { + id: "v7-docs-redirect", + }), + + route("/:ref?/docs", "pages/docs-layout.tsx", { id: "docs" }, [ + index("pages/docs-index.tsx"), + route("*", "pages/doc.tsx"), + ]), + + // TODO: uncomment after v7 + // route("/:ref?/api", "pages/api-redirect.ts"), + + route("/:ref?/api/:pkg", "pages/api-layout.tsx", { id: "api" }, [ + index("pages/api-index.tsx"), + route("*", "pages/api-doc.tsx"), + ]), + + route("/*", "pages/notfound.tsx"), +]; diff --git a/package-lock.json b/package-lock.json index 74571758..045da621 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,6 @@ "@remix-run/node": "2.14.0-pre.0", "@remix-run/react": "2.14.0-pre.0", "@remix-run/route-config": "^2.14.0-pre.0", - "@remix-run/routes-option-adapter": "^2.14.0-pre.0", "@remix-run/serve": "2.14.0-pre.0", "bcryptjs": "^2.4.3", "cheerio": "^1.0.0-rc.12", @@ -3098,25 +3097,6 @@ "node": ">=14.0.0" } }, - "node_modules/@remix-run/routes-option-adapter": { - "version": "2.14.0-pre.0", - "resolved": "https://registry.npmjs.org/@remix-run/routes-option-adapter/-/routes-option-adapter-2.14.0-pre.0.tgz", - "integrity": "sha512-8uk/VsD1XaSB/35t69aXhe0vc7OMSBxX2waUHNZVyV0JJ+6AXBZCL3gHeTKzrCQz9D2RkGsej452HvdT7cdEJg==", - "license": "MIT", - "engines": { - "node": ">=18.0.0" - }, - "peerDependencies": { - "@remix-run/dev": "^2.14.0-pre.0", - "@remix-run/route-config": "^2.14.0-pre.0", - "typescript": "^5.1.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/@remix-run/serve": { "version": "2.14.0-pre.0", "resolved": "https://registry.npmjs.org/@remix-run/serve/-/serve-2.14.0-pre.0.tgz", diff --git a/package.json b/package.json index c7765095..f8ce53c8 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "@remix-run/node": "2.14.0-pre.0", "@remix-run/react": "2.14.0-pre.0", "@remix-run/route-config": "^2.14.0-pre.0", - "@remix-run/routes-option-adapter": "^2.14.0-pre.0", "@remix-run/serve": "2.14.0-pre.0", "bcryptjs": "^2.4.3", "cheerio": "^1.0.0-rc.12",