Git Frameworker
Git Frameworker is a tool that allows you to quickly bootstrap a project using a framework from GitHub. If the repository you clone contains a framework.json
file, Git Frameworker will automatically create a CLI to configure and bootstrap the project.
Installation
To install Git Frameworker, run the following command:
npm install -g git-frameworker
Using Git Frameworker
To use Git Frameworker, simple run the command in your terminal:
git-frameworker
The cli will guide you through the process of configuring and bootstrapping your project.
framework.json
Configuring The framework.json
file allows you to configure your project based on your specific needs. Here's an example of what a framework.json
file might look like:
{
"projectName": "My Awesome Project",
"projectDescription": "A brief description of your project",
"questions": [
{
"name": "databaseType",
"type": "multiple-choice",
"options": ["MySQL", "PostgreSQL", "MongoDB"]
},
{
"name": "useAuthentication",
"type": "confirm",
"message": "Do you want to use authentication?"
},
{
"name": "eslint",
"type": "confirm",
"message": "Do you want to use ESLint?",
"isPartial": true
}
]
}
projectName
and projectDescription
These two options allow you to specify the name and description of your project. They will be used in the README.md
file and other documentation generated by the CLI.
questions
The questions
array allows you to define custom questions that will be asked when the CLI is run. Each question object should have the following properties:
name
: A unique name for the question.type
: The type of question (e.g.input
,confirm
,multiple-choice
).message
: The message to display when the question is asked.default
(optional): The default value to use if the user does not provide an answer.options
(required formultiple-choice
): An array of options formultiple-choice
questions.
Supported Question Types
Currently, Git Frameworker supports the following question types:
input
: A basic text input.confirm
: A yes/no confirmation question.multiple-choice
: A question with a list of options to choose from.
Creating the templates
The options passed will only work if you set the templates in the templates
folder. The templates folder should have the following structure:
templates
├─── <multiple>:<option>_<confirm>:<true or false>_...
Partial Questions
If the isPartial
property is set to true
then this question shoudn't be added in the templates folder. You must create a partials
folder and create a folder with the name of the question. Inside this folder you must create the templates for the options of the question. The partials folder should have the following structure:
partials
├─── <question_name>:<option>
...
The folder should only contain the files that will be changed if the option is selected.
Example
This is an example of a framework for backend
{
"projectName": "My Awesome Project",
"projectDescription": "A brief description of your project",
"questions": [
{
"name": "database",
"type": "multiple-choice",
"options": ["MySQL", "PostgreSQL", "MongoDB"]
},
{
"name": "auth",
"type": "confirm",
"message": "Do you want to use authentication?"
},
{
"name": "format",
"type": "confirm",
"message": "Do you want to have auto formatting?",
"isPartial": true
}
]
}
This would be the right structure for the repository:
partials
└─── format
└─── <some file for the formatting config>
templates
├─── database:MySQL_auth:true
├─── database:MySQL_auth:false
├─── database:PostgreSQL_auth:true
├─── database:PostgreSQL_auth:false
├─── database:MongoDB_auth:true
└─── database:MongoDB_auth:false
framework.json
When the user selects
Contributing
Contributions are welcome! If you have an idea for a new feature or would like to report a bug, please open an issue. If you would like to contribute code, please open a pull request.