public async c2aDiff()

in packages/aws-c2a/lib/toolkit.ts [81:97]


  public async c2aDiff(options: DiffOptions): Promise<number> {
    const outputPath = options.outputPath;

    const rules = [
      ...(options.broadeningPermissions ? BroadeningPermissions : []),
      ...(options.rulesPath ? JSON.parse(await fs.promises.readFile(options.rulesPath, 'utf-8')) : []),
    ];

    if (rules.length === 0) {
      warning('No rules are configured. Run with c2a diff with `--broadening-permissions` or `--rules-path` to analyze the risk of your changes.');
    }

    const { before, after } = await this.getTemplateTrees(options.stackNames);
    const report = await this.evaluateStacks({ before, after, rules });
    await fs.promises.writeFile(outputPath, new JSONSerializer().serialize(report));
    return this.evaluateReport(report, options.failCondition) && options.fail ? 1 : 0;
  }