Skip to content

Commit 871ae81

Browse files
Update naming to routesSchema
1 parent deecb64 commit 871ae81

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Remix scaffold, is a code-gen tool for [Remix](https://remix.run/) designed to increase your productivity, and manage your route heirarchy.
77

8-
To do this, we provide a `routes.yml` file at the root of your app, which allows you to define the structure and behaviour of your site (Or utilise pre-built structures from the community) from which your routes and views are automatically generated.
8+
After initialising the `routes.yml` file at the root of your app, you can define the site structure from which your routes and views are automatically generated.
99

1010
## Getting Started
1111

src/commands/generate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import fs from 'fs';
44
import yaml from 'js-yaml';
55
import chalk from 'chalk';
66
import { YamlConfig } from '../typings/Config';
7-
import { validateConfig } from '../utils/routeSchema';
7+
import { validateConfig } from '../utils/routesSchema';
88

99
type Options = {
1010
definition: string;
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
structure: split
2-
routes:
3-
- name: Todo
1+
structure: co-locate
2+
routes:
3+
- name: Home
4+
type: index
5+
- name: Login
6+
- name: Jokes
7+
children:
8+
- name: New
9+
- name: Joke
10+
slug: jokeId

src/utils/routeSchema.ts renamed to src/utils/routesSchema.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ const routeObject: z.Schema<RouteObject> = z.late.object(() => ({
1515
children: z.array(routeObject).optional()
1616
}));
1717

18-
export const configSchema = z.object({
18+
export const routesSchema = z.object({
1919
structure: z.enum(['co-locate', 'split'],).default('co-locate'),
2020
routes: z.array(routeObject)
2121
})
2222

23-
export type ScaffoldConfig = z.infer<typeof configSchema>
23+
export type RoutesConfig = z.infer<typeof routesSchema>
2424

25-
export const validateConfig = (doc: YamlConfig): ScaffoldConfig => {
26-
const checks = configSchema.safeParse(doc);
25+
export const validateConfig = (doc: YamlConfig): RoutesConfig => {
26+
const checks = routesSchema.safeParse(doc);
2727

2828
if(!checks.success) {
2929
throw checks.error.issues.reduce((acc, curr) => {

0 commit comments

Comments
 (0)