checkConstructs method

Future<void> checkConstructs(
  1. Iterable<ConstructYaml> constructs
)

Asserts the config for all constructs

  • Contains only 1 config where ConstructConfig.isServer is true

Implementation

Future<void> checkConstructs(Iterable<ConstructYaml> constructs) async {
  for (final construct in constructs) {
    for (final config in construct.constructs) {
      final path = p.join(construct.packagePath, 'lib', config.path);
      final file = fs.file(path);
      if (!await file.exists()) {
        logger.err(
          'Failed to find the entrypoint for construct ${config.name}',
        );
        throw Exception(
          'Failed to find the entrypoint for construct ${config.name}',
        );
      }

      logger.detail('Construct: ${config.name}');
    }
  }
}