{"size": 1847, "ext": "js", "max_stars_repo_path": "index.js", "max_stars_repo_name": "melissadaska/professional-readme-generator", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "index.js", "max_issues_repo_name": "melissadaska/professional-readme-generator", "max_issues_repo_issues_event_min_datetime": "2021-05-11T14:14:11.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-11T14:14:11.000Z", "max_forks_repo_path": "index.js", "max_forks_repo_name": "melissadaska/professional-readme-generator", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 22.5243902439, "max_line_length": 90, "alphanum_fraction": 0.6096372496}
const inquirer = require('inquirer')

const fs = require('fs');

const generateMarkdown = require("./utils/generateMarkdown");

// create array of questions for the user
const questions = [
  // Pass your questions in here
  {
    type: 'input',
    name: 'title',
    message: 'What is the title of your project?'
  },
  {
    type: 'input',
    name: 'describe',
    message: 'Please describe your project.'
  },
  {
      type: 'input',
      name: 'install',
      message: 'What are the steps required to install your project?'
  },
  {
      type: 'input',
      name: 'usage',
      message: 'Provide instructions and examples for use. Include screenshots as needed.'
  },
  {
      type: 'input',
      name: 'credits',
      message: 'Include the links of any collaborators.'
  },
  {
      type: 'list',
      name: 'license',
      message: 'Which license would you like to use?',
      choices: [
        'MIT',
        'Apache',
        'Mozilla',
        'Unlicense'
      ]
  },
  {
      type: 'input',
      name: 'contrib',
      message: 'Would you like others to contribute? If yes, please describe how.'
  },
  {
      type: 'input',
      name: 'tests',
      message: 'Do you have any tests written for your application?'
  },
  {
    type: 'input',
    name: 'email',
    message: 'Please input your email address.'
  },
  { 
    type: 'input',
    name: 'userName',
    message: 'Please input your gitHub username'
  }
];

// function to write README file
async function writeToFile(fileName, data) {
  await fs.promises.writeFile(fileName, data, 'utf-8');
}

// function to initialize program
async function init() {
  const answers = await inquirer.prompt(questions);
  const createMarkdown = generateMarkdown(answers);
  await writeToFile('README.md', createMarkdown);
}

// function call to initialize program
init();
