All Projects → matchabot → matcha-bot

matchabot / matcha-bot

Licence: MIT license
MatchaBot is a code generator. You can use matchabot to create an entire project, or to generate code inside an existing project consistently.

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
Handlebars
879 projects
HTML
75241 projects
CSS
56736 projects
EJS
674 projects

Projects that are alternatives of or similar to matcha-bot

Generator Spfx
Open-source generator to extend the capabilities of the Microsoft SPFx generator
Stars: ✭ 150 (+971.43%)
Mutual labels:  yeoman, handlebars
enquirer
Stylish, intuitive and user-friendly prompts, for Node.js. Used by eslint, webpack, yarn, pm2, pnpm, RedwoodJS, FactorJS, salesforce, Cypress, Google Lighthouse, Generate, tencent cloudbase, lint-staged, gluegun, hygen, hardhat, AWS Amplify, GitHub Actions Toolkit, @airbnb/nimbus, and many others! Please follow Enquirer's author: https://github.…
Stars: ✭ 6,523 (+46492.86%)
Mutual labels:  yeoman, inquirer
CodegenCS
C# Toolkit for Code Generation (T4 alternative!)
Stars: ✭ 119 (+750%)
Mutual labels:  codegenerator
generator-vue-plugin
Yeoman generator generating vue plugin 🚀
Stars: ✭ 29 (+107.14%)
Mutual labels:  yeoman
codegenerator
Generate EF6 WebApi with an AngularJS font-end
Stars: ✭ 11 (-21.43%)
Mutual labels:  codegenerator
generator-kodi-addon
Yeoman generator for the most common Kodi addon types.
Stars: ✭ 69 (+392.86%)
Mutual labels:  yeoman
generator-laravel-5
Scaffold Laravel 5.7 applications with ease.
Stars: ✭ 19 (+35.71%)
Mutual labels:  yeoman
ui-editor
Working concept for low code frontend, core for code generation, scales to designs to code.
Stars: ✭ 80 (+471.43%)
Mutual labels:  codegenerator
generator-latex
Yeoman Generator for LaTeX up-to-date documents
Stars: ✭ 29 (+107.14%)
Mutual labels:  yeoman
generator-django
A Yeoman generator for Django.
Stars: ✭ 78 (+457.14%)
Mutual labels:  yeoman
shared-react-components-example
An example of a mono-repository of shared React components libraries!
Stars: ✭ 85 (+507.14%)
Mutual labels:  yeoman
HandlerFrame
🐮 HandlerFrame是一个基于观察者模式采用信息分发机制实现跨界面Handler通讯框架,整个项目里面只存在一个Handler实例对象。
Stars: ✭ 42 (+200%)
Mutual labels:  handlebars
extensions
Code Generators and Extensions for vanilla-rtb stack
Stars: ✭ 16 (+14.29%)
Mutual labels:  handlebars
velvet
A sweet velvety templating package
Stars: ✭ 72 (+414.29%)
Mutual labels:  handlebars
nlw-03-discovery
Projeto construído durante o Next Level Week #03
Stars: ✭ 124 (+785.71%)
Mutual labels:  handlebars
generator
Java code generator
Stars: ✭ 87 (+521.43%)
Mutual labels:  codegenerator
pacNEM
pacNEM is a Browser PacMan game with NodeJS, Socket.io, Handlebars and NEM Blockchain
Stars: ✭ 20 (+42.86%)
Mutual labels:  handlebars
startover
Startover is a boilerplate for developing static websites. With Startover you don't have to start over!
Stars: ✭ 15 (+7.14%)
Mutual labels:  handlebars
go2gql
graphql-go schema generator by proto files
Stars: ✭ 33 (+135.71%)
Mutual labels:  codegenerator
cmake-reflection-template
A template for simple C++ reflection done with CMake and Python (no other external tools)
Stars: ✭ 37 (+164.29%)
Mutual labels:  codegenerator

MatchaBot

Robot

Netlify Status

Introduction

MatchaBot is a code generator written in TypeScript.

You can use matchabot to create an entire project, or to generate code inside an existing project in a consistent way.

This tool has been created to offer a "Ruby on Rail" like programming experience with any projects: React / Vue / Angular, NextJS / Gatsby, etc ...

The complete documentation of the project is available at https://www.matchabot.site/

Features

  • Easy to use in project generator
  • You can create your own generator by project, or use a global templates repository
  • Templating language support: HandleBars and EJS
  • Powerful command line support: automatic CLI arguments and automatic prompts for missing arguments
  • Simplified workflow to create new generators for you own project
  • Debug mode
  • Add new file to your project
  • Modify existing files
  • You can generate any kind of files/projects (NodeJS, typescript, Javascript, SQL, C++, C, Go, ...)

Benefits

  • Simple and Powerful
  • Save time and Boost your productivity
  • Enforce a consistent project structure
  • Easier team onboarding with a codified best practices stored inside each project
  • Fun to use 🦄

Key concepts

  • 👉 A code generator is identified by a name
  • 👉 A code generator offer one or more commands
  • 👉 A command takes a list of arguments as input and execute a list of actions ⚙️.
  • 👉 ️️A generator action is specified by one or multiple template written with a templating language such as HandleBars or EJS
  • 👉 The generators definition are stored inside your project inside the ./_machatbot directory as a subdirectory
  • 👉 commands are defined by a matchabot.cmd.json file inside the ./_machatbot/--generator-name-- directory

👉 How to start

1 - Add matchabot to your project

Execute the following command at the root of your project.

yarn add matchabot --dev

or

npm install matchabot --save-dev

💡 matchabot can be installed globally with

npm install -g matchabot

2️ - Initialise matchabot

Execute the following command at the root of your project.

matchabot init

👉 This command create a local directory ./_matchabot inside your current project directory

Content of _matchabot

_matchabot
├── license
│   ├── add
│   │   ├── apache2.md.hbs
│   │   ├── bsd.md.hbs
│   │   ├── gnu3.md.hbs
│   │   ├── matchabot.cmd.json
│   │   └── mit.md.hbs
│   └── matchabot.json
└── react-app
    ├── create-app
    │   ├── matchabot.cmd.json
    │   └── template
    ├── create-component
    │   ├── component.tsx.hbs
    │   ├── matchabot.cmd.json
    │   ├── stories.tsx.hbs
    │   └── style.tsx.hbs
    └── matchabot.json

In this example, the _matchabot is composed of 2 generators

  • license
  • react-app

Each generator is defined by a matchabot.jsonfile

Example for license

{
  "name": "license",
  "description": "📃 Add licence to your project",
  "version": "1.0.0"
}

Each subdirectory contains a definition of a command associated with a generator

For the react-appgenerator we have 2 commands:

  • create-app
  • create-component

Each subdirectory contains a matchabot.cmd.json file that defines the commands and list of actions to perform.

Example ./_matchabot/license/add/matchabot.cmd.json:

{
  "name": "add",
  "description": "add a licence file to your project",
  "version": "1.0.0",
  "args": [
    {
      "name": "CopyRightsHolder",
      "alias": "c",
      "type": "string",
      "default": "{{process.env.LOGNAME}}"
    },
    {
      "name": "ProgramDescription",
      "alias": "p",
      "type": "string"
    },
    {
      "name": "LicenceType",

      "type": "list",
      "choices": [
        { "name": "MIT License", "value": "mit" },
        { "name": "BSD License", "value": "bsd" },
        { "name": "Apache License, Version 2.0", "value": "apache2" },
        { "name": "GNU General Public License version 3", "value": "gnu3" }
      ],
      "default": "MIT"
    }
  ],
  "actions": [
    {
      "type": "template",
      "name": "Generate Licence",
      "source": "{{toLowerCase LicenceType}}.md.hbs",
      "target": "LICENCE.md"
    }
  ]
}

command arguments

In this example, the args array contains a list of arguments (variables) that will be used in the templates.

Example of template Handlebar syntax

MIT License

{{ProgramDescription}}.


Copyright (c) {{formatDate currentDate "YYYY"}} - {{CopyRightsHolder}}

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

command actions

In this example with only have 1 action: select a template from "source": "{{toLowerCase LicenceType}}.md.hbs" and generates a file "target": "LICENCE.md"

3 - List all available generators

matchabot list

👉 This command gives the list of defined generators

  __  __       _       _             ____        _
 |  \/  | __ _| |_ ___| |__   __ _  | __ )  ___ | |_
 | |\/| |/ _` | __/ __| '_ \ / _` | |  _ \ / _ \| __|
 | |  | | (_| | || (__| | | | (_| | | |_) | (_) | |_
 |_|  |_|\__,_|\__\___|_| |_|\__,_| |____/ \___/ \__|

Version: 0.3.0 🍵

Availables generators
---------------------

┌────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────┬────────────────────────────────────────────────────────────────────────────────┐
│ name               │ description                                                                                                            │ version  │ location                                                                       │
├────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────┼────────────────────────────────────────────────────────────────────────────────┤
│ generator          │ 🤖 Built-in generator of generators: create your own generator                                                        │ 1.0.0    │ ./_matchabot/generator                                                         │
├────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────┼────────────────────────────────────────────────────────────────────────────────┤
│ license            │ 📃 Add licence to your project                                                                                        │ 1.0.0    │ ./_matchabot/license                                                           │
├────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────┼────────────────────────────────────────────────────────────────────────────────┤
│ react-app          │ 🚀 react app generator                                                                                                 │ 1.0.0    │ ./_matchabot/react-app                                                         │
└────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────┴────────────────────────────────────────────────────────────────────────────────┘

4 - List available commands for a generator

Lists all the commands of the generator react-app

matchabot react-app list

Result

  __  __       _       _             ____        _
 |  \/  | __ _| |_ ___| |__   __ _  | __ )  ___ | |_
 | |\/| |/ _` | __/ __| '_ \ / _` | |  _ \ / _ \| __|
 | |  | | (_| | || (__| | | | (_| | | |_) | (_) | |_
 |_|  |_|\__,_|\__\___|_| |_|\__,_| |____/ \___/ \__|

Version: 0.3.0 🍵

Availables command(s) for react-app
-----------------------------------

┌────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────┬────────────────────────────────────────────────────────────────────────────────┐
│ name                                   │ description                                                                                                            │ version  │ location                                                                       │
├────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────┼────────────────────────────────────────────────────────────────────────────────┤
│ create-app                             │ create a typescript react app                                                                                          │ 1.0.0    │ ./_matchabot/react-app/create-app                                              │
├────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────┼────────────────────────────────────────────────────────────────────────────────┤
│ create-component                       │ generate a Styled React Component, and an associated story                                                             │ 1.0.0    │ ./_matchabot/react-app/create-component                                        │
└────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────┴────────────────────────────────────────────────────────────────────────────────┘

5 - Use a generator to scaffold a project

Creation of a React Application using a template generator

matchabot react-app create-app

Result

  __  __       _       _             ____        _
 |  \/  | __ _| |_ ___| |__   __ _  | __ )  ___ | |_
 | |\/| |/ _` | __/ __| '_ \ / _` | |  _ \ / _ \| __|
 | |  | | (_| | || (__| | | | (_| | | |_) | (_) | |_
 |_|  |_|\__,_|\__\___|_| |_|\__,_| |____/ \___/ \__|

Version: 0.3.0 🍵

? ApplicationName MyReactApp

🍵 Generating files ...


👉 Created files
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].