@@ -2,12 +2,29 @@ import { existsSync } from 'node:fs';
22import { dirname , relative } from 'node:path' ;
33
44function matchesIncludePattern ( filePath , includePattern ) {
5- // Simple pattern matching for {packages,e2e,testing,examples}/*/project.json
65 const normalizedPath = filePath . replace ( / \\ / g, '/' ) ;
7- const pattern = includePattern
8- . replace ( / \{ ( [ ^ } ] + ) \} / , '($1)' )
9- . replace ( / , / g, '|' )
10- . replace ( / \* / g, '[^/]+' ) ;
6+
7+ // Handle special case for **/project.json (match all)
8+ if ( includePattern === '**/project.json' ) {
9+ return (
10+ normalizedPath . endsWith ( '/project.json' ) ||
11+ normalizedPath === 'project.json'
12+ ) ;
13+ }
14+
15+ // Handle {packages,e2e,testing,examples}/*/project.json pattern
16+ if ( includePattern . includes ( '{' ) && includePattern . includes ( '}' ) ) {
17+ const pattern = includePattern
18+ . replace ( / \{ ( [ ^ } ] + ) \} / , '($1)' )
19+ . replace ( / , / g, '|' )
20+ . replace ( / \* \* / g, '.*' )
21+ . replace ( / \* / g, '[^/]+' ) ;
22+ const regex = new RegExp ( `^${ pattern } $` ) ;
23+ return regex . test ( normalizedPath ) ;
24+ }
25+
26+ // Simple glob-like matching
27+ const pattern = includePattern . replace ( / \* \* / g, '.*' ) . replace ( / \* / g, '[^/]+' ) ;
1128 const regex = new RegExp ( `^${ pattern } $` ) ;
1229 return regex . test ( normalizedPath ) ;
1330}
0 commit comments