Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

index.ts

25 lines607 Bytes

1import * as yargs from 'yargs'
2import { getConfig } from '@tanstack/router-generator'
3import { generate } from './generate'
4import { watch } from './watch'
5​
6main()
7​
8export function main() {
9 yargs
10 // @ts-expect-error
11 .scriptName('tsr')
12 .usage('$0 <cmd> [args]')
13 .command('generate', 'Generate the routes for a project', async () => {
14 const config = getConfig()
15 await generate(config, process.cwd())
16 })
17 .command(
18 'watch',
19 'Continuously watch and generate the routes for a project',
20 () => {
21 watch(process.cwd())
22 },
23 )
24 .help().argv