File tree Expand file tree Collapse file tree 2 files changed +31
-6
lines changed
Expand file tree Collapse file tree 2 files changed +31
-6
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ const cli = meow(
1010 $ tarocodegen
1111
1212 Options
13- --type component type
13+ --type command type [routes, icons, all]
1414
1515 Examples
1616 $ tarocodegen --type routes
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ const App: FC<{ type?: string }> = ({ type }) => {
2828 console . log ( chalk . red ( error ) ) ;
2929 setProcess ( "failed" ) ;
3030 }
31- } else if ( item . value === ' icons' ) {
31+ } else if ( item . value === " icons" ) {
3232 try {
3333 generateIcons ( ) ;
3434 setProcess ( "success" ) ;
@@ -37,14 +37,41 @@ const App: FC<{ type?: string }> = ({ type }) => {
3737 setProcess ( "failed" ) ;
3838 }
3939 }
40-
4140 } ;
4241 const [ process , setProcess ] = useState <
4342 "init" | "processing" | "success" | "failed"
44- > ( "init" ) ;
43+ > ( ) ;
4544 useEffect ( ( ) => {
4645 if ( type ) {
4746 setProcess ( "processing" ) ;
47+ if ( type === "routes" ) {
48+ try {
49+ generateRoutes ( ) ;
50+ setProcess ( "success" ) ;
51+ } catch ( error ) {
52+ console . log ( chalk . red ( error ) ) ;
53+ setProcess ( "failed" ) ;
54+ }
55+ } else if ( type === "icons" ) {
56+ try {
57+ generateIcons ( ) ;
58+ setProcess ( "success" ) ;
59+ } catch ( error ) {
60+ console . log ( chalk . red ( error ) ) ;
61+ setProcess ( "failed" ) ;
62+ }
63+ } else if ( type === "all" ) {
64+ try {
65+ generateRoutes ( ) ;
66+ generateIcons ( ) ;
67+ setProcess ( "success" ) ;
68+ } catch ( error ) {
69+ console . log ( chalk . red ( error ) ) ;
70+ setProcess ( "failed" ) ;
71+ }
72+ }
73+ } else {
74+ setProcess ( "init" ) ;
4875 }
4976 } , [ ] ) ;
5077 return (
@@ -68,5 +95,3 @@ const App: FC<{ type?: string }> = ({ type }) => {
6895
6996module . exports = App ;
7097export default App ;
71-
72-
You can’t perform that action at this time.
0 commit comments