@@ -33,29 +33,30 @@ export type Configuration = {
3333 projectDirectory : WorkingDirectory ,
3434 fullValidator : Validator < JsonProjectConfiguration > ,
3535 partialValidator : Validator < JsonPartialProjectConfiguration > ,
36+ configurationFile : string ,
3637} ;
3738
3839export class JsonConfigurationFileManager implements ConfigurationManager {
3940 private static readonly CONFIGURATION_SCHEMA = 'https://schema.croct.com/json/v1/project.json' ;
4041
4142 private readonly fileSystem : FileSystem ;
4243
43- private readonly projectDirectory : WorkingDirectory ;
44-
4544 private readonly fullValidator : Validator < ProjectConfiguration > ;
4645
4746 private readonly partialValidator : Validator < PartialProjectConfiguration > ;
4847
49- public constructor ( { fileSystem, projectDirectory, fullValidator, partialValidator} : Configuration ) {
50- this . fileSystem = fileSystem ;
51- this . projectDirectory = projectDirectory ;
52- this . fullValidator = fullValidator ;
53- this . partialValidator = partialValidator ;
48+ private readonly configurationFile : string ;
49+
50+ public constructor ( configuration : Configuration ) {
51+ this . fileSystem = configuration . fileSystem ;
52+ this . fullValidator = configuration . fullValidator ;
53+ this . partialValidator = configuration . partialValidator ;
54+ this . configurationFile = configuration . configurationFile ;
5455 }
5556
5657 public async isInitialized ( state : InitializationState = InitializationState . ANY ) : Promise < boolean > {
5758 if ( state === InitializationState . ANY ) {
58- return this . fileSystem . exists ( this . getConfigurationFilePath ( ) ) ;
59+ return this . fileSystem . exists ( this . configurationFile ) ;
5960 }
6061
6162 const validator = state === InitializationState . FULL
@@ -160,7 +161,7 @@ export class JsonConfigurationFileManager implements ConfigurationManager {
160161 validator : Validator < T > ,
161162 ) : Promise < LoadedFile < Omit < T , '$schema' > > > {
162163 const file : LoadedFile < T > = {
163- path : this . getConfigurationFilePath ( ) ,
164+ path : this . configurationFile ,
164165 source : null ,
165166 configuration : null ,
166167 } ;
@@ -185,10 +186,6 @@ export class JsonConfigurationFileManager implements ConfigurationManager {
185186 return file ;
186187 }
187188
188- private getConfigurationFilePath ( ) : string {
189- return this . fileSystem . joinPaths ( this . projectDirectory . get ( ) , 'croct.json' ) ;
190- }
191-
192189 private async validateConfiguration < T extends JsonPartialProjectConfiguration > (
193190 validator : Validator < T > ,
194191 value : JsonValue ,
0 commit comments