Skip to content

Commit 1791df8

Browse files
committed
refactor: migrate routes to v2 flat routes convention
- Rename all route files from folder-based to dot-based naming - Rename index.tsx to _index.tsx for index routes - Update relative imports to match new file structure - Update test import from ~/routes to ~/routes/_index - Add serverModuleFormat: 'cjs' to fix @heroicons/react ESM issue Route examples: - routes/index.tsx → routes/_index.tsx - routes/dashboard/course.tsx → routes/dashboard.course.tsx - routes/dashboard/course/$lessonId.tsx → routes/dashboard.course.$lessonId.tsx
1 parent 3a8ca51 commit 1791df8

22 files changed

Lines changed: 23 additions & 12 deletions

app/components/sections/__tests__/index.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { render } from '#test/test-utils'
2-
import HomePage from '~/routes'
2+
import HomePage from '~/routes/_index'
33

44
describe('Home Page', () => {
55
it('renders the Home Page without error', () => {

app/routes/dashboard/course/$lessonId/edit.tsx renamed to app/routes/dashboard.course.$lessonId.edit.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@ import { Dialog, Transition } from '@headlessui/react'
22
import { Fragment } from 'react'
33
import type { ActionFunction, LoaderFunction } from '@remix-run/node'
44
import { json, redirect } from '@remix-run/node'
5-
import {
6-
Form,
7-
useLoaderData,
8-
useMatches,
9-
useNavigate,
10-
} from '@remix-run/react'
5+
import { Form, useLoaderData, useMatches, useNavigate } from '@remix-run/react'
116
import { Lesson } from '@prisma/client'
127
import { Field } from '~/components/form-elements'
138
import { classNames } from '~/utils/class-names'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
ExternalLinkIcon,
99
} from '@heroicons/react/solid'
1010
import { PaperClipIcon } from '@heroicons/react/outline'
11-
import { CourseContextType } from '../course'
11+
import { CourseContextType } from './dashboard.course'
1212
import { getFirstCourse } from '~/models/course'
1313
import { getLessonById, LessonWithAttachments } from '~/models/lesson'
1414
import { requireUpdatedUser } from '~/services/auth.server'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { VideoCameraIcon } from '@heroicons/react/outline'
22
import { useOutletContext } from '@remix-run/react'
3-
import { CourseContextType } from '../course'
3+
import { CourseContextType } from './dashboard.course'
44

55
export default function CourseIndex() {
66
const { directory } = useOutletContext<CourseContextType>()

0 commit comments

Comments
 (0)