@@ -2,18 +2,18 @@ import { globby } from "globby";
22import path from "path" ;
33import { Rule } from "../rule.js" ;
44import { RuleResult } from "../rule-result.js" ;
5- import { checkFileExists } from "../utils .js" ;
5+ import { TsvHost } from "../tsv-host .js" ;
66
77export class FolderStructureRule implements Rule {
88 readonly name = "FolderStructure" ;
99 readonly description = "Verify spec directory's folder structure and naming conventions." ;
10- async execute ( folder : string ) : Promise < RuleResult > {
10+ async execute ( host : TsvHost , folder : string ) : Promise < RuleResult > {
1111 let success = true ;
1212 let stdOutput = "" ;
1313 let errorOutput = "" ;
1414
1515 stdOutput += `folder: ${ folder } \n` ;
16- if ( ! ( await checkFileExists ( folder ) ) ) {
16+ if ( ! ( await host . checkFileExists ( folder ) ) ) {
1717 return {
1818 success : false ,
1919 stdOutput : stdOutput ,
@@ -64,17 +64,17 @@ export class FolderStructureRule implements Rule {
6464
6565 // Verify tspconfig, main.tsp, examples/
6666 let containsMinStruct =
67- ( await checkFileExists ( path . join ( folder , "main.tsp" ) ) ) ||
68- ( await checkFileExists ( path . join ( folder , "client.tsp" ) ) ) ;
67+ ( await host . checkFileExists ( path . join ( folder , "main.tsp" ) ) ) ||
68+ ( await host . checkFileExists ( path . join ( folder , "client.tsp" ) ) ) ;
6969
70- if ( await checkFileExists ( path . join ( folder , "main.tsp" ) ) ) {
70+ if ( await host . checkFileExists ( path . join ( folder , "main.tsp" ) ) ) {
7171 containsMinStruct =
72- containsMinStruct && ( await checkFileExists ( path . join ( folder , "examples" ) ) ) ;
72+ containsMinStruct && ( await host . checkFileExists ( path . join ( folder , "examples" ) ) ) ;
7373 }
7474
7575 if ( ! packageFolder . includes ( "Shared" ) ) {
7676 containsMinStruct =
77- containsMinStruct && ( await checkFileExists ( path . join ( folder , "tspconfig.yaml" ) ) ) ;
77+ containsMinStruct && ( await host . checkFileExists ( path . join ( folder , "tspconfig.yaml" ) ) ) ;
7878 }
7979 if ( ! containsMinStruct ) {
8080 success = false ;
0 commit comments