# rt-tool-cli

> Tool to manage react and lumen projects

Latest version **1.0.8** (published 2020-03-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install rt-tool-cli
pnpm add rt-tool-cli
yarn add rt-tool-cli
bun add rt-tool-cli
```

Provides the command `rt`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2020-03-05 |
| First published | 2020-02-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 14 |
| Unpacked size | 39.1 KB |
| Known vulnerabilities | 0 (+8 in 1 direct dependencies) |
| Install scripts | no |
| Author | Mohamed Refaie |
| Maintainers | mohamed1refaie |
| Keywords | CLI, generate, automation, react, lumen |

## Links

- npm: https://www.npmjs.com/package/rt-tool-cli
- npm.io page: https://npm.io/package/rt-tool-cli

## Dependencies (14)

- [clui](https://npm.io/package/clui.md) ^0.3.6
- [chalk](https://npm.io/package/chalk.md) ^3.0.0
- [clear](https://npm.io/package/clear.md) ^0.1.0
- [touch](https://npm.io/package/touch.md) ^3.1.0
- [figlet](https://npm.io/package/figlet.md) ^1.2.4
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [inquirer](https://npm.io/package/inquirer.md) ^7.0.4
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [spinnies](https://npm.io/package/spinnies.md) ^0.5.1
- [commander](https://npm.io/package/commander.md) ^4.1.1
- [pluralize](https://npm.io/package/pluralize.md) ^8.0.0
- [simple-git](https://npm.io/package/simple-git.md) ^1.131.0
- [configstore](https://npm.io/package/configstore.md) ^5.0.0
- [@octokit/rest](https://npm.io/package/@octokit/rest.md) ^16.43.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.8 (latest) — 2020-03-05
- 1.0.7 — 2020-03-04
- 1.0.6 — 2020-03-03
- 1.0.5 — 2020-03-03
- 1.0.4 — 2020-03-03
- 1.0.3 — 2020-03-03
- 1.0.2 — 2020-03-02
- 1.0.1 — 2020-02-18
- 1.0.0 — 2020-02-17

## README

# RT-Tool
![RT-Tool](https://imagehost.imageupload.net/2020/03/04/RT.png)

This is a tool to orchestrate between [Dynamic React Admin Panel](https://git.wmca.dev/project-templates/react-starter-cli) and [Dynamic Lumen API](https://git.wmca.dev/project-templates/api-starter), Also it does some other tasks like cloning the two repos, changing their remotes, installing their dependencies, Initiating both of them, setting constans and colors of admin panel, setting the .env file in API, seeding the database with initial permissions and admin, migrating, setting the CI files for both admin and API, running git commit and push.

When making a new module the tool will create the listing, form/view dialog, filters and export in the admin panel, Also it will create the migration, model, controller, routes, and seeders in the API. The tool will manage the integration between both and ask you if you want to commit, push and migrate.

## Prerequisites

1. Make sure that [node](https://nodejs.org/en/) and [yarn](https://classic.yarnpkg.com/en/docs/install#windows-stable) are both installed on your machine
2. Make sure that PHP^7 and [Composer](https://getcomposer.org/download/) are both installed on your machine
3. Make sure that [Lumen](https://lumen.laravel.com/docs/6.x) is installed on your machine
4. Make sure that [git](https://git-scm.com) is installed and correctly configured on your machine


## Instructions

To install the tool run `npm i -g rt-tool-cli`


## Usage

### Initialize a new Projects aka `rt init`
* Create two empty repos for Admin and API (and make sure to set the $STAGING_PASS in Repos' CI/CD settings)
* Create two subdomains for Admin and API
* Create a database
* Create an empty folder in your work directory and cd into it
* Run `rt init` or `rt i` and it will ask you about
    * Project Name
    * Primary Color
    * Secondary Color
    * API Link
    * Gitlab repo link for API
    * Gitlab repo link for Admin
    * DB_DATABASE value
    * DB_USERNAME value
    * DB_PASSWORD value 
       
      ![Init](https://imagehost.imageupload.net/2020/03/04/init.png)
    
    Now The tool will start cloning Admin and API, Changing their remotes, Installing their dependencies, Initiating the .env, set the CI file, Migrate, Seed the database with initial permessions, running git commit and push, Initiating the admin by setting the constants, name and colors, set the CI file and running git commit and push  
    ![Init Progress](https://imagehost.imageupload.net/2020/03/04/init2.png)

    If you set the values correctly all steps should pass and now you should three folders in your directory `admin, api, _logs`, also you should have a working live API and a working live Admin, if anything went wrong you can find a complete log file for the specific run in the `./_logs` folder

### Create a new module aka `rt module`
* CD into your your already initialized project folder
* Run `rt module` or `rt m` and it will ask you about
    * Module name
    * Number of fields ["Add, Edit, Delete", "Edit, Delete", "View, Delete", "Edit"]
    * Material-UI Icon (Category by default)
    * has-many relationships (empty by default)
    * has-one relationships (empty by default)
    * belongs-to relationships (empty by default)
    * belongs-to-many relationships (empty by default)
        ![module](https://imagehost.imageupload.net/2020/03/04/module.png)
    
    Then it will ask you about the fields details
    * Field Name
    * Field Title (used in admin panel)
    * Field Type (Text, Description, Image, CheckBox)
    * Is field required (Y/N)
    * Is field sortable (Y/N)
    * If you want the field to be in the listing (Y/N)
    * If you want the field to be in the form/view dialog (Y/N)
    * If you want the field to be in the filters (Y/N)
    * If you want the field to be in the export excel sheet (Y/N)
        ![field](https://imagehost.imageupload.net/2020/03/04/fields.png)
    
    After entering the values for the fields, the tool will make the whole module in the admin panel including listing, filters, form-dialog and export. Also it will make the migration, model, controller, routes, seeders and it will seed in the database
    Then you will be asked if you want to commit and push the changes in the Admin and API, And if you want to migrate
    
    If you pushed the changes and migrated the files you will have the module avaliable in the live Admin and the live API

### Check the version

Run `rt --version` or `rt -V`

### Check the help

Run `rt --help` or `rt -h`

---
_Source: https://npm.io/package/rt-tool-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
