{"size": 703, "ext": "js", "max_stars_repo_path": "packages/cli/scripts/bench.js", "max_stars_repo_name": "owinter86/compas", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "packages/cli/scripts/bench.js", "max_issues_repo_name": "owinter86/compas", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "packages/cli/scripts/bench.js", "max_forks_repo_name": "owinter86/compas", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 18.0256410256, "max_line_length": 65, "alphanum_fraction": 0.6344238976}
import { pathToFileURL } from "url";
import {
  AppError,
  filenameForModule,
  mainFn,
  processDirectoryRecursive,
} from "@compas/stdlib";
import { mainBenchFn } from "../index.js";

const __filename = filenameForModule(import.meta);

const contentHandler = async (file) => {
  // Skip this index file
  if (file === __filename) {
    return;
  }
  if (!file.endsWith(".bench.js")) {
    return;
  }

  try {
    await import(pathToFileURL(file));
  } catch (e) {
    throw AppError.serverError(
      {
        file,
      },
      e,
    );
  }
};

mainFn(import.meta, main);

async function main() {
  await processDirectoryRecursive(process.cwd(), contentHandler);
  mainBenchFn(import.meta);
}
