@@ -62,7 +62,11 @@ async function patchProject(dir: string): Promise<void> {
6262 }
6363 }
6464
65- const ignore = / [ / \\ ] + ( .| [ ^ / \\ ] + _ t e s t \. .* | t e s t s [ ^ / \\ ] ) / ;
65+ const ignore = ( entry : Deno . DirEntry , _full : string ) => {
66+ return / ^ ( \. | t m p _ ) / . test ( entry . name ) ||
67+ / _ t e s t \. [ t j ] s x ? $ / . test ( entry . name ) ||
68+ entry . name === "tests" || entry . name === "test" ;
69+ } ;
6670
6771 await copyRecursive (
6872 path . join ( import . meta. dirname ! , ".." , ".." , "fresh" ) ,
@@ -77,6 +81,7 @@ async function patchProject(dir: string): Promise<void> {
7781 ) ;
7882
7983 json . workspace = [ "./_linked/*" ] ;
84+ json . exclude = [ ...json . exclude ?? [ ] , "**/_linked/*" ] ;
8085
8186 // assert with this stricter rule, before adding it to initialized projects
8287 json . lint . rules . include = [ "verbatim-module-syntax" ] ;
@@ -101,13 +106,15 @@ async function patchProject(dir: string): Promise<void> {
101106async function copyRecursive (
102107 from : string ,
103108 to : string ,
104- ignore ?: RegExp ,
109+ ignore ?: ( entry : Deno . DirEntry , full : string ) => boolean ,
105110) : Promise < void > {
106111 for await ( const entry of Deno . readDir ( from ) ) {
107112 const source = path . join ( from , entry . name ) ;
108113 const target = path . join ( to , entry . name ) ;
109114
110- if ( ignore && ignore . test ( source ) ) continue ;
115+ if ( ignore && ignore ( entry , source ) ) {
116+ continue ;
117+ }
111118
112119 if ( entry . isFile ) {
113120 try {
@@ -119,7 +126,7 @@ async function copyRecursive(
119126 }
120127 await Deno . copyFile ( source , target ) ;
121128 } else if ( entry . isDirectory ) {
122- await copyRecursive ( source , target ) ;
129+ await copyRecursive ( source , target , ignore ) ;
123130 }
124131 }
125132}
0 commit comments