File tree Expand file tree Collapse file tree 1 file changed +2
-21
lines changed
packages/create-commandkit/src Expand file tree Collapse file tree 1 file changed +2
-21
lines changed Original file line number Diff line number Diff line change @@ -93,28 +93,17 @@ export function getInstallCommand(
9393}
9494
9595export async function fetchAvailableExamples ( ) : Promise < string [ ] > {
96- let controller : AbortController | null = null ;
97- let timeoutId : NodeJS . Timeout | null = null ;
98-
99- try {
100- controller = new AbortController ( ) ;
101- timeoutId = setTimeout ( ( ) => controller ! . abort ( ) , 10000 ) ; // 10 second timeout
102-
96+ try {
10397 const response = await fetch (
10498 'https://api.github.com/repos/underctrl-io/commandkit/contents/examples' ,
10599 {
106- signal : controller . signal ,
100+ signal : AbortSignal . timeout ( 10_000 ) ,
107101 headers : {
108102 'User-Agent' : 'create-commandkit' ,
109103 } ,
110104 } ,
111105 ) ;
112106
113- if ( timeoutId ) {
114- clearTimeout ( timeoutId ) ;
115- timeoutId = null ;
116- }
117-
118107 if ( ! response . ok ) {
119108 throw new Error ( `GitHub API error: ${ response . status } ` ) ;
120109 }
@@ -130,14 +119,6 @@ export async function fetchAvailableExamples(): Promise<string[]> {
130119 . map ( ( item ) => item . name )
131120 . sort ( ) ;
132121 } catch ( error ) {
133- // Clean up on error
134- if ( timeoutId ) {
135- clearTimeout ( timeoutId ) ;
136- }
137- if ( controller ) {
138- controller . abort ( ) ;
139- }
140-
141122 // Fallback to few known examples if API fails
142123 return [ 'basic-ts' , 'basic-js' , 'deno-ts' , 'without-cli' ] ;
143124 }
You can’t perform that action at this time.
0 commit comments