Skip to content

Commit

Permalink
feat: sort the modules alphabetically (#60)
Browse files Browse the repository at this point in the history
Co-authored-by: songbinghui <soongbinghui@gmail.com>
  • Loading branch information
binghuis and binghuis authored Mar 1, 2023
1 parent 3011bbb commit a76c8df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions examples/react-router/plugin/src/routes.gen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import app from './pages/_app'
import noMatch from './pages/404'

const Auth = lazy(() => import('./pages/(auth)/_layout'))
const Posts = lazy(() => import('./pages/posts/_layout'))
const Authlogin = lazy(() => import('./pages/(auth)/login'))
const Authregister = lazy(() => import('./pages/(auth)/register'))
const About = lazy(() => import('./pages/about'))
const Index = lazy(() => import('./pages/index'))
const IndexError = lazy(() => import('./pages/index').then((m) => ({ default: m.Catch })))
const Authlogin = lazy(() => import('./pages/(auth)/login'))
const Authregister = lazy(() => import('./pages/(auth)/register'))
const Posts = lazy(() => import('./pages/posts/_layout'))
const Postsiddeep = lazy(() => import('./pages/posts/[id].deep'))
const Postsid = lazy(() => import('./pages/posts/[id]'))
const Postsidpid = lazy(() => import('./pages/posts/[id]/-[pid]'))
const Postsindex = lazy(() => import('./pages/posts/index'))
const Splatall = lazy(() => import('./pages/splat/[...all]'))
const Postsidpid = lazy(() => import('./pages/posts/[id]/-[pid]'))
const App = app || Outlet
const NoMatch = noMatch || Fragment

Expand Down
3 changes: 1 addition & 2 deletions shared/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ export const getRoutes = <T extends BaseRoute>(
) => {
const filteredRoutes = files
.filter((key) => !key.includes('/_') || /(_app|_layout)\.(jsx|tsx)$/.test(key))
.sort((a, z) => +z.includes('_layout') - +a.includes('_layout'))
.sort((a, z) => +z.includes('pages/_app') - +a.includes('pages/_app'))
.sort((a, b) => a.localeCompare(b))

const ids = filteredRoutes.map((route) => getRouteId(route))
const exports: Record<string, ReturnType<typeof getRouteExports>> = {}
Expand Down

0 comments on commit a76c8df

Please sign in to comment.