[
  {
    "path": ".gitattributes",
    "content": "* text=auto\n"
  },
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: CI\n\non:\n  push:\n    branches: ['master']\n  pull_request:\n    branches: ['master']\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/\n        node-version: [lts/*]\n    steps:\n      - uses: actions/checkout@v4\n      - name: Use Node.js ${{ matrix.node-version }}\n        uses: actions/setup-node@v4\n        with:\n          node-version: ${{ matrix.node-version }}\n          cache: 'npm'\n      - run: npm ci\n      - run: npm run test\n"
  },
  {
    "path": ".gitignore",
    "content": "node_modules\ntemp\n"
  },
  {
    "path": ".travis.yml",
    "content": "sudo: false\nlanguage: node_js\nnode_js:\n  - 'stable'\n"
  },
  {
    "path": "README.md",
    "content": "# generator-standard-readme\n\n[![Build Status](https://github.com/RichardLitt/generator-standard-readme/actions/workflows/ci.yml/badge.svg)](https://github.com/RichardLitt/generator-standard-readme/actions/workflows/ci.yml)\n\nScaffold out a Standard Readme\n\nThis generator conforms to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. It creates a minimally compliant standard readme for your cross-language project, with some options.\n\nTip: Use [chalk](https://github.com/sindresorhus/chalk) if you want colors in your CLI.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Fields to fill out](#fields-to-fill-out)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Install\n\nThis generator requires [node](https://nodejs.org), [npm](https://npmjs.com), and [yeoman](http://yeoman.io/).\n\nYou can install it by running:\n\n```sh\nnpm install --global yo generator-standard-readme\n```\n\n## Usage\n\nWith [yo](https://github.com/yeoman/yo):\n\n```\n$ yo standard-readme\n```\n\nThis will write a file, `readme.md`, to the local directory.\n\n### Fields to fill out\n\n`standard-readme` will ask you a set of questions, which will help it fill out the README. These are:\n\n- What do you want to name your module?\n- What is the description of this module?\n- Do have a banner image?\n  - Where is the banner image? Ex: \\'img/banner.png\\'\n- Do you want a TODO dropped where your badges should be?\n- Do you want a TODO dropped where your long description should be?\n- Do you need a prioritized security section?\n- Do you need a background section?\n- Do you need an API section?\n- What is the GitHub handle of the main maintainer?\n- Do you have a CONTRIBUTING.md file?\n- Are PRs accepted?\n- Is an MIT license OK?\n  - What is your license?\n- Who is the License holder (probably your name)?\n- Use the current year?\n  - What years would you like to specify?\n\n## Maintainer\n\n[@RichardLitt](https://github.com/RichardLitt)\n\n## Contributing\n\nPlease contribute! [Look at the issues](https://github.com/RichardLitt/generator-standard-readme/issues).\n\n## License\n\nMIT © 2016 [Richard Littauer](http://burntfen.com)\n"
  },
  {
    "path": "app/bin.js",
    "content": "#!/usr/bin/env node\n\nimport { join } from 'node:path'\nimport { createEnv } from 'yeoman-environment'\n\nconst env = createEnv()\nenv.register(join(import.meta.dirname, '/index.js'), 'standard-readme:app')\nawait env.run('standard-readme:app')\n"
  },
  {
    "path": "app/index.js",
    "content": "import Generator from 'yeoman-generator'\nimport _s from 'underscore.string'\nimport fullName from 'fullname'\nimport { usernameSync } from 'username'\nimport { execSync } from 'node:child_process'\n\nconst domainRegex = /^(((?!-))(xn--|_)?[a-z0-9-]{0,61}[a-z0-9]{1,1}\\.)*(xn--)?([a-z0-9][a-z0-9-]{0,60}|[a-z0-9-]{1,30}\\.[a-z]{2,})$/\n\nexport default class StandardReadmeGenerator extends Generator {\n  /**\n   * @param {string[]} args\n   * @param {import('yeoman-generator').BaseOptions} options\n   * @param {import('yeoman-generator').BaseFeatures?} features\n   */\n  constructor (args, options, features = {}) {\n    // Suppress log about `package.json` being unchanged.\n    features.customInstallTask = true\n    super(args, options, features)\n\n    this.props = {}\n    /** @type {import('yeoman-generator').PromptQuestions} */\n    this.promptQuestions = [\n      {\n        name: 'moduleName',\n        message: 'What is the name of your module?',\n        default: this.appname.replace(/\\s/g, '-'),\n        filter: x => _s.slugify(x)\n      }, {\n        name: 'description',\n        message: 'What is the description of this module?',\n        store: true,\n        validate: x => x.length > 0 ? true : 'You have to provide a module description'\n      }, {\n        name: 'banner',\n        message: 'Do have a banner image?',\n        type: 'confirm',\n        default: false\n      }, {\n        name: 'bannerPath',\n        message: 'Where is the banner image? Ex: \\'img/banner.png\\'',\n        type: 'input',\n        when: (answers) => answers.banner\n      }, {\n        name: 'badge',\n        message: 'Do you want a standard-readme compliant badge?',\n        type: 'confirm',\n        default: true\n      }, {\n        name: 'badges',\n        message: 'Do you want a TODO dropped where more badges should be?',\n        type: 'confirm',\n        default: false\n      }, {\n        name: 'longDescription',\n        message: 'Do you want a TODO dropped where your long description should be?',\n        type: 'confirm',\n        default: true\n      }, {\n        name: 'security',\n        message: 'Do you need a prioritized security section?',\n        type: 'confirm',\n        default: false\n      }, {\n        name: 'background',\n        message: 'Do you need a background section?',\n        type: 'confirm',\n        default: false\n      }, {\n        name: 'API',\n        message: 'Do you need an API section?',\n        type: 'confirm',\n        default: false\n      }, {\n        name: 'hostedDomain',\n        message: 'Where is the project hosted?',\n        type: 'input',\n        default: 'github.com',\n        validate: (val) => {\n          return domainRegex.test(val) ? true : 'You must enter a domain where the project is hosted.'\n        }\n      }, {\n        name: 'mainMaintainer',\n        message: 'What is the username of the main maintainer?',\n        type: 'input',\n        default: async () => {\n          let defaultMaintainer = usernameSync() ?? ''\n          try {\n            defaultMaintainer = execSync('git config user.name', { encoding: 'utf8' }).trim()\n          } catch (_) {}\n\n          return defaultMaintainer\n        },\n        validate: (val) => val.length > 0 ? true : 'You must name a maintainer'\n      }, {\n        name: 'contributingFile',\n        message: 'Do you have a CONTRIBUTING.md file?',\n        type: 'confirm',\n        default: false\n      }, {\n        name: 'prs',\n        message: 'Are PRs accepted?',\n        type: 'confirm',\n        default: true\n      }, {\n        name: 'mit',\n        message: 'Is an MIT license OK?',\n        type: 'confirm',\n        default: true\n      }, {\n        name: 'license',\n        message: 'What is your license?',\n        type: 'input',\n        validate: (val) => {\n          return val.length > 0 ? true : 'You have to provide a license'\n        },\n        when: x => !x.mit\n      }, {\n        name: 'licensee',\n        message: 'Who is the License holder (probably your name)?',\n        type: 'input',\n        default: async ({ mainMaintainer }) => {\n          return (await fullName()) ?? mainMaintainer\n        },\n        validate: x => x.length !== 0 ? true : 'You must attribute the license to someone.'\n      }, {\n        name: 'year',\n        message: 'Use the current year?',\n        type: 'confirm',\n        default: true\n      }, {\n        name: 'diffYear',\n        message: 'What years would you like to specify?',\n        type: 'input',\n        validate: (val) => {\n          return val.length > 0 ? true : 'You must provide a year for the license'\n        },\n        when: x => !x.year\n      }\n    ]\n  }\n\n  async prompting () {\n    this.props = await this.prompt(this.promptQuestions)\n  }\n\n  writing () {\n    this.fs.copyTpl(\n      this.templatePath('README.md'),\n      this.destinationPath('README.md'),\n      this.props\n    )\n  }\n}\n"
  },
  {
    "path": "app/templates/README.md",
    "content": "# <%= moduleName %>\n<% if (banner) { %>\n![banner](<%= bannerPath %>)\n<% } %><% if (badge) { %>\n[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)<% } %><% if (badges) { %>\nTODO: Put more badges here.<% } %>\n\n<%= description %>\n\n<% if (longDescription) { %>TODO: Fill out this long description.\n\n<% } %>## Table of Contents\n\n<% if (security) { %>- [Security](#security)\n<% } %><% if (background) { %>- [Background](#background)\n<% } %>- [Install](#install)\n- [Usage](#usage)\n<% if (API) { %>- [API](#api)\n<% } %><% if (mainMaintainer) { %>- [Maintainers](#maintainers)\n<% } %>- [Contributing](#contributing)\n- [License](#license)\n\n<% if (security) { %>## Security\n\n<% } %><% if (background) { %>## Background\n\n<% } %>## Install\n\n```sh\n```\n\n## Usage\n\n```sh\n```\n\n<% if (API) { %>## API\n\n<% } %>## Maintainers\n\n[@<%= mainMaintainer %>](https://<%= hostedDomain %>/<%= mainMaintainer %>)\n\n## Contributing\n\n<% if (contributingFile) { %>See [the contributing file](contributing.md)!\n\n<% } %><% if (prs) { %>PRs accepted.<% } %>\n\nSmall note: If editing the README, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\n<% if (mit) { %>MIT<% } %><% if (!mit && license) { %><%= license %><% } %> © <% if (year) { %><%= new Date().getFullYear() %><% } else { %><%= diffYear %><% } %> <%= licensee %>\n"
  },
  {
    "path": "examples/api-readme.md",
    "content": "# module-name\n\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\ndescription\n\nTODO: Fill out this long description.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [API](#api)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Install\n\n```sh\n```\n\n## Usage\n\n```sh\n```\n\n## API\n\n## Maintainers\n\n[@RichardLitt](https://github.com/RichardLitt)\n\n## Contributing\n\nPRs accepted.\n\nSmall note: If editing the README, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\nMIT © 2018 Richard McRichface\n"
  },
  {
    "path": "examples/background-readme.md",
    "content": "# module-name\n\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\ndescription\n\nTODO: Fill out this long description.\n\n## Table of Contents\n\n- [Background](#background)\n- [Install](#install)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Background\n\n## Install\n\n```sh\n```\n\n## Usage\n\n```sh\n```\n\n## Maintainers\n\n[@RichardLitt](https://github.com/RichardLitt)\n\n## Contributing\n\nPRs accepted.\n\nSmall note: If editing the README, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\nMIT © 2018 Richard McRichface\n"
  },
  {
    "path": "examples/badges-readme.md",
    "content": "# module-name\n\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\nTODO: Put more badges here.\n\ndescription\n\nTODO: Fill out this long description.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Install\n\n```sh\n```\n\n## Usage\n\n```sh\n```\n\n## Maintainers\n\n[@RichardLitt](https://github.com/RichardLitt)\n\n## Contributing\n\nPRs accepted.\n\nSmall note: If editing the README, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\nMIT © 2018 Richard McRichface\n"
  },
  {
    "path": "examples/banner-readme.md",
    "content": "# module-name\n\n![banner](test/banner.png)\n\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\ndescription\n\nTODO: Fill out this long description.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Install\n\n```sh\n```\n\n## Usage\n\n```sh\n```\n\n## Maintainers\n\n[@RichardLitt](https://github.com/RichardLitt)\n\n## Contributing\n\nPRs accepted.\n\nSmall note: If editing the README, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\nMIT © 2018 Richard McRichface\n"
  },
  {
    "path": "examples/contributing-file-readme.md",
    "content": "# module-name\n\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\ndescription\n\nTODO: Fill out this long description.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Install\n\n```sh\n```\n\n## Usage\n\n```sh\n```\n\n## Maintainers\n\n[@RichardLitt](https://github.com/RichardLitt)\n\n## Contributing\n\nSee [the contributing file](contributing.md)!\n\nPRs accepted.\n\nSmall note: If editing the README, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\nMIT © 2018 Richard McRichface\n"
  },
  {
    "path": "examples/default-readme.md",
    "content": "# module-name\n\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\ndescription\n\nTODO: Fill out this long description.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Install\n\n```sh\n```\n\n## Usage\n\n```sh\n```\n\n## Maintainers\n\n[@RichardLitt](https://github.com/RichardLitt)\n\n## Contributing\n\nPRs accepted.\n\nSmall note: If editing the README, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\nMIT © 2018 Richard McRichface\n"
  },
  {
    "path": "examples/different-license-readme.md",
    "content": "# module-name\n\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\ndescription\n\nTODO: Fill out this long description.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Install\n\n```sh\n```\n\n## Usage\n\n```sh\n```\n\n## Maintainers\n\n[@RichardLitt](https://github.com/RichardLitt)\n\n## Contributing\n\nPRs accepted.\n\nSmall note: If editing the README, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\nCC BY-SA 4.0 © 2018 Richard McRichface\n"
  },
  {
    "path": "examples/different-year.md",
    "content": "# module-name\n\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\ndescription\n\nTODO: Fill out this long description.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Install\n\n```sh\n```\n\n## Usage\n\n```sh\n```\n\n## Maintainers\n\n[@RichardLitt](https://github.com/RichardLitt)\n\n## Contributing\n\nPRs accepted.\n\nSmall note: If editing the README, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\nMIT © 2016 Richard McRichface\n"
  },
  {
    "path": "examples/maximal-readme.md",
    "content": "# example\n\n![banner](test)\n\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\nTODO: Put more badges here.\n\ndescription\n\nTODO: Fill out this long description.\n\n## Table of Contents\n\n- [Security](#security)\n- [Background](#background)\n- [Install](#install)\n- [Usage](#usage)\n- [API](#api)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Security\n\n## Background\n\n## Install\n\n```sh\n```\n\n## Usage\n\n```sh\n```\n\n## API\n\n## Maintainers\n\n[@RichardLitt](https://github.com/RichardLitt)\n\n## Contributing\n\nSee [the contributing file](contributing.md)!\n\nPRs accepted.\n\nSmall note: If editing the README, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\nMIT © 2018 Richard McRichface\n"
  },
  {
    "path": "examples/no-badge-readme.md",
    "content": "# module-name\n\n\ndescription\n\nTODO: Fill out this long description.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Install\n\n```sh\n```\n\n## Usage\n\n```sh\n```\n\n## Maintainers\n\n[@RichardLitt](https://github.com/RichardLitt)\n\n## Contributing\n\nPRs accepted.\n\nSmall note: If editing the README, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\nMIT © 2018 Richard McRichface\n"
  },
  {
    "path": "examples/no-long-description-readme.md",
    "content": "# module-name\n\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\ndescription\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Install\n\n```sh\n```\n\n## Usage\n\n```sh\n```\n\n## Maintainers\n\n[@RichardLitt](https://github.com/RichardLitt)\n\n## Contributing\n\nPRs accepted.\n\nSmall note: If editing the README, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\nMIT © 2018 Richard McRichface\n"
  },
  {
    "path": "examples/prs-readme.md",
    "content": "# module-name\n\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\ndescription\n\nTODO: Fill out this long description.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Install\n\n```sh\n```\n\n## Usage\n\n```sh\n```\n\n## Maintainers\n\n[@RichardLitt](https://github.com/RichardLitt)\n\n## Contributing\n\n\n\nSmall note: If editing the README, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\nMIT © 2018 Richard McRichface\n"
  },
  {
    "path": "examples/security-readme.md",
    "content": "# module-name\n\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\ndescription\n\nTODO: Fill out this long description.\n\n## Table of Contents\n\n- [Security](#security)\n- [Install](#install)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Security\n\n## Install\n\n```sh\n```\n\n## Usage\n\n```sh\n```\n\n## Maintainers\n\n[@RichardLitt](https://github.com/RichardLitt)\n\n## Contributing\n\nPRs accepted.\n\nSmall note: If editing the README, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\nMIT © 2018 Richard McRichface\n"
  },
  {
    "path": "license",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2016 Richard Littauer <richard.littauer@gmail.com> (burntfen.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"generator-standard-readme\",\n  \"version\": \"1.1.0\",\n  \"description\": \"Scaffold out a Standard Readme\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/RichardLitt/generator-standard-readme.git\"\n  },\n  \"homepage\": \"https://github.com/RichardLitt/generator-standard-readme\",\n  \"bugs\": \"https://github.com/RichardLitt/generator-standard-readme/issues\",\n  \"author\": {\n    \"name\": \"Richard Littauer\",\n    \"email\": \"richard.littauer@gmail.com\",\n    \"url\": \"burntfen.com\"\n  },\n  \"scripts\": {\n    \"lint\": \"standard\",\n    \"test\": \"standard && vitest run\"\n  },\n  \"keywords\": [\n    \"yeoman-generator\",\n    \"plugin\",\n    \"boilerplate\",\n    \"template\",\n    \"scaffold\",\n    \"readme\",\n    \"standard\"\n  ],\n  \"type\": \"module\",\n  \"main\": \"app/index.js\",\n  \"dependencies\": {\n    \"fullname\": \"^5.0.0\",\n    \"underscore.string\": \"^3.3.6\",\n    \"username\": \"^7.0.0\",\n    \"yeoman-environment\": \"^4.4.3\",\n    \"yeoman-generator\": \"^7.5.1\"\n  },\n  \"devDependencies\": {\n    \"standard\": \"^17.1.2\",\n    \"vitest\": \"^3.0.9\",\n    \"yeoman-test\": \"^10.1.0\"\n  },\n  \"packageManager\": \"npm@11.2.0\",\n  \"standard\": {\n    \"ignore\": [\n      \"app/templates/\"\n    ]\n  },\n  \"coordinates\": [\n    45.5191807,\n    -73.5789459\n  ]\n}\n"
  },
  {
    "path": "test.js",
    "content": "import fullName from 'fullname'\nimport assert from 'node:assert/strict'\nimport { existsSync, mkdirSync, readFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { beforeEach, describe, test } from 'vitest'\nimport helpers, { result } from 'yeoman-test'\nimport Environment from 'yeoman-environment'\n\nimport StandardReadmeGenerator from './app'\n\n// Keeping default answers from generator synced with defaults used in tests.\nconst generator = new StandardReadmeGenerator([], {\n  resolved: '',\n  namespace: '',\n  env: new Environment({ skipInstall: true }),\n  'skip-install': true\n})\n// [{ name , default, ... }, ...] => { [name]: default, ... }\nconst defaultAnswers = generator.promptQuestions.reduce((acc, curr) => {\n  if (Object.hasOwn(curr, 'default')) {\n    acc[curr.name] = curr.default\n  }\n  return acc\n}, {})\nconst testDefaultAnswers = Object.freeze({\n  ...defaultAnswers,\n  // Default values for the sake of the tests.\n  moduleName: 'module-name',\n  description: 'description',\n  mainMaintainer: 'RichardLitt',\n  licensee: 'Richard McRichface',\n  year: false,\n  diffYear: '2018'\n})\n\ndescribe('standard-readme:app', () => {\n  const customTempDir = join(__dirname, './temp')\n  const exampleDir = join(__dirname, './examples')\n  if (!existsSync(customTempDir)) {\n    mkdirSync(customTempDir, { recursive: true })\n  }\n\n  /** @type {import('yeoman-test').RunContext} */\n  let runContext\n\n  beforeEach(async () => {\n    await helpers\n      .prepareTemporaryDir({\n        cwd: customTempDir\n      })\n    runContext = result\n      .create(join(__dirname, './app'))\n      .withAnswers(testDefaultAnswers, { throwOnMissingAnswer: true })\n  })\n\n  test('generates default README (given test defaults)', async () => {\n    await runContext\n      .run()\n\n    assert.strictEqual(\n      readFileSync(join(customTempDir, 'README.md')).toString(),\n      readFileSync(join(exampleDir, 'default-readme.md')).toString()\n    )\n  })\n\n  test('generates maximal README when all options/sections are included', async () => {\n    await result\n      .create(join(__dirname, './app'))\n      .withAnswers({\n        moduleName: 'example',\n        description: 'description',\n        banner: true,\n        bannerPath: 'test',\n        badge: true,\n        badges: true,\n        longDescription: true,\n        security: true,\n        background: true,\n        API: true,\n        mainMaintainer: 'RichardLitt',\n        hostedDomain: 'github.com',\n        contributingFile: true,\n        prs: true,\n        mit: true,\n        // license: 'CC BY-SA 4.0',\n        licensee: 'Richard McRichface',\n        year: false,\n        diffYear: '2018'\n      })\n      .run()\n\n    assert.strictEqual(\n      readFileSync(join(customTempDir, 'README.md')).toString(),\n      readFileSync(join(exampleDir, 'maximal-readme.md')).toString()\n    )\n  })\n\n  describe('moduleName', () => {\n    const newModuleName = 'foo-module-name'\n\n    test('generates README with fallback value (`generator.appname`) when omitted', async () => {\n      await runContext\n        .withAnswers({\n          moduleName: undefined\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'default-readme.md')).toString()\n          .replace(testDefaultAnswers.moduleName, runContext.generator.appname)\n      )\n    })\n\n    test('generates README with provided moduleName', async () => {\n      await runContext\n        .withAnswers({\n          moduleName: newModuleName\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'default-readme.md')).toString()\n          .replace(testDefaultAnswers.moduleName, newModuleName)\n      )\n    })\n\n    test('generates README using slugified moduleName', async () => {\n      const moduleNames = [\n        newModuleName.replace('-', ' '),\n        newModuleName.replace('-', '_'),\n        newModuleName.toUpperCase()\n      ]\n      for (const moduleName of moduleNames) {\n        // Need to reset test environment to avoid prompt abort error\n        // on subsequent loops.\n        await helpers.prepareTemporaryDir({\n          cwd: customTempDir\n        })\n        runContext = result\n          .create(join(__dirname, './app'))\n          .withAnswers(testDefaultAnswers)\n\n        await runContext\n          .withAnswers({\n            moduleName\n          })\n          .run()\n\n        assert.strictEqual(\n          readFileSync(join(customTempDir, 'README.md')).toString(),\n          readFileSync(join(exampleDir, 'default-readme.md')).toString()\n            .replace(testDefaultAnswers.moduleName, newModuleName)\n        )\n      }\n    })\n  })\n\n  describe('description', () => {\n    test('fails to generate README when answer is omitted', async () => {\n      const promise = runContext\n        .withAnswers({\n          description: undefined\n        })\n        .run()\n\n      await assert.rejects(promise, {\n        message: 'yeoman-test: question description was asked but answer was not provided'\n      })\n    })\n\n    test('generates README with provided description', async () => {\n      const newDescription = 'foo description'\n\n      await runContext.withAnswers({\n        description: newDescription\n      })\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'default-readme.md')).toString()\n          .replace(testDefaultAnswers.description, newDescription)\n      )\n    })\n  })\n\n  describe('banner/bannerPath', () => {\n    test('fails to generate if only banner is true', async () => {\n      const promise = runContext\n        .withAnswers({\n          banner: true\n        })\n        .run()\n\n      await assert.rejects(promise, {\n        message: 'yeoman-test: question bannerPath was asked but answer was not provided'\n      })\n    })\n\n    test('generates default README if only bannerPath is specified', async () => {\n      await runContext\n        .withAnswers({\n          bannerPath: 'test/banner.png'\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'default-readme.md')).toString()\n      )\n    })\n\n    test('generates README with provided banner', async () => {\n      await runContext\n        .withAnswers({\n          banner: true,\n          bannerPath: 'test/banner.png'\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'banner-readme.md')).toString()\n      )\n    })\n  })\n\n  describe('badge/badges', () => {\n    test('generates README without badge', async () => {\n      await runContext\n        .withAnswers({\n          badge: false\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'no-badge-readme.md')).toString()\n      )\n    })\n\n    test('generates README with badges TODO', async () => {\n      await runContext\n        .withAnswers({\n          badges: true\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'badges-readme.md')).toString()\n      )\n    })\n  })\n\n  describe('longDescription', () => {\n    test('generates README without TODO for long description', async () => {\n      await runContext\n        .withAnswers({\n          longDescription: false\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'no-long-description-readme.md')).toString()\n      )\n    })\n  })\n\n  describe('security', () => {\n    test('generates README with security section', async () => {\n      await runContext\n        .withAnswers({\n          security: true\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'security-readme.md')).toString()\n      )\n    })\n  })\n\n  describe('background', () => {\n    test('generates README with background section', async () => {\n      await runContext\n        .withAnswers({\n          background: true\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'background-readme.md')).toString()\n      )\n    })\n  })\n\n  describe('API', () => {\n    test('generates README with API section', async () => {\n      await runContext\n        .withAnswers({\n          API: true\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'api-readme.md')).toString()\n      )\n    })\n  })\n\n  describe('hostedDomain', () => {\n    test('generates README with specified hosted domain', async () => {\n      await runContext\n        .withAnswers({\n          hostedDomain: 'gitlab.com'\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'default-readme.md'))\n          .toString()\n          .replace(\n            '[@RichardLitt](https://github.com/RichardLitt)',\n            '[@RichardLitt](https://gitlab.com/RichardLitt)'\n          )\n      )\n    })\n  })\n\n  describe('mainMaintainer', () => {\n    test('generates README when answer is omitted', async () => {\n      await runContext\n        .withAnswers({\n          mainMaintainer: undefined\n        })\n        .run()\n\n      const expectedMaintainer = await defaultAnswers.mainMaintainer()\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'default-readme.md'))\n          .toString()\n          .replace(\n            `[@${testDefaultAnswers.mainMaintainer}](https://github.com/${testDefaultAnswers.mainMaintainer})`,\n            `[@${expectedMaintainer}](https://github.com/${expectedMaintainer})`\n          )\n      )\n    })\n  })\n\n  describe('contributingFile', () => {\n    test('generates README with contributing file', async () => {\n      await runContext\n        .withAnswers({\n          contributingFile: true\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'contributing-file-readme.md')).toString()\n      )\n    })\n  })\n\n  describe('prs', () => {\n    test('generates README when prs is omitted', async () => {\n      await runContext\n        .withAnswers({\n          prs: false\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'prs-readme.md')).toString()\n      )\n    })\n  })\n\n  describe('mit/license/licensee', () => {\n    test('fails to generate README when `mit` is false and no other license is specified', async () => {\n      const promise = runContext\n        .withAnswers({\n          mit: false,\n          license: undefined\n        })\n        .run()\n\n      await assert.rejects(promise, {\n        message: 'yeoman-test: question license was asked but answer was not provided'\n      })\n    })\n\n    test('generates README with license different from MIT', async () => {\n      await runContext\n        .withAnswers({\n          mit: false,\n          license: 'CC BY-SA 4.0'\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'different-license-readme.md')).toString()\n      )\n    })\n\n    test('generates README defaulting to MIT license, even when other license specified', async () => {\n      await runContext\n        .withAnswers({\n          mit: true,\n          license: 'CC BY-SA 4.0'\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'default-readme.md')).toString()\n      )\n    })\n\n    test('generates README with suggested licensee full name', async () => {\n      await runContext\n        .withAnswers({\n          licensee: undefined\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'default-readme.md'))\n          .toString()\n          .replace(\n            'Richard McRichface',\n            (await fullName()) ?? (await testDefaultAnswers.mainMaintainer)\n          )\n      )\n    })\n  })\n\n  describe('year', () => {\n    test('fails to generate README when present year not used and diff year not specified', async () => {\n      const promise = runContext\n        .withAnswers({\n          year: false,\n          diffYear: undefined\n        })\n        .run()\n\n      await assert.rejects(promise, {\n        message: 'yeoman-test: question diffYear was asked but answer was not provided'\n      })\n    })\n\n    test('generates README with provided year', async () => {\n      await runContext\n        .withAnswers({\n          year: false,\n          diffYear: '2016'\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'different-year.md')).toString()\n      )\n    })\n\n    test('generates README without different year when present year is confirmed', async () => {\n      await runContext\n        .withAnswers({\n          year: true,\n          diffYear: '2016'\n        })\n        .run()\n\n      assert.strictEqual(\n        readFileSync(join(customTempDir, 'README.md')).toString(),\n        readFileSync(join(exampleDir, 'default-readme.md')).toString()\n          .replace('2018', new Date().getFullYear())\n      )\n    })\n  })\n})\n"
  },
  {
    "path": "vitest.config.js",
    "content": "import { defineConfig } from 'vitest/config'\n\nexport default defineConfig({\n  test: {\n    include: ['**/*test.js'],\n    onConsoleLog (log, type) {\n      // Suppress expected stderr messages for test cases w/ missing answers.\n      if (\n        type === 'stderr' &&\n        /yeoman-test: question \\w+ was asked but answer was not provided/.test(\n          log\n        )\n      ) {\n        return false\n      }\n\n      return true\n    }\n  }\n})\n"
  }
]