Open History to see the last commit
1import yargs from 'yargs'
2import { hideBin } from 'yargs/helpers'
3import { getConfig } from '@tanstack/router-generator'
4import { generate } from './generate'
5import { watch } from './watch'
6β
7main()
8β
9export function main() {
10 yargs(hideBin(process.argv))
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
25}