Skip to content

Commit

Permalink
Enable v3_singleFetch and v3_routeConfig future flags (#199)
Browse files Browse the repository at this point in the history
* enable single-fetch and route-config
* update future flags enabled in README
  • Loading branch information
PhilDL authored Nov 24, 2024
1 parent 2ff876a commit ec07484
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 104 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ _This Package **uses `pnpm` as the package manager** of choice to manage workspa
- TS Configs, also with different presets.
- [Tailwind](https://tailwindcss.com/) configs.

### Remix future flags activated:
### All Remix future flags activated:

```ts
future: {
Expand All @@ -59,6 +59,8 @@ future: {
v3_lazyRouteDiscovery: true,
v3_relativeSplatPath: true,
v3_throwAbortReason: true,
v3_singleFetch: true,
v3_routeConfig: true,
},
```

Expand Down
4 changes: 2 additions & 2 deletions apps/remix-app/app/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
import { RemixServer } from "@remix-run/react";
import { renderToPipeableStream } from "react-dom/server";

const ABORT_DELAY = 5000;
export const streamTimeout = 5000;

export default async function handleRequest(
request: Request,
Expand Down Expand Up @@ -45,6 +45,6 @@ export default async function handleRequest(
},
);

setTimeout(abort, ABORT_DELAY);
setTimeout(abort, streamTimeout + 5000);
});
}
5 changes: 5 additions & 0 deletions apps/remix-app/app/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { flatRoutes } from "@remix-run/fs-routes";
import type { RouteConfig } from "@remix-run/route-config";

export const routes: RouteConfig = flatRoutes();
export default routes;
6 changes: 3 additions & 3 deletions apps/remix-app/app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { json, type LoaderFunctionArgs } from "@remix-run/node";
import { type LoaderFunctionArgs } from "@remix-run/node";
import {
isRouteErrorResponse,
useLoaderData,
Expand All @@ -25,11 +25,11 @@ import Service, { helloWorld } from "~/services.server.ts";
export const loader = async ({ request: _request }: LoaderFunctionArgs) => {
const users = await Service.userRepository.getUsers();
const salesPersons = getSalesPersonDirectory();
return json({
return {
users,
serverValue: helloWorld("Remix Turborepo"),
salesPersons,
});
};
};

export default function Index() {
Expand Down
10 changes: 6 additions & 4 deletions apps/remix-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"@remix-gospel-stack/database": "workspace:*",
"@remix-gospel-stack/internal-nobuild": "workspace:*",
"@remix-gospel-stack/ui": "workspace:*",
"@remix-run/express": "2.14.0",
"@remix-run/node": "2.14.0",
"@remix-run/react": "2.14.0",
"@remix-run/express": "2.15.0",
"@remix-run/node": "2.15.0",
"@remix-run/react": "2.15.0",
"address": "^2.0.3",
"chalk": "^5.3.0",
"chokidar": "^4.0.1",
Expand All @@ -51,7 +51,9 @@
"@faker-js/faker": "^9.0.2",
"@playwright/test": "^1.47.2",
"@remix-gospel-stack/eslint-config": "workspace:*",
"@remix-run/dev": "2.14.0",
"@remix-run/dev": "2.15.0",
"@remix-run/fs-routes": "^2.15.0",
"@remix-run/route-config": "^2.15.0",
"@swc/core": "^1.7.28",
"@swc/helpers": "^0.5.13",
"@tailwindcss/typography": "^0.5.15",
Expand Down
3 changes: 0 additions & 3 deletions apps/remix-app/server.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import crypto from "crypto";
import { createRequestHandler } from "@remix-run/express";
import { installGlobals } from "@remix-run/node";
import { ip } from "address";
import chalk from "chalk";
import closeWithGrace from "close-with-grace";
Expand All @@ -10,8 +9,6 @@ import getPort, { portNumbers } from "get-port";
// import helmet from "helmet";
import morgan from "morgan";

installGlobals();

const viteDevServer =
process.env.NODE_ENV === "production"
? undefined
Expand Down
4 changes: 0 additions & 4 deletions apps/remix-app/tests/setup/setup-test-env.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
import { installGlobals } from "@remix-run/node";

import "@testing-library/jest-dom/vitest";
import "dotenv/config";

installGlobals();
8 changes: 8 additions & 0 deletions apps/remix-app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";

declare module "@remix-run/server-runtime" {
interface Future {
v3_singleFetch: true;
}
}

export default defineConfig({
plugins: [
remix({
Expand All @@ -13,6 +19,8 @@ export default defineConfig({
v3_lazyRouteDiscovery: true,
v3_relativeSplatPath: true,
v3_throwAbortReason: true,
v3_singleFetch: true,
v3_routeConfig: true,
},
}),
tsconfigPaths(),
Expand Down
14 changes: 7 additions & 7 deletions apps/remix-vercel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
"dependencies": {
"@remix-gospel-stack/internal-nobuild": "workspace:*",
"@remix-gospel-stack/ui": "workspace:*",
"@remix-run/css-bundle": "2.14.0",
"@remix-run/node": "2.14.0",
"@remix-run/react": "2.14.0",
"@remix-run/serve": "2.14.0",
"@remix-run/server-runtime": "2.14.0",
"@remix-run/css-bundle": "2.15.0",
"@remix-run/node": "2.15.0",
"@remix-run/react": "2.15.0",
"@remix-run/serve": "2.15.0",
"@remix-run/server-runtime": "2.15.0",
"@vercel/analytics": "^1.3.1",
"@vercel/remix": "2.14.0",
"@vercel/remix": "2.15.0",
"isbot": "^5.1.17",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"source-map-support": "^0.5.21"
},
"devDependencies": {
"@remix-gospel-stack/eslint-config": "workspace:*",
"@remix-run/dev": "2.14.0",
"@remix-run/dev": "2.15.0",
"@types/react": "^18.3.9",
"@types/react-dom": "^18.3.0",
"@types/source-map-support": "^0.5.10",
Expand Down
3 changes: 0 additions & 3 deletions apps/remix-vercel/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { vitePlugin as remix } from "@remix-run/dev";
import { installGlobals } from "@remix-run/node";
import { vercelPreset } from "@vercel/remix/vite";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";

installGlobals();

export default defineConfig({
plugins: [
remix({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"dependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
"@remix-run/dev": "2.14.0",
"@remix-run/dev": "2.15.0",
"@turbo/gen": "^2.1.2",
"@types/glob": "8.1.0",
"glob": "^11.0.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"tailwind-merge": "^2.5.2"
},
"peerDependencies": {
"@remix-run/dev": "2.14.0",
"@remix-run/node": "2.14.0",
"@remix-run/dev": "2.15.0",
"@remix-run/node": "2.15.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tailwindcss": "^3.3.2",
Expand All @@ -36,8 +36,8 @@
"devDependencies": {
"@remix-gospel-stack/eslint-config": "workspace:*",
"@remix-gospel-stack/tsconfig": "workspace:*",
"@remix-run/dev": "2.14.0",
"@remix-run/node": "2.14.0",
"@remix-run/dev": "2.15.0",
"@remix-run/node": "2.15.0",
"@storybook/addon-essentials": "^8.3.3",
"@storybook/addon-interactions": "^8.3.3",
"@storybook/addon-links": "^8.3.3",
Expand Down
Loading

0 comments on commit ec07484

Please sign in to comment.