createEntrypoint method

Future<void> createEntrypoint(
  1. Directory root, {
  2. required List<ConstructYaml> constructs,
})

Implementation

Future<void> createEntrypoint(
  Directory root, {
  required List<ConstructYaml> constructs,
}) async {
  final revaliDir = await root.getInternalRevali();
  await revaliDir.create(recursive: true);

  final entrypointFile =
      revaliDir.childFile(ConstructEntrypointHandler.entrypointFile);

  if (await entrypointFile.exists()) {
    await entrypointFile.delete();
  }

  await entrypointFile.create();

  final content = entrypointContent(
    constructs,
    root: root,
  );
  await entrypointFile.writeAsString(content);
}