@@ -26,14 +26,18 @@ export const actionsDir = "actions";
2626export function * walkDir (
2727 fs : Filesystem ,
2828 dirPath : string ,
29+ shouldSkipDir ?: ( dirPath : string ) => boolean ,
2930 depth ?: number ,
3031) : Generator < { isDir : boolean ; path : string ; depth : number } , void , void > {
3132 depth = depth ?? 0 ;
3233 for ( const dirEntry of fs . listDir ( dirPath ) . sort ( consistentPathSort ) ) {
3334 const childPath = path . join ( dirPath , dirEntry . name ) ;
3435 if ( dirEntry . isDirectory ( ) ) {
36+ if ( shouldSkipDir && shouldSkipDir ( childPath ) ) {
37+ continue ;
38+ }
3539 yield { isDir : true , path : childPath , depth } ;
36- yield * walkDir ( fs , childPath , depth + 1 ) ;
40+ yield * walkDir ( fs , childPath , shouldSkipDir , depth + 1 ) ;
3741 } else if ( dirEntry . isFile ( ) ) {
3842 yield { isDir : false , path : childPath , depth } ;
3943 }
@@ -357,7 +361,22 @@ export async function entryPoints(
357361) : Promise < string [ ] > {
358362 const entryPoints = [ ] ;
359363
360- for ( const { isDir, path : fpath , depth } of walkDir ( ctx . fs , dir ) ) {
364+ // Don't deploy directories in convex/ that define components
365+ // as this leads to double-deploying.
366+ const looksLikeNestedComponent = ( dirPath : string ) : boolean => {
367+ const config = path . join ( dirPath , "convex.config.ts" ) ;
368+ const isComponentDefinition = ctx . fs . exists ( config ) ;
369+ if ( isComponentDefinition ) {
370+ logVerbose ( chalk . yellow ( `Skipping component directory ${ dirPath } ` ) ) ;
371+ }
372+ return isComponentDefinition ;
373+ } ;
374+
375+ for ( const { isDir, path : fpath , depth } of walkDir (
376+ ctx . fs ,
377+ dir ,
378+ looksLikeNestedComponent ,
379+ ) ) {
361380 if ( isDir ) {
362381 continue ;
363382 }
0 commit comments