import * as plugins from './mod.plugins.js';
import * as paths from '../paths.js';

import { logger } from '../gitzone.logging.js';
import { Project } from '../classes.project.js';

const filesToDelete = ['defaults.yml', 'yarn.lock', 'package-lock.json', 'tslint.json'];

export const run = async (projectArg: Project) => {
  for (const relativeFilePath of filesToDelete) {
    const fileExists = plugins.smartfile.fs.fileExistsSync(relativeFilePath);
    if (fileExists) {
      logger.log('info', `Found ${relativeFilePath}! Removing it!`);
      plugins.smartfile.fs.removeSync(plugins.path.join(paths.cwd, relativeFilePath));
    } else {
      logger.log('info', `Project is free of ${relativeFilePath}`);
    }
  }
};
