Giter Site home page Giter Site logo

jeroenouw / cgx Goto Github PK

View Code? Open in Web Editor NEW
256.0 3.0 20.0 1.15 MB

💻🔥CLI to generate the recommended documentation/files to improve contribution (Github, Gitlab, CodeCommit and Bitbucket)

Home Page: https://www.npmjs.com/package/cgx

License: MIT License

JavaScript 0.37% TypeScript 99.63%
cli typescript community generator github gitlab documentation project-documentation markdown documentation-generator

cgx's Introduction

CGX - CLI to Generate recommended documentation/files to improve contribution

npmversion npmlicense downloads

Do you want people to contribute to your project? Make it easy for your contributors. Generate all the recommended documentation/files (pre-filled) for the Github and Gitlab community standards. Files for CodeCommit (AWS) or Bitbucket can be generated too. This project has 99+% type coverage checked by tscov.

Generate multiple files at once

Generate a license

Files that can be generated

More files & providers in future versions.

Github, Gitlab, CodeCommit and Bitbucket

  • License
    • MIT
    • ISC
    • Apache 2.0
    • BSD 2-Clause
    • GPLv3
    • CCOv1
  • Changelog
  • Contributing
  • Readme
  • Todo
  • Code of Conduct
  • Dockerfile

Github specific

  • Bug report (issue)
  • Security vulnerability report
  • Feature request (issue)
  • Pull request template
  • CodeQL Analysis
  • Node CI
  • All files at once

Gitlab specific

  • CI template
  • Bug (issue)
  • Feature proposal (issue)
  • Merge request
  • All files at once

CodeCommit specific

  • Buildspec (AWS CodeBuild)
  • Appspec (AWS CodeDeploy)
  • All files at once

Bitbucket specific

  • In future versions

Useful for every project

  • Existing or new
  • Large or small
  • Every language
  • Github, Gitlab, CodeCommit (AWS) or Bitbucket

Quickstart

Install the CGX CLI as a global CLI.

npm install -g cgx

cd <your-repo-location>

# Then you run
cgx

Or just use via npx:

cd <your-repo-location>

# Then you run
npx cgx

This should start the CLI and ask for questions about which files you want to add!

Example

Generate all Github files example:

   ____    ____  __  __
  / ___|  / ___| \ \/ /
 | |     | |  _   \  /
 | |___  | |_| |  /  \
  \____|  \____| /_/\_\

Generate all the recommended markdown documentation/templates for the Github and Gitlab community standards.  
Files for CodeCommit (AWS) or Bitbucket can be generated too
? Select a Git hosting provider: Github
? Which Github files do you want to generate? All recommended files (other files can be generated separate)
INFO: Start generating all recommended files...

GENERATE: CODE_OF_CONDUCT.md...
GENERATE: CONTRIBUTING.md...
GENERATE: bug_report.md...
GENERATE: feature_request.md...
GENERATE: pull_request_template.md...
CREATE: bug_report.md in .github/ISSUE_TEMPLATE/bug_report.md
CREATE: CODE_OF_CONDUCT.md.md
CREATE: CONTRIBUTING.md
CREATE: feature_request.md in .github/ISSUE_TEMPLATE/feature_request.md
CREATE: pull_request_template.md in .github/PULL_REQUEST_TEMPLATE/pull_request_template.md

Git provider question:

? Select a Git hosting provider: (Use arrow keys)
❯ Github
  Gitlab
  CodeCommit (AWS)
  Bitbucket

Generate file question:

? Which Gitlab files do you want to generate? (Use arrow keys)
❯ All recommended files (other files can be generated separate)
  License
  Changelog
  Code of conduct
  Contributing
  Bug report (issue)
  Feature request (issue)
  Pull request template
  Readme
  Todo
  Dockerfile

Generate license example:

? Select a Git hosting provider: Github
? Which Gtihub files do you want to generate? License
GENERATE: LICENSE...
? Which type of license do you want to generate? MIT License
? Please fill in your Git username: Jeroenouw
CREATE: LICENSE

File already exists example:

? Select a Git hosting provider: Bitbucket
? Which Bitbucket files do you want to generate? Contributing
GENERATE: CONTRIBUTING.md...
? This file already exists. Do you want to overwrite it? Yes
UPDATE: CONTRIBUTING.md

cgx's People

Contributors

aiherrera avatar farist avatar jeroenouw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cgx's Issues

Handle exception when trying to create a changelog file in a non-git directory

Describe the bug
Exception is raised when user tries to create Changelog file in a directory without Git initialised.

To Reproduce
Steps to reproduce the behavior:

  1. Run cgx
  2. Select any provider
  3. Scroll down to Changelog
  4. See error
fatal: not a git repository (or any of the parent directories): .git
(node:4920) UnhandledPromiseRejectionWarning: Error: Command failed: git log --pretty=format:"%h%n%d%n%an%n%s%n%ai%n%b%ae%n%n" --no-merges -z
fatal: not a git repository (or any of the parent directories): .git

    at checkExecSyncError (child_process.js:611:11)
    at Object.execSync (child_process.js:647:15)
    at Changelog.generateFileContent (C:\Users\joaos\AppData\Roaming\npm\node_modules\cgx\lib\templates\universal\changelog.template.js:17:35)
    at Changelog.generateFile (C:\Users\joaos\AppData\Roaming\npm\node_modules\cgx\lib\templates\universal\changelog.template.js:13:63)
    at GithubActions.<anonymous> (C:\Users\joaos\AppData\Roaming\npm\node_modules\cgx\lib\actions\github.actions.js:43:70)
    at step (C:\Users\joaos\AppData\Roaming\npm\node_modules\cgx\node_modules\tslib\tslib.js:136:27)
    at Object.next (C:\Users\joaos\AppData\Roaming\npm\node_modules\cgx\node_modules\tslib\tslib.js:117:57)
    at fulfilled (C:\Users\joaos\AppData\Roaming\npm\node_modules\cgx\node_modules\tslib\tslib.js:107:62)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:4920) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:4920) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Expected behavior
In a directory iwthout a .git subdirectory, cgx must show an error message like This is not a Git repository and exit.

Desktop (please complete the following information):
- OS: Windows 10 v2004 build 19041.21

Unit test hangs because Sinon stub doesn't work

Describe the bug
When I run npm run test:unit the test hangs with Inquirer prompt and Sinon stub doesn't get used

To Reproduce
Steps to reproduce the behavior:

  1. add .mocharc.js with below code in it to run with new Mocha version and node v14.14.0
'use strict';

module.exports = {
  diff: true,
  extension: ['ts'],
  reporter: 'spec',
  recursive: true,
  require: ['ts-node/register', 'test/mocha.require.ts'],
  spec: 'src/**/*.spec.ts',
  watch: true
}
  1. Run npm run test:unit

Expected behavior
Test should run fine

Screenshots
Screen Shot 2020-10-19 at 11 22 59 pm

Add unit tests

Describe the solution you'd like
Adding unit testing to prevent bugs

Additional context
Pre-work is done at branch 1.3.0 (using mocha, nyc, sinon)

TemplateGenerator class that can be extended

Is your feature request related to a problem? Please describe.
x

Describe the solution you'd like
TemplateGenerator class that can be extended instead of code duplications

Describe alternatives you've considered
x

Additional context
x

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.