Angular Modernizer
    Preparing search index...

    Configuration loader for .angular-modernizer.json files.

    Features:

    • Loads configuration from project root
    • Validates against JSON Schema
    • Provides default values
    • Caches loaded configurations
    • Supports monorepo scenarios with findProjectRoot()

    Loading is synchronous (JSON only). layersSource is passed through as-is: the referenced ESM module (e.g. an arch-validator config.js) is imported asynchronously by the architecture plugin, not by this loader.

    const loader = new ConfigLoader();
    const config = loader.load('/path/to/project');
    console.info(config.build.mode); // 'incremental'
    Index

    Constructors

    Methods

    • Clear configuration cache.

      Useful for testing or when configuration files change at runtime.

      Returns void

    • Find project root by searching upwards for .angular-modernizer.json.

      Useful for monorepo scenarios where the config might be in a parent directory.

      Parameters

      • startPath: string

        Starting directory to search from

      • maxDepth: number = 10

        Maximum depth to search upwards (default: 10)

      Returns string | null

      Project root path or null if not found

      const loader = new ConfigLoader();
      const projectRoot = loader.findProjectRoot('/path/to/monorepo/packages/app');
      // Returns: '/path/to/monorepo' (if .angular-modernizer.json exists there)
    • Get configuration for a specific tool.

      Type Parameters

      Parameters

      • projectRoot: string

        Project root directory

      • toolName: K

        Tool name (e.g., 'scan-architecture', 'transform-code')

      Returns ToolsConfig[K] | undefined

      Tool-specific configuration or undefined

      const loader = new ConfigLoader();
      const scanConfig = loader.getToolConfig('/path/to/project', 'scan-architecture');
      console.info(scanConfig?.maxFiles); // 2000
    • Load configuration from project root.

      Parameters

      • projectRoot: string

        Project root directory

      Returns AngularModernizerConfig

      Loaded and validated configuration

      If config file not found and required=true

      If config file is invalid

    • Load configuration with automatic project root detection.

      Searches upwards from startPath to find .angular-modernizer.json.

      Parameters

      • startPath: string

        Starting directory to search from

      • maxDepth: number = 10

        Maximum depth to search upwards (default: 10)

      Returns AngularModernizerConfig

      Loaded configuration

      If config file not found and required=true