calima-solutions/calima-genesis

CLI tool for Calima developers.

v1.0.7 2022-11-17 12:59 UTC

This package is auto-updated.

Last update: 2024-04-17 16:27:00 UTC


README

68747470733a2f2f67656e657369732e62792e63616c696d61736f6c7574696f6e732e636f6d2f6173736574732f67656e657369732d62792d63616c696d612e706e67

Genesis is a CLI tool built by Calima for their own workflow. It's a CLI tool that provides an elegant and automated starting point for your project, as well as providing different modules that can be installed in your application to make development easier and faster.

Requirements

  • PHP8.1+ is required

Installation

Genesis can be installed with Composer by running the following command:

composer global require calima-solutions/calima-genesis

If you get an error, try running composer global update and then try to install again.

Updating

To update the CLI tool, just run genesis self-update and it will download a newer version if your local copy is not updated.

Authentication

Once Genesis is installed, you can log in with the credentials provided by Calima using the following command:

genesis authenticate

You will be prompted for your email and password, and a token will be stored in your computer for faster access.

Creating a new project

Genesis provides a quick starting point for both back-end and front-end projects right from the CLI. Just run genesis start <project> and follow the wizard to create the project with Calima standards.

Available projects

Laravel

Run genesis start laravel and Genesis will guide you through the process. The following elements are optional and you will be prompted during the installation:

  • Filament: An admin panel based on the TALL Stack
  • Breeze: Provides authentication and installs TailwindCSS
  • Actions: A package that uses a new way of organising the logic of your Laravel applications by focusing on the actions your application provide

Apart from this, this command will install the following elements:

  • Pint: Code formatter following Laravel standards
  • Laravel Log Viewer: A beautiful log viewer, already protected so it can only be seen by Calima employees
  • Larastan: Static code analysis for Laravel
  • Pull Request template: a PR template following the standard in Calima

Ionic App

Run genesis start ionic and Genesis will guide you through the process. The following elements are optional and you will be prompted during the installation:

  • Tailwind: CSS Framework for fast prototyping
  • API Service: Provides a starting point for using an API in your app

Custom commands

Genesis is not only a great tool for starting a project, but also to use it when a project is already running. Custom commands automate some actions that are common during our daily work:

  • Installation of useful packages
  • Execution of tests
  • Linting the code
  • And many more things coming

Listing custom commands

To list the available commands, execute the following line on the CLI:

genesis commands

Executing a custom command

Once you find the command you were looking for, you can execute it like this:

genesis run <signature>

For example, if I wanted to run install:tailwind-angular on my Ionic app, I would run:

genesis run install:tailwind-angular

This command would install TailwindCSS with the Typography and Forms packages, create the tailwind.config.js file with a primary and secondary colors and add the @tailwind calls on the CSS file.

Modules

Modules are Genesis' way of sharing code between projects. When we create an integration or a tool, we can convert it to a module and it can be used by all our Calima colleagues in their projects.

Each module can have different flavors for each technology or integration type. For example, if we were building a module for a blogging system it could have the following flavors:

  • Blade
  • Inertia Vue
  • Inertia React
  • Livewire
  • Filament panel
  • API

Although it would be ideal, not every module will have all the flavors available. Genesis provides a quick access to all the modules and their flavors.

Listing modules

Run genesis modules to print a list of the available modules on the console. The columns Module ID and Versions are specially important, as they are the ones used to install a module afterwards.

Installing a module

To install a module, you can execute the following command:

genesis module {identifier?} {flavor?}

If you already know the identifier and flavor you want to install, you can directly add it to the command. If you don't know either, you can just run genesis module and the CLI will help you with some autocompletion.

Creating modules

The process of creating modules is still pending to be documented, although the requirements for a module to be accepted are defined in the following lines.

Requirements and guidelines

  • Flavors should be as small as possible (ej. one module for the migrations and models, another one for the admin panel, another one for Blade views, another one for API...) so they can be stacked
  • The module code should be transferred to calima-solutions GitHub account so that Genesis has access
  • The module should be placed inside a brand-new project so we're sure it can run isolated
  • Back-end code must be tested with Unit / Feature tests where possible, and tests must be passing. If tests cannot be provided, the README should provide information on how to test it
  • It should have a README.md file explaining how enough documentation on how it can be used