async function convertExampleDir(directoryPath) {
  let examplesFiles = await fs.promises.readdir(directoryPath);
  examplesFiles = examplesFiles.map((file) => path.resolve(directoryPath, file));
  const nestedDirectory = examplesFiles.filter((file) => fs.lstatSync(file).isDirectory());
  for (const dir of nestedDirectory) {
    await convertExampleDir(dir);
  }

  // only convert .yml files
  examplesFiles = examplesFiles.filter((file) => path.extname(file) === '.yml' || path.extname(file) === '.yaml');
  examplesFiles.forEach(convertExample);
}
Convert all examples within a single directory and nested directories.

@param {*} directoryPath full path to a directory to convert examples from.