├── CODE_OF_CONDUCT.md ├── .commitlintrc.json ├── .editorconfig ├── .eslintignore ├── .gitattributes ├── .github ├── img │ └── banner.png └── workflows │ ├── check.yml │ └── publish_in_npm.yml ├── .gitignore ├── .husky ├── commit-msg ├── post-merge ├── pre-commit └── pre-push ├── .nvmrc ├── .versionrc.json ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── __helpers__ └── index.js ├── __tests__ ├── baseUrl.test.js ├── basic.test.js └── githubActions.test.js ├── generators └── app │ ├── index.js │ └── templates │ ├── css │ └── custom.css │ ├── docs │ └── welcome.mdx │ ├── github │ └── pr_health_check.yml │ ├── husky │ ├── commit-msg │ ├── post-merge │ ├── pre-commit │ └── pre-push │ ├── img │ ├── favicon.ico │ └── logo.png │ ├── root │ ├── _.commitlintrc.json │ ├── _.dockerignore │ ├── _.gitignore │ ├── _.nvmrc │ ├── _.versionrc.json │ ├── _Dockerfile │ ├── _README.md │ ├── _babel.config.js │ ├── _docusaurus.config.js │ ├── _package.json │ └── _sidebars.js │ └── static │ └── _.nojekyll ├── package-lock.json └── package.json / CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to make participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies within all project spaces, and it also applies when 49 | an individual is representing the project or its community in public spaces. 50 | Examples of representing a project or community include using an official 51 | project e-mail address, posting via an official social media account, or acting 52 | as an appointed representative at an online or offline event. Representation of 53 | a project may be further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at [Twitter using DMs (open)](https://twitter.com/kom_256). All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq -------------------------------------------------------------------------------- /.commitlintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["@commitlint/config-conventional"] 3 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | coverage 2 | **/templates 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.github/img/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UlisesGascon/generator-fast-documentation/84f6388060bb3dbe6c024b2645e9d6ea555d25d5/.github/img/banner.png -------------------------------------------------------------------------------- /.github/workflows/check.yml: -------------------------------------------------------------------------------- 1 | name: Check Library 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | strategy: 13 | matrix: 14 | node-version: [14.x, 16.x, 18.x, 19.x] 15 | steps: 16 | - uses: actions/checkout@v2 17 | - name: Set up Node.js version ${{ matrix.node-version }} 18 | uses: actions/setup-node@v2 19 | with: 20 | node-version: ${{ matrix.node-version }} 21 | cache: 'npm' 22 | - run: npm ci 23 | - run: npm run lint 24 | - run: npm run test -------------------------------------------------------------------------------- /.github/workflows/publish_in_npm.yml: -------------------------------------------------------------------------------- 1 | name: Publish Library in NPM 2 | on: 3 | release: 4 | types: [ created ] 5 | jobs: 6 | publish-npm: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - uses: actions/setup-node@v2 11 | with: 12 | node-version: 18 13 | - run: npm ci 14 | - name: Publish 15 | run: | 16 | npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} 17 | npm publish --ignore-scripts --access public 18 | env: 19 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | .vscode/ -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no -- commitlint --edit "$1" 5 | -------------------------------------------------------------------------------- /.husky/post-merge: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm install && npm install --package-lock-only 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm run lint 5 | -------------------------------------------------------------------------------- /.husky/pre-push: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm run lint && npm run test 5 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 14.21.1 2 | -------------------------------------------------------------------------------- /.versionrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "types": [ 3 | {"type": "feat", "section": "Features"}, 4 | {"type": "fix", "section": "Bug Fixes"}, 5 | {"type": "chore", "section": "Other"}, 6 | {"type": "docs", "section": "Other"}, 7 | {"type": "style", "hidden": true}, 8 | {"type": "refactor", "section": "Other"}, 9 | {"type": "perf", "hidden": true}, 10 | {"type": "test", "hidden": true} 11 | ], 12 | "commitUrlFormat": "https://github.com/UlisesGascon/generator-fast-documentation/commit/{{hash}}", 13 | "compareUrlFormat": "https://github.com/UlisesGascon/generator-fast-documentation/{{previousTag}}...{{currentTag}}" 14 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. 4 | 5 | ### [1.1.1](https://github.com/UlisesGascon/generator-fast-documentation/v1.1.0...v1.1.1) (2023-02-03) 6 | 7 | 8 | ### Other 9 | 10 | * added youtube tutorial ([3f7b9ee](https://github.com/UlisesGascon/generator-fast-documentation/commit/3f7b9ee0a27911e45d754c8bdc18b2598654ba08)) 11 | 12 | ## [1.1.0](https://github.com/UlisesGascon/generator-fast-documentation/v1.0.0...v1.1.0) (2022-11-17) 13 | 14 | 15 | ### Features 16 | 17 | * added docker build step to CI ([d420c94](https://github.com/UlisesGascon/generator-fast-documentation/commit/d420c949cc581ad81d025e5c002f22cfd0028853)) 18 | 19 | 20 | ### Bug Fixes 21 | 22 | * typo in the CI job name ([eea0f10](https://github.com/UlisesGascon/generator-fast-documentation/commit/eea0f1083e7abae1f9b8ddd9120aa626d7fd2649)) 23 | 24 | 25 | ### Other 26 | 27 | * added markdown/mdx reference ([49a2402](https://github.com/UlisesGascon/generator-fast-documentation/commit/49a24023f02364e15960a8ae37964faccd9b8cce)) 28 | 29 | ## [1.0.0](https://github.com/UlisesGascon/generator-fast-documentation/v0.0.1...v1.0.0) (2022-11-17) 30 | 31 | 32 | ### Features 33 | 34 | * added main generator business logic ([6198da9](https://github.com/UlisesGascon/generator-fast-documentation/commit/6198da941ad0ab6f764a3e04e2c531587ee8670e)) 35 | * added tests ([aac49bb](https://github.com/UlisesGascon/generator-fast-documentation/commit/aac49bb8c573bc52ee171754ed441eb805edaad7)) 36 | 37 | 38 | ### Other 39 | 40 | * added proper documentation ([74df226](https://github.com/UlisesGascon/generator-fast-documentation/commit/74df226ca0fa2d422c5f97b8aa10a7d4402f5e65)) 41 | 42 | ### [0.0.1](https://github.com/UlisesGascon/generator-fast-documentation/v0.0.0...v0.0.1) (2022-11-17) 43 | 44 | 45 | ### Bug Fixes 46 | 47 | * changelog ajustments ([cc356ff](https://github.com/UlisesGascon/generator-fast-documentation/commit/cc356ff71f29d3b914d9e316d414f4082ff0ec95)) 48 | * typo ([30464ae](https://github.com/UlisesGascon/generator-fast-documentation/commit/30464ae7f7ab16a3200e4fb0c6a77c7ce6949fa9)) 49 | 50 | 51 | ### Other 52 | 53 | * added CI pipelines ([d4536fd](https://github.com/UlisesGascon/generator-fast-documentation/commit/d4536fd87c9144d391d0d56576eb06ce11669f5e)) 54 | * added CoC ([6cefa85](https://github.com/UlisesGascon/generator-fast-documentation/commit/6cefa855afc5f44a654bd9150cd23009930b382f)) 55 | * added MIT license ([056b4da](https://github.com/UlisesGascon/generator-fast-documentation/commit/056b4da420fd11dc0850508e5ced75f6a3179142)) 56 | * added project initialization ([27ea1d5](https://github.com/UlisesGascon/generator-fast-documentation/commit/27ea1d522c8e27cc703cddddc80dd05c7d41d516)) 57 | * added sample generator ([908b9b2](https://github.com/UlisesGascon/generator-fast-documentation/commit/908b9b2f6bc2083bb1c83d1a59f3fadbb09679f8)) 58 | * contributions are welcome! ([6942186](https://github.com/UlisesGascon/generator-fast-documentation/commit/69421869d2606731cc6aeef11b101a2a0fc0706d)) 59 | * ensure compatibility with nodejs@14 ([bf30c72](https://github.com/UlisesGascon/generator-fast-documentation/commit/bf30c721f42b0ec955e697597d376763e92e83cf)) 60 | 61 | ## 0.0.0 (2022-11-17) 62 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | When contributing to this repository, please first discuss the change you wish to make via issue or any other method with the owners of this repository before making a change. 4 | 5 | Please note we have a [code of conduct](CODE_OF_CONDUCT.md), please follow it in all your interactions with the project. 6 | 7 | ## Pull Request Process 8 | 9 | 1. Ensure any install or build dependencies are removed before the end of the layer when doing a build. 10 | 2. Update the README.md with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters. 11 | 3. Increase the version numbers in any examples files and the README.md to the new version that this Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/). 12 | 4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2022 Ulises Gascón (https://ulisesgascon.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 |

3 | generator-fast-documentation 4 |

5 | 6 |

7 | A yeoman-based template to generate a great documentation website 8 |

9 | 10 |

11 | npm version 12 | license 13 | downloads 14 | Known Vulnerabilities 15 |

16 | 17 |

18 | 19 | # About 20 | 21 | A yeoman-based template to generate a great documentation website. 22 | 23 | ❤️ Awesome Features: 24 | 25 | - Ship fast! Docker support. 🔥 26 | - Opinionated Docusaurus config out-of-the-box 🍺 27 | - Easy control releases with standard-release out-of-the-box 🎉 28 | - Simple CI with github Actions out-of-the-box 📦 29 | - Just few simple questions to generate the perfect documentation 💪 30 | - Easy to use and great test coverage ✅ 31 | - Add your content with [Markdown](https://docusaurus.io/docs/markdown-features) and [MDX](https://docusaurus.io/docs/markdown-features/react) 🚂 32 | 33 | 34 | ## Tutorial 35 | 36 | [![promotional banner from youtube](.github/img/banner.png)](https://youtu.be/Gpdw-oDIgBQ) 37 | 38 | ## Usage 39 | 40 | You need to install [Yeoman](https://www.npmjs.com/package/yo) 41 | 42 | ```bash 43 | npm i -g generator-fast-documentation 44 | yo fast-documentation 45 | ``` 46 | 47 | ## Built With 48 | 49 | Development only: 50 | 51 | - [@commitlint/cli](https://www.npmjs.com/package/@commitlint/cli) - Lint commit messages 52 | - [@commitlint/config-conventional](https://www.npmjs.com/package/@commitlint/config-conventional) - npm i @commitlint/config-conventional 53 | - [jest](https://www.npmjs.com/package/jest) - Delightful JavaScript Testing 54 | - [standard](https://www.npmjs.com/package/standard) - JavaScript style guide, linter, and formatter 55 | - [standard-version](https://www.npmjs.com/package/standard-version) - A utility for versioning using semver and CHANGELOG generation powered by Conventional Commits. 56 | - [yeoman-assert](https://www.npmjs.com/package/yeoman-assert) - yeoman-assert is extending the native Node.js assert module. 57 | - [yeoman-test](https://www.npmjs.com/package/yeoman-test) - Test utilities for Yeoman generators 58 | - [husky](https://www.npmjs.com/package/husky) - Modern native Git hooks made easy 59 | 60 | Production only: 61 | 62 | - [chalk](https://www.npmjs.com/package/chalk) - Terminal string styling done right 63 | - [yeoman-generator](https://www.npmjs.com/package/yeoman-generator) - Rails-inspired generator system that provides scaffolding for your apps 64 | - [yosay](https://www.npmjs.com/package/yosay) - Tell Yeoman what to say 65 | 66 | ## Contributing 67 | 68 | Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. 69 | 70 | ## Versioning 71 | 72 | We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/ulisesGascon/generator-fast-documentation/tags). 73 | 74 | ## Authors 75 | 76 | - **Ulises Gascón** - *Initial work- - [@ulisesGascon](https://github.com/ulisesGascon) 77 | 78 | See also the list of [contributors](https://github.com/ulisesGascon/generator-fast-documentation/contributors) who participated in this project. 79 | 80 | ## License 81 | 82 | This project is licensed under the GNU AGPL3.0 License - see the [LICENSE.md](LICENSE.md) file for details 83 | 84 | ## Acknowledgments 85 | 86 | - This project is under development, but you can help us to improve it! We :heart: FOSS! -------------------------------------------------------------------------------- /__helpers__/index.js: -------------------------------------------------------------------------------- 1 | const helpers = require('yeoman-test') 2 | const path = require('path') 3 | 4 | const simpleDocsProps = { 5 | title: 'Acme Library Docs', 6 | tagLine: 'The most accurate documentation ever made', 7 | url: 'https://library.acme.com', 8 | baseUrl: '/', 9 | gitUrl: 'https://git.acme.com', 10 | includeGithubActions: false, 11 | includeQuickStart: false 12 | } 13 | 14 | const generateDoc = props => helpers.run(path.join(__dirname, '../generators/app')).withPrompts(props) 15 | 16 | module.exports = { 17 | generateDoc, 18 | simpleDocsProps 19 | } 20 | -------------------------------------------------------------------------------- /__tests__/baseUrl.test.js: -------------------------------------------------------------------------------- 1 | const assert = require('yeoman-assert') 2 | const { generateDoc, simpleDocsProps } = require('../__helpers__') 3 | 4 | describe('generator-fast-documentation: Base Url', () => { 5 | it('should use DEFAULT base url', async () => { 6 | await generateDoc(simpleDocsProps) 7 | assert.fileContent('docusaurus.config.js', 'baseUrl: \'/\'') 8 | }) 9 | 10 | it('should use CUSTOM base url', async () => { 11 | const baseUrl = '/my-custom-baseurl/' 12 | await generateDoc({ ...simpleDocsProps, baseUrl }) 13 | assert.fileContent('docusaurus.config.js', `baseUrl: '${baseUrl}'`) 14 | }) 15 | }) 16 | -------------------------------------------------------------------------------- /__tests__/basic.test.js: -------------------------------------------------------------------------------- 1 | const assert = require('yeoman-assert') 2 | const { generateDoc, simpleDocsProps } = require('../__helpers__') 3 | 4 | describe('generator-fast-documentation: Basic', () => { 5 | it('should COPY the expected files', async () => { 6 | await generateDoc(simpleDocsProps) 7 | assert.file([ 8 | // Root 9 | '.commitlintrc.json', 10 | '.dockerignore', 11 | '.gitignore', 12 | '.nvmrc', 13 | '.versionrc.json', 14 | 'babel.config.js', 15 | 'Dockerfile', 16 | 'docusaurus.config.js', 17 | 'package.json', 18 | 'README.md', 19 | 'sidebars.js', 20 | // Static 21 | 'static/.nojekyll', 22 | 'static/img/logo.png', 23 | 'static/img/favicon.ico', 24 | // docs 25 | 'docs/welcome.mdx', 26 | // src 27 | 'src/css/custom.css', 28 | // .husky 29 | '.husky/commit-msg', 30 | '.husky/post-merge', 31 | '.husky/pre-commit', 32 | '.husky/pre-push' 33 | ]) 34 | }) 35 | 36 | it('should CUSTOMIZE some files', async () => { 37 | await generateDoc(simpleDocsProps) 38 | assert.fileContent('README.md', simpleDocsProps.title) 39 | assert.fileContent('README.md', simpleDocsProps.tagLine) 40 | assert.fileContent('.versionrc.json', simpleDocsProps.gitUrl) 41 | assert.fileContent('docusaurus.config.js', `title: '${simpleDocsProps.title}'`) 42 | assert.fileContent('docusaurus.config.js', `tagline: '${simpleDocsProps.tagLine}'`) 43 | assert.fileContent('docusaurus.config.js', `url: '${simpleDocsProps.url}'`) 44 | assert.fileContent('docusaurus.config.js', `href: '${simpleDocsProps.gitUrl}'`) 45 | }) 46 | }) 47 | -------------------------------------------------------------------------------- /__tests__/githubActions.test.js: -------------------------------------------------------------------------------- 1 | const assert = require('yeoman-assert') 2 | const { generateDoc, simpleDocsProps } = require('../__helpers__') 3 | 4 | describe('generator-fast-documentation: Github Actions', () => { 5 | it('Should INCLUDE the github actions', async () => { 6 | await generateDoc({ ...simpleDocsProps, includeGithubActions: true }) 7 | assert.file(['.github/workflows/pr_health_check.yml']) 8 | }) 9 | it('Should NOT INCLUDE the github actions', async () => { 10 | await generateDoc({ ...simpleDocsProps, includeGithubActions: false }) 11 | assert.noFile(['.github/workflows/pr_health_check.yml']) 12 | }) 13 | }) 14 | -------------------------------------------------------------------------------- /generators/app/index.js: -------------------------------------------------------------------------------- 1 | /* eslint no-useless-escape:0 */ 2 | const Generator = require('yeoman-generator') 3 | const chalk = require('chalk') 4 | const yosay = require('yosay') 5 | 6 | const fs = require('fs') 7 | const path = require('path') 8 | 9 | module.exports = class extends Generator { 10 | prompting () { 11 | // Have Yeoman greet the user. 12 | this.log( 13 | yosay( 14 | `Welcome to the best ${chalk.red('generator-fast-documentation')} generator!` 15 | ) 16 | ) 17 | 18 | const urlRegex = /[(http(s)?):\/\/(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/ 19 | const prompts = [ 20 | { 21 | type: 'input', 22 | name: 'title', 23 | message: 'Title for your website', 24 | validate: Boolean 25 | }, 26 | 27 | { 28 | type: 'input', 29 | name: 'tagLine', 30 | message: 'The tagline for your website.', 31 | validate: Boolean 32 | }, 33 | { 34 | type: 'input', 35 | name: 'url', 36 | message: 'URL for your website', 37 | validate: input => urlRegex.test(input) 38 | }, 39 | { 40 | type: 'input', 41 | name: 'baseUrl', 42 | message: 'Base URL for your site.', 43 | default: '/' 44 | }, 45 | { 46 | type: 'input', 47 | name: 'gitUrl', 48 | message: 'The git url', 49 | validate: input => urlRegex.test(input) 50 | }, 51 | { 52 | type: 'confirm', 53 | name: 'includeGithubActions', 54 | message: 'Do you want to include github actions?', 55 | default: true 56 | }, 57 | { 58 | type: 'confirm', 59 | name: 'includeQuickStart', 60 | message: 'Do you want to start the project after the generation (release, lint, start..)?', 61 | default: true 62 | } 63 | ] 64 | 65 | return this.prompt(prompts).then(props => { 66 | // To access props later use this.props.someAnswer; 67 | this.props = props 68 | this.props.filesToSkip = [] 69 | this.props.shortTitle = this.props.title.replace(/-/g, '') 70 | 71 | if (!this.props.includeGithubActions) { 72 | this.props.filesToSkip = this.props.filesToSkip.concat([ 73 | 'github/pr_health_check.yml' 74 | ]) 75 | } 76 | }) 77 | } 78 | 79 | writing () { 80 | const getFiles = (dirPath, filesPaths = []) => { 81 | const files = fs.readdirSync(dirPath) 82 | 83 | files.forEach(file => { 84 | if (fs.statSync(`${dirPath}/${file}`).isDirectory()) { 85 | filesPaths = getFiles(`${dirPath}/${file}`, filesPaths) 86 | } else { 87 | filesPaths.push(path.join(dirPath, file)) 88 | } 89 | }) 90 | 91 | return filesPaths 92 | } 93 | 94 | const copyFiles = (from, to) => { 95 | const templatesFolder = path.join(__dirname, 'templates', from) 96 | const files = getFiles(templatesFolder).map(file => file.split(`${from}/`)[1]) 97 | 98 | files.forEach(file => { 99 | if (this.props.filesToSkip.includes(`${from}/${file}`)) return 100 | if (file.endsWith('.ejs')) { 101 | return this.fs.copy(this.templatePath(`./${from}/${file}`), this.destinationPath(`${to}/${file.replace(/^_/, '')}`)) 102 | } 103 | 104 | this.fs.copyTpl(this.templatePath(`./${from}/${file}`), this.destinationPath(`${to}/${file.replace(/^_/, '')}`), this.props) 105 | }) 106 | } 107 | 108 | copyFiles('root', '.') 109 | copyFiles('static', 'static') 110 | copyFiles('img', 'static/img') 111 | copyFiles('github', '.github/workflows') 112 | copyFiles('docs', 'docs') 113 | copyFiles('css', 'src/css') 114 | copyFiles('husky', '.husky') 115 | } 116 | 117 | install () { 118 | this.installDependencies({ npm: true, bower: false, yarn: false }) 119 | } 120 | 121 | end () { 122 | if (this.props.includeQuickStart) { 123 | this.spawnCommandSync('npm', ['run', 'lint:fix']) 124 | this.spawnCommandSync('npm', ['run', 'release', '--', '--first-release']) 125 | this.spawnCommandSync('npm', ['run', 'test']) 126 | this.spawnCommandSync('npm', ['run', 'start']) 127 | } 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /generators/app/templates/css/custom.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Any CSS included here will be global. The classic template 3 | * bundles Infima by default. Infima is a CSS framework designed to 4 | * work well for content-centric websites. 5 | */ 6 | 7 | /* You can override the default Infima variables here. */ 8 | :root { 9 | --ifm-color-primary: #25c2a0; 10 | --ifm-color-primary-dark: rgb(33, 175, 144); 11 | --ifm-color-primary-darker: rgb(31, 165, 136); 12 | --ifm-color-primary-darkest: rgb(26, 136, 112); 13 | --ifm-color-primary-light: rgb(70, 203, 174); 14 | --ifm-color-primary-lighter: rgb(102, 212, 189); 15 | --ifm-color-primary-lightest: rgb(146, 224, 208); 16 | --ifm-code-font-size: 95%; 17 | } 18 | 19 | .docusaurus-highlight-code-line { 20 | background-color: rgba(0, 0, 0, 0.1); 21 | display: block; 22 | margin: 0 calc(-1 * var(--ifm-pre-padding)); 23 | padding: 0 var(--ifm-pre-padding); 24 | } 25 | 26 | html[data-theme='dark'] .docusaurus-highlight-code-line { 27 | background-color: rgba(0, 0, 0, 0.3); 28 | } 29 | -------------------------------------------------------------------------------- /generators/app/templates/docs/welcome.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 1 3 | id: welcome 4 | title: Welcome 5 | slug: / 6 | --- 7 | 8 | 9 | # Welcome 10 | -------------------------------------------------------------------------------- /generators/app/templates/github/pr_health_check.yml: -------------------------------------------------------------------------------- 1 | name: Check 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | check-integrity: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v2 14 | - uses: actions/setup-node@v2 15 | with: 16 | node-version: 18 17 | 18 | - name: Install dependencies 19 | run: npm ci 20 | 21 | - name: Lint 22 | run: npm run lint 23 | 24 | - name: Build Docs 25 | run: npm run build 26 | 27 | - name: Build container image 28 | run: docker build . 29 | -------------------------------------------------------------------------------- /generators/app/templates/husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no-install commitlint --edit "$1" 5 | -------------------------------------------------------------------------------- /generators/app/templates/husky/post-merge: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm i -------------------------------------------------------------------------------- /generators/app/templates/husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm run lint -------------------------------------------------------------------------------- /generators/app/templates/husky/pre-push: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm run test --coverage -------------------------------------------------------------------------------- /generators/app/templates/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UlisesGascon/generator-fast-documentation/84f6388060bb3dbe6c024b2645e9d6ea555d25d5/generators/app/templates/img/favicon.ico -------------------------------------------------------------------------------- /generators/app/templates/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UlisesGascon/generator-fast-documentation/84f6388060bb3dbe6c024b2645e9d6ea555d25d5/generators/app/templates/img/logo.png -------------------------------------------------------------------------------- /generators/app/templates/root/_.commitlintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["@commitlint/config-conventional"] 3 | } -------------------------------------------------------------------------------- /generators/app/templates/root/_.dockerignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /node_modules 3 | 4 | # Production 5 | /build 6 | 7 | # Generated files 8 | .docusaurus 9 | .cache-loader 10 | 11 | # Misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | 22 | 23 | # Logs 24 | logs 25 | *.log 26 | 27 | # Runtime data 28 | pids 29 | *.pid 30 | *.seed 31 | 32 | # Directory for instrumented libs generated by jscoverage/JSCover 33 | lib-cov 34 | 35 | # Coverage directory used by tools like istanbul 36 | coverage 37 | 38 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 39 | .grunt 40 | 41 | # node-waf configuration 42 | .lock-wscript 43 | 44 | # Compiled binary addons (http://nodejs.org/api/addons.html) 45 | build/Release 46 | 47 | # Dependency directory 48 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 49 | node_modules 50 | 51 | /k8s 52 | /.github 53 | /.git -------------------------------------------------------------------------------- /generators/app/templates/root/_.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /node_modules 3 | 4 | # Production 5 | /build 6 | 7 | # Generated files 8 | .docusaurus 9 | .cache-loader 10 | 11 | # Misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | 22 | .vscode/ -------------------------------------------------------------------------------- /generators/app/templates/root/_.nvmrc: -------------------------------------------------------------------------------- 1 | 18.12.1 2 | -------------------------------------------------------------------------------- /generators/app/templates/root/_.versionrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "types": [ 3 | {"type": "feat", "section": "Features"}, 4 | {"type": "fix", "section": "Bug Fixes"}, 5 | {"type": "chore", "hidden": "Other"}, 6 | {"type": "docs", "hidden": "Other"}, 7 | {"type": "style", "hidden": true}, 8 | {"type": "refactor", "hidden": "Other"}, 9 | {"type": "perf", "hidden": true}, 10 | {"type": "test", "hidden": true} 11 | ], 12 | "commitUrlFormat": "<%= gitUrl %>/commit/{{hash}}", 13 | "compareUrlFormat": "<%= gitUrl %>/{{previousTag}}...{{currentTag}}" 14 | } 15 | -------------------------------------------------------------------------------- /generators/app/templates/root/_Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:18.12.1-alpine 2 | 3 | WORKDIR /app 4 | 5 | # add `/app/node_modules/.bin` to $PATH 6 | ENV PATH /app/node_modules/.bin:$PATH 7 | 8 | # Install dependencies 9 | COPY ["package.json", "package-lock.json*", "./"] 10 | RUN npm install --development 11 | 12 | # add app 13 | COPY . ./ 14 | 15 | # Build 16 | RUN npm run build 17 | 18 | 19 | EXPOSE 3000 20 | # start app 21 | CMD ["npm", "run", "serve"] -------------------------------------------------------------------------------- /generators/app/templates/root/_README.md: -------------------------------------------------------------------------------- 1 | # <%= title %> 2 | 3 | <%= tagLine %> 4 | 5 | ## Website 6 | 7 | This website is built using [Docusaurus 2](https://docusaurus.io/) and [generator-fast-documentation](https://github.com/UlisesGascon/generator-fast-documentation) 8 | 9 | ### Installation 10 | 11 | ``` 12 | $ npm i 13 | ``` 14 | 15 | ### Local Development 16 | 17 | ``` 18 | $ npm start 19 | ``` 20 | 21 | This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. 22 | 23 | ### Build 24 | 25 | ``` 26 | $ npm run build 27 | ``` 28 | 29 | This command generates static content into the `build` directory and can be served using any static contents hosting service. 30 | 31 | ### Manage releases 32 | 33 | - Check [standard-version docs](https://github.com/conventional-changelog/standard-version) 34 | 35 | ### Manage git Hooks 36 | 37 | - Check [Husky docs](https://github.com/typicode/husky) -------------------------------------------------------------------------------- /generators/app/templates/root/_babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')] 3 | } 4 | -------------------------------------------------------------------------------- /generators/app/templates/root/_docusaurus.config.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Note: type annotations allow type checking and IDEs autocompletion 3 | 4 | const lightCodeTheme = require('prism-react-renderer/themes/github') 5 | const darkCodeTheme = require('prism-react-renderer/themes/dracula') 6 | 7 | /** @type {import('@docusaurus/types').Config} */ 8 | const config = { 9 | title: '<%= title %>', 10 | tagline: '<%= tagLine %>', 11 | url: '<%= url %>', 12 | baseUrl: '<%= baseUrl %>', 13 | onBrokenLinks: 'throw', 14 | onBrokenMarkdownLinks: 'throw', 15 | onDuplicateRoutes: 'throw', 16 | favicon: 'img/favicon.ico', 17 | presets: [ 18 | [ 19 | 'classic', 20 | /** @type {import('@docusaurus/preset-classic').Options} */ 21 | ({ 22 | docs: { 23 | sidebarPath: require.resolve('./sidebars.js'), 24 | routeBasePath: '/', 25 | editUrl: undefined 26 | }, 27 | theme: { 28 | customCss: require.resolve('./src/css/custom.css') 29 | } 30 | }) 31 | ] 32 | ], 33 | themeConfig: 34 | /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ 35 | ({ 36 | navbar: { 37 | title: '<%= title %>', 38 | logo: { 39 | alt: 'Logo', 40 | src: 'img/logo.png' 41 | // srcDark: 'img/logo_dark.png' 42 | }, 43 | items: [ 44 | { 45 | href: '<%= gitUrl %>', 46 | label: 'Repository', 47 | position: 'right' 48 | } 49 | ] 50 | }, 51 | footer: { 52 | style: 'dark', 53 | copyright: `Built with Docusaurus.` 54 | }, 55 | prism: { 56 | theme: lightCodeTheme, 57 | darkTheme: darkCodeTheme 58 | } 59 | }) 60 | } 61 | 62 | module.exports = config 63 | -------------------------------------------------------------------------------- /generators/app/templates/root/_package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "documentation", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "docusaurus": "docusaurus", 7 | "start": "docusaurus start", 8 | "build": "docusaurus build", 9 | "swizzle": "docusaurus swizzle", 10 | "deploy": "docusaurus deploy", 11 | "clear": "docusaurus clear", 12 | "serve": "docusaurus serve", 13 | "write-translations": "docusaurus write-translations", 14 | "write-heading-ids": "docusaurus write-heading-ids", 15 | "release": "standard-version", 16 | "release:minor": "standard-version --release-as minor", 17 | "release:patch": "standard-version --release-as patch", 18 | "release:major": "standard-version --release-as major", 19 | "lint": "standard", 20 | "lint:fix": "standard --fix", 21 | "test": "echo \"Info: no test specified\" && exit 0" 22 | }, 23 | "dependencies": { 24 | "@docusaurus/core": "2.0.0-beta.14", 25 | "@docusaurus/preset-classic": "2.0.0-beta.14", 26 | "@mdx-js/react": "1.6.21", 27 | "clsx": "1.1.1", 28 | "prism-react-renderer": "1.2.1", 29 | "react": "17.0.1", 30 | "react-dom": "17.0.1", 31 | "@commitlint/cli": "16.2.3", 32 | "@commitlint/config-conventional": "16.2.1", 33 | "@snyk/protect": "1.893.0", 34 | "husky": "7.0.4", 35 | "jest": "27.5.1", 36 | "standard": "14.3.1", 37 | "standard-version": "9.3.2" 38 | }, 39 | "browserslist": { 40 | "production": [ 41 | ">0.5%", 42 | "not dead", 43 | "not op_mini all" 44 | ], 45 | "development": [ 46 | "last 1 chrome version", 47 | "last 1 firefox version", 48 | "last 1 safari version" 49 | ] 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /generators/app/templates/root/_sidebars.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Creating a sidebar enables you to: 3 | - create an ordered group of docs 4 | - render a sidebar for each doc of that group 5 | - provide next/previous navigation 6 | 7 | The sidebars can be generated from the filesystem, or explicitly defined here. 8 | 9 | Create as many sidebars as you want. 10 | */ 11 | 12 | // @ts-check 13 | 14 | /** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ 15 | const sidebars = { 16 | // By default, Docusaurus generates a sidebar from the docs folder structure 17 | tutorialSidebar: [{ type: 'autogenerated', dirName: '.' }] 18 | 19 | // But you can create a sidebar manually 20 | /* 21 | tutorialSidebar: [ 22 | { 23 | type: 'category', 24 | label: 'Tutorial', 25 | items: ['hello'], 26 | }, 27 | ], 28 | */ 29 | } 30 | 31 | module.exports = sidebars 32 | -------------------------------------------------------------------------------- /generators/app/templates/static/_.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UlisesGascon/generator-fast-documentation/84f6388060bb3dbe6c024b2645e9d6ea555d25d5/generators/app/templates/static/_.nojekyll -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generator-fast-documentation", 3 | "version": "1.1.1", 4 | "description": "A yeoman-based template to generate a great documentation website", 5 | "homepage": "https://github.com/UlisesGascon/generator-fast-documentation", 6 | "author": { 7 | "name": "Ulises Gascón", 8 | "url": "https://ulisesgascon.com" 9 | }, 10 | "files": [ 11 | "generators" 12 | ], 13 | "main": "generators/index.js", 14 | "keywords": [ 15 | "yeoman", 16 | "generator", 17 | "documentation", 18 | "docusaurus", 19 | "docker", 20 | "k8s", 21 | "yeoman-generator" 22 | ], 23 | "devDependencies": { 24 | "@commitlint/cli": "17.2.0", 25 | "@commitlint/config-conventional": "17.2.0", 26 | "jest": "26.1.0", 27 | "standard": "17.0.0", 28 | "standard-version": "9.5.0", 29 | "yeoman-assert": "3.1.1", 30 | "yeoman-test": "1.7.0", 31 | "husky": "7.0.0" 32 | }, 33 | "engines": { 34 | "node": ">= 14.0.0", 35 | "npm": ">= 6.0.0" 36 | }, 37 | "dependencies": { 38 | "chalk": "2.1.0", 39 | "yeoman-generator": "3.1.1", 40 | "yosay": "2.0.2" 41 | }, 42 | "jest": { 43 | "testEnvironment": "node" 44 | }, 45 | "husky": { 46 | "hooks": { 47 | "pre-commit": "lint-staged" 48 | } 49 | }, 50 | "standard": { 51 | "env": [ 52 | "jest" 53 | ] 54 | }, 55 | "scripts": { 56 | "lint": "standard", 57 | "lint:fix": "standard --fix", 58 | "release": "standard-version", 59 | "release:minor": "standard-version --release-as minor", 60 | "release:patch": "standard-version --release-as patch", 61 | "release:major": "standard-version --release-as major", 62 | "test": "jest --logHeapUsage --detectOpenHandles --forceExit --verbose --color", 63 | "test:coverage": "jest --logHeapUsage --detectOpenHandles --forceExit --verbose --coverage --color", 64 | "test:watch": "jest --logHeapUsage --detectOpenHandles --forceExit --verbose --watchAll --color", 65 | "prepare": "husky install" 66 | }, 67 | "repository": "https://github.com/UlisesGascon/generator-fast-documentation", 68 | "license": "MIT" 69 | } 70 | --------------------------------------------------------------------------------