import type { Transformer, TransformerArgs } from "../types";
import type { TransformerResults } from "../runner";
import { getTransformerHelpers } from "../utils/getTransformerHelpers";

// transformer details
const TRANSFORMER = "{{ name }}";
const DESCRIPTION = "{{ description }}";
const INTRODUCED_IN = "{{ introducedIn }}";

export async function transformer({
  root,
  options,
}: TransformerArgs): Promise<TransformerResults> {
  const { log, runner } = getTransformerHelpers({
    transformer: TRANSFORMER,
    rootPath: root,
    options,
  });

  log.info("Short description about {{ name }}")

  /*
    Make changes to required files, and track each modified file with:

    runner.modifyFile({
      filePath: packageJsonPath,   // absolute path to file
      after: transformedFile,      // file after modifications have been made
    });

    This automatically handles all cases of print / dry etc.
  */

  return runner.finish();
}

const transformerMeta: Transformer = {
  name: TRANSFORMER,
  description: DESCRIPTION,
  introducedIn: INTRODUCED_IN,
  transformer,
};

// eslint-disable-next-line import/no-default-export -- transforms require default export
export default transformerMeta;


