Skip to content

Commit

Permalink
chore: enable v2_routeConvention flag
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Sep 1, 2023
1 parent 916f792 commit bf858f4
Show file tree
Hide file tree
Showing 221 changed files with 580 additions and 343 deletions.
7 changes: 7 additions & 0 deletions __template/app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Index() {
return (
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.8" }}>
<h1>Welcome to Remix</h1>
</div>
);
}
5 changes: 4 additions & 1 deletion __template/remix.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
future: {
v2_routeConvention: true,
},
ignoredRouteFiles: ["**/.*"],
// appDirectory: "app",
// assetsBuildDirectory: "public/build",
// serverBuildPath: "build/index.js",
// publicPath: "/build/",
// serverBuildPath: "build/index.js",
};
2 changes: 1 addition & 1 deletion _official-jokes/remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ module.exports = {
serverModuleFormat: "cjs",
// appDirectory: "app",
// assetsBuildDirectory: "public/build",
// serverBuildPath: "build/index.js",
// publicPath: "/build/",
// serverBuildPath: "build/index.js",
};
File renamed without changes.
5 changes: 4 additions & 1 deletion _official-realtime-app/remix.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
future: {
v2_routeConvention: true,
},
ignoredRouteFiles: ["**/.*"],
// appDirectory: "app",
// assetsBuildDirectory: "public/build",
// serverBuildPath: "build/index.js",
// publicPath: "/build/",
// serverBuildPath: "build/index.js",
};
4 changes: 2 additions & 2 deletions bullmq-task-queue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Open this example on [CodeSandbox](https://codesandbox.com):

## Relevant files:

- [app/utils/notifier.server.ts](./app/queues/notifier.server.ts) where we define the necessary components for the background task queue, worker, and scheduler.
- [app/routes/index.tsx](./app/routes/index.tsx) where background tasks are added to the queue.
- [`app/utils/notifier.server.ts`](./app/queues/notifier.server.ts) where we define the necessary components for the background task queue, worker, and scheduler.
- [`app/routes/_index.tsx`](./app/routes/_index.tsx) where background tasks are added to the queue.

## Related Links

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion catch-boundary/remix.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
future: {
v2_routeConvention: true,
},
ignoredRouteFiles: ["**/.*"],
// appDirectory: "app",
// assetsBuildDirectory: "public/build",
// serverBuildPath: "build/index.js",
// publicPath: "/build/",
// serverBuildPath: "build/index.js",
};
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Box } from "@chakra-ui/react";

const Index = () => {
export default function Index() {
return (
<Box bg="tomato" w="100%" p={4} color="white">
Hello World!
</Box>
);
};

export default Index;
}
5 changes: 4 additions & 1 deletion chakra-ui/remix.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
future: {
v2_routeConvention: true,
},
ignoredRouteFiles: ["**/.*"],
// appDirectory: "app",
// assetsBuildDirectory: "public/build",
// serverBuildPath: "build/index.js",
// publicPath: "/build/",
// serverBuildPath: "build/index.js",
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ClientOnly, useHydrated } from "remix-utils";
import { BrokenOnTheServer } from "~/components/broken-on-the-server.client";
import { ComplexComponent } from "~/components/complex-component";

export default function Screen() {
export default function Index() {
const hydrated = useHydrated();
return (
<>
Expand Down
5 changes: 4 additions & 1 deletion client-only-components/remix.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
future: {
v2_routeConvention: true,
},
ignoredRouteFiles: ["**/.*"],
// appDirectory: "app",
// assetsBuildDirectory: "public/build",
// serverBuildPath: "build/index.js",
// publicPath: "/build/",
// serverBuildPath: "build/index.js",
};
167 changes: 3 additions & 164 deletions client-side-validation/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,189 +1,28 @@
import type { ActionArgs, LinksFunction, MetaFunction } from "@remix-run/node";
import { json } from "@remix-run/node";
import type { MetaFunction } from "@remix-run/node";
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
ScrollRestoration,
useActionData,
useLoaderData,
} from "@remix-run/react";

import stylesUrl from "~/index.css";

export const links: LinksFunction = () => [
{ rel: "stylesheet", href: stylesUrl },
];

export const meta: MetaFunction = () => ({
charset: "utf-8",
title: "New Remix App",
viewport: "width=device-width,initial-scale=1",
});

export const action = async ({ request }: ActionArgs) => {
const form = await request.formData();
const message = `Successfully submitted data:
- Required text: ${form.get("required-text")}
- Required checkbox: ${form.get("required-checkbox")}
- Text with regex: ${form.get("text-with-regex")}
- Number with min max: ${form.get("number-with-min-max")}
- Text with minlength maxlength: ${form.get(
"text-with-minlength-maxlength",
)}
- Date with min max: ${form.get("date-with-min-max")}
`;
return json({ message }, { status: 200 });
};

export const loader = async () => {
const date = new Date();

// today string in "YYYY-MM-DD" format
const todayString = `${date.getFullYear()}-${(
"00" +
(date.getMonth() + 1)
).slice(-2)}-${("00" + date.getDate()).slice(-2)}`;

// tomorrow string in "YYYY-MM-DD" format
const tomorrowString = `${date.getFullYear()}-${(
"00" +
(date.getMonth() + 1)
).slice(-2)}-${("00" + (date.getDate() + 1)).slice(-2)}`;

return json({ todayString, tomorrowString });
};

export default function App() {
const actionData = useActionData<typeof action>();
const data = useLoaderData<typeof loader>();

return (
<html lang="en">
<head>
<Meta />
<Links />
</head>
<body>
<div className="root">
<h1>Client-Side Validation Example</h1>
<form method="post">
<div className="form-control">
<label>
Required text
<abbr title="This field is mandatory" aria-label="required">
*
</abbr>
<input type="text" name="required-text" required />
</label>
</div>
<div className="form-control">
<fieldset>
<legend>
Required checkbox
<abbr title="This field is mandatory" aria-label="required">
*
</abbr>
</legend>
<label>
<input
type="radio"
required
name="required-checkbox"
value="yes"
/>
Yes
</label>
<label>
<input
type="radio"
required
name="required-checkbox"
value="maybe"
/>
Maybe
</label>
<label>
<input
type="radio"
required
name="required-checkbox"
value="no"
/>
No
</label>
</fieldset>
</div>
<div className="form-control">
<label>
Text with regex validation (only allow [Bb]anana or [Oo]range)
<input
type="text"
name="text-with-regex"
list="list1"
pattern="[Bb]anana|[Oo]range"
/>
<datalist id="list1">
<option>Banana</option>
<option>Cherry</option>
<option>Apple</option>
<option>Strawberry</option>
<option>Lemon</option>
<option>Orange</option>
</datalist>
</label>
</div>
<div className="form-control">
<label>
Number with min (12) and max (120) validation
<input
type="number"
name="number-with-min-max"
min="12"
max="120"
step="1"
/>
</label>
</div>
<div className="form-control">
<label>
Email
<input name="email" type="email" />
</label>
</div>
<div className="form-control">
<label htmlFor="text-with-minlength-maxlength">
Text with minLength(10) and maxLength(140)
</label>
<textarea
name="text-with-minlength-maxlength"
id="text-with-minlength-maxlength"
minLength={10}
maxLength={140}
rows={3}
></textarea>
</div>
<div className="form-control">
<label htmlFor="date-with-min-max">
Date with min(today) and max(tomorrow)
</label>
<input
type="date"
name="date-with-min-max"
id="date-with-min-max"
min={data.todayString}
max={data.tomorrowString}
/>
</div>
<div className="form-control">
<button>Submit</button>
</div>
</form>
{actionData?.message ? (
<div className="result">{actionData.message}</div>
) : null}
</div>
<Outlet />
<ScrollRestoration />
<Scripts />
<LiveReload />
Expand Down
Loading

0 comments on commit bf858f4

Please sign in to comment.